From 132f64a1b001759ab07793cc49160bc9581d2429 Mon Sep 17 00:00:00 2001 From: "zhuoran.wzr" Date: Wed, 20 Feb 2019 15:14:35 +0800 Subject: [PATCH] Tunnel client initial version. --- README.md | 10 +- pom.xml | 451 +- src/main/assembly/package.xml | 2 +- .../openservices/tablestore/AsyncClient.java | 324 + .../tablestore/AsyncClientInterface.java | 377 + .../tablestore/ClientConfiguration.java | 406 + .../tablestore/ClientException.java | 87 + .../tablestore/DefaultTableStoreWriter.java | 273 + .../tablestore/InternalClient.java | 1212 + .../PartialResultFailedException.java | 37 + .../tablestore/PrepareCallback.java | 6 + .../openservices/tablestore/SyncClient.java | 461 + .../tablestore/SyncClientInterface.java | 391 + .../tablestore/TableStoreCallback.java | 18 + .../tablestore/TableStoreException.java | 110 + .../tablestore/TableStoreWriter.java | 144 + .../openservices/tablestore/TunnelClient.java | 239 + .../tablestore/TunnelClientInterface.java | 138 + .../core/AbortTransactionLauncher.java | 63 + .../core/AbstractWatchableCallback.java | 20 + .../core/AsyncBatchGetRowCompletion.java | 193 + .../tablestore/core/AsyncCompletion.java | 125 + .../core/AsyncGetRangeCompletion.java | 143 + .../core/AsyncGetRowCompletion.java | 95 + .../tablestore/core/BatchGetRowLauncher.java | 74 + .../core/BatchWriteRowLauncher.java | 75 + .../tablestore/core/CallbackImpledFuture.java | 119 + .../tablestore/core/CheckpointLauncher.java | 61 + .../core/CommitTransactionLauncher.java | 63 + .../core/ComputeSplitsBySizeLauncher.java | 66 + .../core/ConnectTunnelLauncher.java | 60 + .../tablestore/core/Constants.java} | 24 +- .../tablestore/core/CreateIndexLauncher.java | 65 + .../core/CreateSearchIndexLauncher.java | 63 + .../tablestore/core/CreateTableLauncher.java | 65 + .../tablestore/core/CreateTunnelLauncher.java | 60 + .../tablestore/core/DeleteIndexLauncher.java | 63 + .../tablestore/core/DeleteRowLauncher.java | 63 + .../core/DeleteSearchIndexLauncher.java | 63 + .../tablestore/core/DeleteTableLauncher.java | 65 + .../tablestore/core/DeleteTunnelLauncher.java | 60 + .../core/DescribeSearchIndexLauncher.java | 63 + .../core/DescribeStreamLauncher.java | 62 + .../core/DescribeTableLauncher.java | 65 + .../core/DescribeTunnelLauncher.java | 60 + .../tablestore/core/ErrorCode.java | 145 + .../core/GetCheckpointLauncher.java | 60 + .../tablestore/core/GetRangeLauncher.java | 63 + .../tablestore/core/GetRowLauncher.java | 63 + .../core/GetShardIteratorLauncher.java | 64 + .../core/GetStreamRecordLauncher.java | 62 + .../tablestore/core/HeartbeatLauncher.java | 60 + .../tablestore/core/LauncherFactory.java | 396 + .../core/ListSearchIndexLauncher.java | 63 + .../tablestore/core/ListStreamLauncher.java | 63 + .../tablestore/core/ListTableLauncher.java | 65 + .../tablestore/core/ListTunnelLauncher.java | 61 + .../tablestore/core/OperationLauncher.java | 186 + .../tablestore/core/PutRowLauncher.java | 64 + .../tablestore/core/ReadRecordsLauncher.java | 60 + .../core}/ResponseContentWithMeta.java | 19 +- .../tablestore/core/SearchLauncher.java | 63 + .../core/ShutdownTunnelLauncher.java | 60 + .../core/StartLocalTransactionLauncher.java | 63 + .../tablestore/core/TraceLogger.java | 55 + .../tablestore/core/UpdateRowLauncher.java | 64 + .../tablestore/core/UpdateTableLauncher.java | 66 + .../tablestore/core/WatchableCallback.java | 8 + .../tablestore/core/auth/AuthUtils.java | 87 + .../core/auth/BasicCredentials.java | 78 + .../core/auth/CredentialsFetcher.java | 76 + .../core/auth/CredentialsProvider.java | 33 + .../core/auth/CredentialsProviderFactory.java | 101 + .../core/auth/DefaultCredentialProvider.java | 71 + .../core/auth/DefaultCredentials.java | 62 + ...nvironmentVariableCredentialsProvider.java | 52 + .../core/auth/HmacSHA1Signature.java | 66 + .../core/auth/HttpCredentialsFetcher.java | 89 + .../core/auth/InstanceProfileCredentials.java | 85 + .../InstanceProfileCredentialsFetcher.java | 110 + .../InstanceProfileCredentialsProvider.java | 93 + .../auth/InvalidCredentialsException.java | 41 + .../tablestore/core/auth/RequestSigner.java | 77 + .../core/auth/RequestSignerInterface.java | 10 + .../core/auth/ServiceCredentials.java | 41 + .../core/auth/ServiceSignature.java | 17 + .../SystemPropertiesCredentialsProvider.java | 52 + .../AbortTransactionResponseConsumer.java | 30 + .../core/http}/AsyncServiceClient.java | 327 +- .../http/BatchGetRowResponseConsumer.java | 90 + .../http/BatchWriteRowResponseConsumer.java | 93 + .../core/http/CheckpointResponseConsumer.java | 27 + .../CommitTransactionResponseConsumer.java | 31 + .../ComputeSplitsBySizeResponseConsumer.java | 29 + .../http/ConnectTunnelResponseConsumer.java | 27 + .../core/http/ContentMD5ResponseHandler.java | 55 + .../http/CreateIndexResponseConsumer.java | 29 + .../CreateSearchIndexResponseConsumer.java | 29 + .../http/CreateTableResponseConsumer.java | 29 + .../http/CreateTunnelResponseConsumer.java | 27 + .../http/DeleteIndexResponseConsumer.java | 29 + .../core/http/DeleteRowResponseConsumer.java | 29 + .../DeleteSearchIndexResponseConsumer.java | 29 + .../http/DeleteTableResponseConsumer.java | 29 + .../http/DeleteTunnelResponseConsumer.java | 27 + .../DescribeSearchIndexResponseConsumer.java | 29 + .../http/DescribeStreamResponseConsumer.java | 29 + .../http/DescribeTableResponseConsumer.java | 29 + .../http/DescribeTunnelResponseConsumer.java | 27 + .../core/http/ErrorResponseHandler.java | 61 + .../core/http}/ExecutionContext.java | 27 +- .../http/GetCheckpointResponseConsumer.java | 26 + .../core/http/GetRangeResponseConsumer.java | 29 + .../core/http/GetRowResponseConsumer.java | 29 + .../GetShardIteratorResponseConsumer.java | 29 + .../http/GetStreamRecordResponseConsumer.java | 29 + .../core/http/HeartbeatResponseConsumer.java | 26 + .../tablestore/core/http}/HttpFactory.java | 25 +- .../http/ListSearchIndexResponseConsumer.java | 29 + .../core/http/ListStreamResponseConsumer.java | 29 + .../core/http/ListTableResponseConsumer.java | 29 + .../core/http/ListTunnelResponseConsumer.java | 27 + .../core/http/OTSDeflateResponseHandler.java | 59 + .../tablestore/core/http}/OTSUri.java | 8 +- .../http/OTSValidationResponseHandler.java | 88 + .../core/http/PutRowResponseConsumer.java | 29 + .../http/ReadRecordsResponseConsumer.java | 26 + .../tablestore/core/http/RequestHandler.java | 12 + .../tablestore/core/http}/RequestMessage.java | 101 +- .../core/http/ResponseConsumer.java} | 84 +- .../tablestore/core/http/ResponseHandler.java | 14 + .../core/http}/ResponseMessage.java | 132 +- .../core/http/SearchResponseConsumer.java | 29 + .../http/ShutdownTunnelResponseConsumer.java | 26 + ...StartLocalTransactionResponseConsumer.java | 31 + .../core/http/UpdateRowResponseConsumer.java | 29 + .../http/UpdateTableResponseConsumer.java | 29 + .../core/protocol/OTSProtocolBuilder.java | 812 + .../core/protocol/OTSProtocolParser.java | 230 + .../tablestore/core/protocol/OtsFilter.java | 2466 + .../core/protocol/OtsInternalApi.java | 44516 ++++++++++++++++ .../core/protocol/PlainBufferBuilder.java | 395 + .../core/protocol/PlainBufferCell.java | 179 + .../protocol/PlainBufferCodedInputStream.java | 258 + .../PlainBufferCodedOutputStream.java | 283 + .../core/protocol/PlainBufferConsts.java | 108 + .../core/protocol/PlainBufferConversion.java | 182 + .../core/protocol/PlainBufferCrc8.java | 95 + .../core/protocol/PlainBufferExtension.java | 34 + .../core/protocol/PlainBufferInputStream.java | 116 + .../protocol/PlainBufferOutputStream.java | 92 + .../core/protocol/PlainBufferRow.java | 100 + .../protocol/PlainBufferSequenceInfo.java | 47 + .../core/protocol}/ProtocolBufferParser.java | 41 +- .../core/protocol/ResponseFactory.java | 712 + .../core/protocol}/ResultParseException.java | 3 +- .../core/protocol}/ResultParser.java | 10 +- .../core/protocol/ResultParserFactory.java | 17 + .../tablestore/core/protocol/Search.java | 25478 +++++++++ .../core/protocol/SearchProtocolBuilder.java | 208 + .../core/protocol/SearchProtocolParser.java | 188 + .../core/protocol/SearchQueryBuilder.java | 228 + .../core/protocol/SearchSortBuilder.java | 121 + .../core/protocol/SearchVariantType.java | 104 + .../core/protocol/TunnelProtocolBuilder.java | 155 + .../core/protocol/TunnelServiceApi.java | 19882 +++++++ .../tablestore/core/protocol/ots_filter.proto | 47 + .../core/protocol/ots_internal_api.proto | 488 + .../tablestore/core/protocol/search.proto | 333 + .../core/protocol/tunnel_service_api.proto | 197 + .../tablestore/core/utils/Base64.java | 173 + .../tablestore/core}/utils/BinaryUtil.java | 31 +- .../tablestore/core}/utils/Bytes.java | 15 +- .../core/utils/CalculateHelper.java | 20 + .../tablestore/core/utils/CompressUtil.java} | 8 +- .../tablestore/core}/utils/DateUtil.java | 6 +- .../tablestore/core/utils/FormatType.java | 30 + .../tablestore/core/utils/HttpRequest.java | 214 + .../tablestore/core/utils/HttpResponse.java | 147 + .../tablestore/core}/utils/HttpUtil.java | 13 +- .../tablestore/core}/utils/IOUtils.java | 9 +- .../tablestore/core/utils/IniEditor.java | 1255 + .../tablestore/core/utils/Jsonizable.java | 6 + .../tablestore/core/utils/LogUtil.java | 122 + .../tablestore/core/utils/MethodType.java | 10 + .../tablestore/core/utils/Objects.java | 24 + .../tablestore/core/utils/OptionalValue.java | 63 + .../tablestore/core}/utils/Pair.java | 2 +- .../tablestore/core/utils/ParamChecker.java | 96 + .../tablestore/core}/utils/Preconditions.java | 15 +- .../tablestore/core/utils/StringUtils.java | 295 + .../model/AbortTransactionRequest.java | 40 + .../model/AbortTransactionResponse.java | 10 + .../model/AbstractColumnIteratorImpl.java | 7 + .../tablestore/model/AlwaysRetryStrategy.java | 77 + .../tablestore}/model/BatchGetRowRequest.java | 29 +- .../model/BatchGetRowResponse.java} | 100 +- .../model/BatchWriteRowRequest.java | 105 + .../model/BatchWriteRowResponse.java | 198 + .../tablestore/model/CapacityUnit.java | 172 + .../openservices/tablestore/model/Column.java | 157 + .../tablestore/model/ColumnType.java | 32 + .../tablestore/model/ColumnValue.java | 371 + .../model/CommitTransactionRequest.java | 40 + .../model/CommitTransactionResponse.java | 9 + .../model/ComputeSplitsBySizeRequest.java | 89 + .../model/ComputeSplitsBySizeResponse.java | 228 + .../tablestore}/model/Condition.java | 15 +- .../tablestore/model/ConsumedCapacity.java | 38 + .../tablestore/model/CreateIndexRequest.java | 88 + .../tablestore/model/CreateIndexResponse.java | 11 + .../tablestore/model/CreateTableRequest.java | 201 + .../tablestore/model/CreateTableResponse.java | 11 + .../model/DefaultRetryStrategy.java | 152 + .../tablestore/model/DefinedColumnSchema.java | 84 + .../tablestore/model/DefinedColumnType.java | 31 + .../tablestore/model/DeleteIndexRequest.java | 53 + .../tablestore/model/DeleteIndexResponse.java | 8 + .../tablestore/model/DeleteRowRequest.java | 41 + .../tablestore/model/DeleteRowResponse.java | 52 + .../tablestore/model/DeleteTableRequest.java | 34 + .../tablestore/model/DeleteTableResponse.java | 8 + .../model/DescribeStreamRequest.java | 102 + .../model/DescribeStreamResponse.java | 134 + .../model/DescribeTableRequest.java | 16 +- .../model/DescribeTableResponse.java | 166 + .../tablestore/model/Direction.java | 13 + .../openservices/tablestore}/model/Error.java | 7 +- .../tablestore}/model/GetRangeRequest.java | 12 +- .../tablestore/model/GetRangeResponse.java | 87 + .../model/GetRowColumnIteratorImpl.java | 84 + .../tablestore}/model/GetRowRequest.java | 24 +- .../tablestore/model/GetRowResponse.java | 67 + .../model/GetShardIteratorRequest.java | 61 + .../model/GetShardIteratorResponse.java | 30 + .../model/GetStreamRecordRequest.java | 66 + .../model/GetStreamRecordResponse.java | 49 + .../openservices/tablestore/model/IRow.java | 5 + .../tablestore/model/IndexMeta.java | 215 + .../tablestore/model/IndexType.java | 11 + .../tablestore/model/IndexUpdateMode.java | 11 + .../tablestore/model/ListStreamRequest.java | 48 + .../tablestore/model/ListStreamResponse.java | 30 + .../tablestore/model/ListTableRequest.java | 11 + .../tablestore/model/ListTableResponse.java | 57 + .../tablestore/model/Measurable.java | 10 + .../model/MultiRowQueryCriteria.java | 126 + .../model/NameTimestampComparator.java | 31 + .../tablestore/model/OperationNames.java | 77 + .../tablestore/model/PartitionRange.java | 57 + .../tablestore/model/PrimaryKey.java | 265 + .../tablestore/model/PrimaryKeyBuilder.java | 44 + .../tablestore/model/PrimaryKeyColumn.java | 169 + .../tablestore/model/PrimaryKeyOption.java | 11 + .../tablestore/model/PrimaryKeySchema.java | 114 + .../tablestore/model/PrimaryKeyType.java | 21 + .../tablestore/model/PrimaryKeyValue.java | 402 + .../tablestore}/model/PutRowRequest.java | 16 +- .../tablestore/model/PutRowResponse.java | 51 + .../model/RangeIteratorParameter.java | 98 +- .../model/RangeRowQueryCriteria.java | 59 +- .../tablestore/model/RecordColumn.java | 93 + .../tablestore/model/RecordSequenceInfo.java | 93 + .../tablestore/model/Request.java | 5 + .../tablestore/model/ReservedThroughput.java | 64 + .../model/ReservedThroughputDetails.java | 62 +- .../tablestore/model/Response.java | 70 + .../tablestore/model/RetryStrategy.java | 28 + .../tablestore/model/ReturnType.java | 21 + .../openservices/tablestore/model/Row.java | 223 + .../tablestore/model/RowChange.java | 147 + .../tablestore/model/RowDeleteChange.java | 28 + .../model/RowExistenceExpectation.java | 25 + .../tablestore}/model/RowIterator.java | 53 +- .../tablestore/model/RowPutChange.java | 233 + .../tablestore/model/RowQueryCriteria.java | 344 + .../model/RowRangeColumnIteratorImpl.java | 84 + .../tablestore/model/RowUpdateChange.java | 203 + .../model/SingleRowQueryCriteria.java | 79 + .../openservices/tablestore/model/Split.java | 88 + .../model/StartLocalTransactionRequest.java | 68 + .../model/StartLocalTransactionResponse.java | 52 + .../openservices/tablestore/model/Stream.java | 108 + .../tablestore/model/StreamDetails.java | 131 + .../tablestore/model/StreamRecord.java | 117 + .../tablestore/model/StreamShard.java | 101 + .../tablestore/model/StreamSpecification.java | 123 + .../tablestore/model/StreamStatus.java | 9 + .../tablestore/model/TableMeta.java | 340 + .../tablestore/model/TableOptions.java | 220 + .../tablestore/model/TimeRange.java | 119 + .../tablestore/model/TxnRequest.java | 42 + .../tablestore}/model/UpdateRowRequest.java | 15 +- .../tablestore/model/UpdateRowResponse.java | 50 + .../tablestore/model/UpdateTableRequest.java | 118 + .../tablestore/model/UpdateTableResponse.java | 91 + .../tablestore/model/WideColumnIterator.java | 30 + .../tablestore/model/WideRowIterator.java | 116 + .../model/condition/ColumnCondition.java | 17 + .../model/condition/ColumnConditionType.java | 6 + .../CompositeColumnValueCondition.java | 112 + .../condition/SingleColumnValueCondition.java | 198 + .../model/filter/ColumnPaginationFilter.java | 46 + .../model/filter/ColumnValueFilter.java | 5 + .../filter/CompositeColumnValueFilter.java | 111 + .../tablestore/model/filter/Filter.java | 13 + .../tablestore/model/filter/FilterType.java | 7 + .../model/filter/SingleColumnValueFilter.java | 199 + .../tablestore/model/search/Collapse.java | 20 + .../search/CreateSearchIndexRequest.java | 58 + .../search/CreateSearchIndexResponse.java | 10 + .../search/DeleteSearchIndexRequest.java | 31 + .../search/DeleteSearchIndexResponse.java | 10 + .../search/DescribeSearchIndexRequest.java | 31 + .../search/DescribeSearchIndexResponse.java | 68 + .../tablestore/model/search/FieldSchema.java | 238 + .../tablestore/model/search/FieldType.java | 20 + .../tablestore/model/search/GeoPoint.java | 31 + .../tablestore/model/search/IndexOptions.java | 11 + .../tablestore/model/search/IndexSchema.java | 91 + .../tablestore/model/search/IndexSetting.java | 68 + .../model/search/ListSearchIndexRequest.java | 25 + .../model/search/ListSearchIndexResponse.java | 24 + .../tablestore/model/search/MeteringInfo.java | 58 + .../model/search/SearchIndexInfo.java | 28 + .../tablestore/model/search/SearchQuery.java | 103 + .../model/search/SearchRequest.java | 110 + .../model/search/SearchResponse.java | 66 + .../tablestore/model/search/SyncStat.java | 57 + .../model/search/query/BoolQuery.java | 88 + .../model/search/query/ConstScoreQuery.java | 31 + .../model/search/query/FieldValueFactor.java | 22 + .../search/query/FunctionScoreQuery.java | 48 + .../search/query/GeoBoundingBoxQuery.java | 58 + .../model/search/query/GeoDistanceQuery.java | 60 + .../model/search/query/GeoPolygonQuery.java | 49 + .../model/search/query/MatchAllQuery.java | 20 + .../model/search/query/MatchPhraseQuery.java | 39 + .../model/search/query/MatchQuery.java | 73 + .../model/search/query/NestedQuery.java | 58 + .../model/search/query/PrefixQuery.java | 42 + .../tablestore/model/search/query/Query.java | 14 + .../model/search/query/QueryOperator.java | 6 + .../model/search/query/QueryType.java | 23 + .../model/search/query/RangeQuery.java | 108 + .../model/search/query/ScoreMode.java | 13 + .../model/search/query/TermQuery.java | 40 + .../model/search/query/TermsQuery.java | 51 + .../model/search/query/WildcardQuery.java | 40 + .../model/search/sort/FieldSort.java | 50 + .../model/search/sort/GeoDistanceSort.java | 87 + .../model/search/sort/GeoDistanceType.java | 15 + .../model/search/sort/NestedFilter.java | 33 + .../model/search/sort/PrimaryKeySort.java | 21 + .../model/search/sort/ScoreSort.java | 14 + .../tablestore/model/search/sort/Sort.java | 26 + .../model/search/sort/SortMode.java | 12 + .../model/search/sort/SortOrder.java | 9 + .../tablestore/model/tunnel/ChannelInfo.java | 145 + .../model/tunnel/ChannelStatus.java | 24 + .../tablestore/model/tunnel/ChannelType.java | 12 + .../model/tunnel/CreateTunnelRequest.java | 104 + .../model/tunnel/CreateTunnelResponse.java | 33 + .../model/tunnel/DeleteTunnelRequest.java | 76 + .../model/tunnel/DeleteTunnelResponse.java | 12 + .../model/tunnel/DescribeTunnelRequest.java | 71 + .../model/tunnel/DescribeTunnelResponse.java | 96 + .../model/tunnel/ListTunnelRequest.java | 46 + .../model/tunnel/ListTunnelResponse.java | 28 + .../tablestore/model/tunnel/TunnelInfo.java | 154 + .../tablestore/model/tunnel/TunnelStage.java | 16 + .../tablestore/model/tunnel/TunnelType.java | 21 + .../model/tunnel/internal/Channel.java | 66 + .../tunnel/internal/CheckpointRequest.java | 81 + .../tunnel/internal/CheckpointResponse.java | 9 + .../tunnel/internal/ConnectTunnelRequest.java | 36 + .../internal/ConnectTunnelResponse.java | 19 + .../tunnel/internal/GetCheckpointRequest.java | 54 + .../internal/GetCheckpointResponse.java | 37 + .../tunnel/internal/HeartbeatRequest.java | 48 + .../tunnel/internal/HeartbeatResponse.java | 21 + .../tunnel/internal/ReadRecordsRequest.java | 55 + .../tunnel/internal/ReadRecordsResponse.java | 60 + .../internal/ShutdownTunnelRequest.java | 35 + .../internal/ShutdownTunnelResponse.java | 9 + .../tunnel/pipeline/AbstractStage.java | 45 + .../tablestore/tunnel/pipeline/IBackoff.java | 14 + .../tablestore/tunnel/pipeline/Pipeline.java | 100 + .../tunnel/pipeline/PipelineContext.java | 8 + .../tunnel/pipeline/ProcessDataBackoff.java | 52 + .../tunnel/pipeline/ProcessDataPipeline.java | 163 + .../pipeline/ProcessDataPipelineContext.java | 28 + .../tablestore/tunnel/pipeline/Stage.java | 11 + .../tunnel/pipeline/StageException.java | 23 + .../pipeline/ThreadPoolStageDecorator.java | 39 + .../tablestore/tunnel/pipeline/Utils.java | 45 + .../tunnel/worker/ChannelConnect.java | 253 + .../tunnel/worker/ChannelConnectStatus.java | 20 + .../tunnel/worker/ChannelDialer.java | 69 + .../tunnel/worker/ChannelProcessFactory.java | 21 + .../tunnel/worker/Checkpointer.java | 111 + .../worker/DefaultChannelProcessor.java | 54 + .../tunnel/worker/FailedChannelConnect.java | 63 + .../tunnel/worker/IChannelConnect.java | 22 + .../tunnel/worker/IChannelDialer.java | 7 + .../tunnel/worker/IChannelProcessor.java | 14 + .../worker/IChannelProcessorFactory.java | 5 + .../tunnel/worker/ICheckpointer.java | 5 + .../tunnel/worker/ITunnelWorker.java | 6 + .../tunnel/worker/ProcessRecordsInput.java | 47 + .../tunnel/worker/ReadRecordsPipeResult.java | 68 + .../tunnel/worker/TunnelClientConfig.java | 37 + .../tunnel/worker/TunnelStateMachine.java | 181 + .../tunnel/worker/TunnelWorker.java | 261 + .../tunnel/worker/TunnelWorkerConfig.java | 155 + .../tunnel/worker/TunnelWorkerException.java | 19 + .../tunnel/worker/TunnelWorkerStatus.java | 23 + .../writer/DefaultWriterStatistics.java | 40 + .../tablestore/writer/FlushCallback.java | 223 + .../tablestore}/writer/RowChangeEvent.java | 15 +- .../writer/RowChangeEventHandler.java | 60 +- .../tablestore/writer/RowWriteResult.java | 31 + .../tablestore}/writer/WriteRPCBuffer.java | 33 +- .../tablestore}/writer/WriterConfig.java | 53 +- .../tablestore/writer/WriterStatistics.java | 9 + .../openservices/ots/ClientConfiguration.java | 261 - .../openservices/ots/ClientErrorCode.java | 24 - .../openservices/ots/ClientException.java | 79 - .../openservices/ots/DefaultOTSWriter.java | 198 - .../java/com/aliyun/openservices/ots/OTS.java | 204 - .../openservices/ots/OTSActionNames.java | 27 - .../com/aliyun/openservices/ots/OTSAsync.java | 374 - .../aliyun/openservices/ots/OTSClient.java | 487 - .../openservices/ots/OTSClientAsync.java | 661 - .../aliyun/openservices/ots/OTSErrorCode.java | 107 - .../aliyun/openservices/ots/OTSException.java | 69 - .../ots/OTSServiceConfiguration.java | 135 - .../aliyun/openservices/ots/OTSWriter.java | 112 - .../ots/PartialResultFailedException.java | 36 - .../openservices/ots/ServiceException.java | 119 - .../ots/auth/HmacSHA1Signature.java | 77 - .../openservices/ots/auth/RequestSigner.java | 10 - .../ots/auth/ServiceCredentials.java | 103 - .../ots/auth/ServiceSignature.java | 39 - .../ots/comm/AsyncClientFutureCallback.java | 94 - .../openservices/ots/comm/RequestHandler.java | 20 - .../ots/comm/ResponseHandler.java | 20 - .../openservices/ots/comm/ServiceClient.java | 58 - .../BatchGetRowAsyncResponseConsumer.java | 91 - .../ots/internal/BatchGetRowCallable.java | 17 - .../internal/BatchGetRowExecutionContext.java | 34 - .../BatchWriteRowAsyncResponseConsumer.java | 154 - .../ots/internal/BatchWriteRowCallable.java | 17 - .../BatchWriteRowExecutionContext.java | 36 - .../CreateTableAsyncResponseConsumer.java | 26 - .../ots/internal/CreateTableCallable.java | 22 - .../DeleteRowAsyncResponseConsumer.java | 26 - .../ots/internal/DeleteRowCallable.java | 21 - .../DeleteTableAsyncResponseConsumer.java | 26 - .../ots/internal/DeleteTableCallable.java | 22 - .../DescribeTableAsyncResponseConsumer.java | 27 - .../ots/internal/DescribeTableCallable.java | 22 - .../GetRangeAsyncResponseConsumer.java | 26 - .../ots/internal/GetRangeCallable.java | 21 - .../internal/GetRowAsyncResponseConsumer.java | 27 - .../ots/internal/GetRowCallable.java | 21 - .../ListTableAsyncResponseConsumer.java | 25 - .../ots/internal/ListTableCallable.java | 22 - .../ots/internal/OTSAlwaysRetryStrategy.java | 68 - .../ots/internal/OTSAsyncDataOperation.java | 168 - .../ots/internal/OTSAsyncTableOperation.java | 121 - .../ots/internal/OTSCallable.java | 7 - .../ots/internal/OTSCallback.java | 28 - .../openservices/ots/internal/OTSConsts.java | 24 - .../OTSContentMD5ResponseHandler.java | 70 - .../ots/internal/OTSDefaultRetryStrategy.java | 141 - .../internal/OTSDeflateResponseHandler.java | 60 - .../ots/internal/OTSErrorResponseHandler.java | 77 - .../ots/internal/OTSExceptionFactory.java | 32 - .../ots/internal/OTSExecutionContext.java | 78 - .../ots/internal/OTSLoggerConstant.java | 24 - .../ots/internal/OTSOperation.java | 171 - .../ots/internal/OTSRequestSigner.java | 78 - .../ots/internal/OTSResultParserFactory.java | 18 - .../ots/internal/OTSRetryStrategy.java | 24 - .../ots/internal/OTSTraceLogger.java | 88 - .../openservices/ots/internal/OTSUtil.java | 127 - .../OTSValidationResponseHandler.java | 113 - .../internal/PutRowAsyncResponseConsumer.java | 26 - .../ots/internal/PutRowCallable.java | 21 - .../UpdateRowAsyncResponseConsumer.java | 26 - .../ots/internal/UpdateRowCallable.java | 21 - .../UpdateTableAsyncResponseConsumer.java | 26 - .../ots/internal/UpdateTableCallable.java | 22 - .../ots/internal/writer/FlushCallback.java | 260 - .../aliyun/openservices/ots/log/LogUtil.java | 73 - .../ots/model/BatchWriteRowRequest.java | 240 - .../ots/model/BatchWriteRowResult.java | 297 - .../openservices/ots/model/CapacityUnit.java | 77 - .../openservices/ots/model/ColumnType.java | 51 - .../openservices/ots/model/ColumnValue.java | 257 - .../ots/model/ConsumedCapacity.java | 27 - .../ots/model/CreateTableRequest.java | 66 - .../ots/model/CreateTableResult.java | 12 - .../ots/model/DeleteRowRequest.java | 36 - .../ots/model/DeleteRowResult.java | 17 - .../ots/model/DeleteTableRequest.java | 32 - .../ots/model/DeleteTableResult.java | 12 - .../ots/model/DescribeTableResult.java | 41 - .../openservices/ots/model/Direction.java | 23 - .../ots/model/GetRangeResult.java | 61 - .../openservices/ots/model/GetRowResult.java | 41 - .../ots/model/ListTableRequest.java | 5 - .../ots/model/ListTableResult.java | 29 - .../ots/model/MultiRowQueryCriteria.java | 86 - .../ots/model/OTSBasicFuture.java | 112 - .../openservices/ots/model/OTSContext.java | 27 - .../openservices/ots/model/OTSFuture.java | 23 - .../ots/model/OTSFutureCallback.java | 9 - .../ots/model/OTSProtocolHelper.java | 775 - .../openservices/ots/model/OTSResult.java | 34 - .../ots/model/OTSResultFactory.java | 162 - .../ots/model/PrimaryKeyType.java | 41 - .../ots/model/PrimaryKeyValue.java | 249 - .../openservices/ots/model/PutRowResult.java | 24 - .../openservices/ots/model/RecordColumn.java | 88 - .../ots/model/ReservedThroughput.java | 34 - .../ots/model/ReservedThroughputChange.java | 94 - .../aliyun/openservices/ots/model/Row.java | 68 - .../openservices/ots/model/RowChange.java | 86 - .../ots/model/RowDeleteChange.java | 20 - .../ots/model/RowExistenceExpectation.java | 29 - .../openservices/ots/model/RowPrimaryKey.java | 108 - .../openservices/ots/model/RowPutChange.java | 64 - .../ots/model/RowQueryCriteria.java | 116 - .../ots/model/RowUpdateChange.java | 74 - .../ots/model/SingleRowQueryCriteria.java | 33 - .../openservices/ots/model/TableMeta.java | 99 - .../ots/model/UpdateRowResult.java | 29 - .../ots/model/UpdateTableRequest.java | 63 - .../ots/model/UpdateTableResult.java | 28 - .../ots/model/condition/ColumnCondition.java | 17 - .../condition/ColumnConditionBuilder.java | 83 - .../model/condition/ColumnConditionType.java | 6 - .../model/condition/CompositeCondition.java | 52 - .../model/condition/RelationalCondition.java | 116 - .../ots/protocol/OtsProtocol2.java | 33333 ------------ .../ots/protocol/ots_protocol.2.proto | 319 - .../ots/utils/CalculateHelper.java | 146 - .../ots/utils/ClientConfigurationUtil.java | 20 - .../openservices/ots/utils/CodingUtils.java | 41 - .../openservices/ots/utils/HttpHeaders.java | 24 - .../openservices/ots/utils/ParamChecker.java | 88 - .../ots/utils/ResourceManager.java | 33 - .../ots/utils/ServiceConstants.java | 8 - .../ots/utils/VersionInfoUtils.java | 50 - src/main/resources/log4j2.xml | 10 +- .../{ots.properties => tablestore.properties} | 2 +- ...properties => tablestore_zh_CN.properties} | 2 +- src/main/resources/versioninfo.properties | 2 +- .../tablestore/common/BaseFT.java | 133 + .../tablestore/common/OTSHelper.java | 543 + .../common/OTSRestrictedItemConst.java | 18 + .../tablestore/common/OTSRowBuilder.java | 48 + .../tablestore/common/OTSTableBuilder.java | 31 + .../tablestore/common/OTSTestConst.java | 13 + .../tablestore/common}/ServiceSettings.java | 21 +- .../openservices/tablestore/common/Table.java | 65 + .../tablestore/common/TestUtil.java | 155 + .../openservices/tablestore/common/Utils.java | 122 + .../core/TestAsyncBatchGetRowCompletion.java | 246 + .../core/TestAsyncGetRangeCompletion.java | 169 + .../core/TestAsyncGetRowCompletion.java | 146 + .../tablestore/core/auth/TestCredentials.java | 178 + ...estInstanceProfileCredentialsProvider.java | 162 + .../core/auth/TestServiceSigner.java} | 38 +- .../tablestore/core/http/TestOTSUri.java | 38 + .../core/protocol/TestPlainBufferCrc8.java | 26 + .../protocol/TestPlainBufferInputStream.java | 223 + .../protocol/TestPlainBufferOutputStream.java | 100 + .../core/utils/ParamCheckerTest.java | 266 + .../tablestore/functiontest/APITest.java | 459 + .../functiontest/DataOperationTest.java | 471 + .../functiontest/IncrementRequest.java | 1147 + .../tablestore/functiontest/LocalTxnTest.java | 489 + .../functiontest/OTSAPIBehaviorTest.java | 884 + .../functiontest/OTSBasicCompaFourTest.java | 778 + .../functiontest/ParameterLegalityTest.java | 1056 + .../functiontest/RestrictedItemTest.java | 4761 ++ .../functiontest/TestComputeSplitsBySize.java | 302 + .../tablestore/model/BatchWriteTest.java | 92 + .../tablestore/model/CapacityUnitTest.java | 949 + .../tablestore/model/CreateTableTest.java | 200 + .../tablestore/model/DeleteRowTest.java | 214 + .../tablestore/model/GetRowTest.java | 110 + .../tablestore/model/PutRowTest.java | 264 + .../model/TestBatchGetRowRequest.java | 201 + .../model/TestBatchGetRowResponse.java | 187 + .../model/TestBatchWriteRowRequest.java | 187 + .../model/TestBatchWriteRowResponse.java | 170 + .../tablestore/model/TestCapacityUnit.java | 166 + .../tablestore/model/TestColumn.java | 125 + .../tablestore/model/TestColumnValue.java} | 75 +- .../model/TestComputeSplitsBySizeRequest.java | 41 + .../TestComputeSplitsBySizeResponse.java | 150 + .../model/TestCreateTableRequest.java | 58 + .../model/TestDefaultRetryStrategy.java | 194 + .../model/TestDeleteRowRequest.java | 20 + .../model/TestDeleteTableRequest.java | 25 + .../model/TestDescribeTableRequest.java | 25 + .../tablestore/model/TestGetRangeRequest.java | 19 + .../tablestore/model/TestGetRowRequest.java | 19 + .../model/TestMultiRowQueryCriteria.java | 122 + .../model/TestNameTimestampComparator.java | 88 + .../tablestore/model/TestPartitionRange.java | 25 + .../tablestore/model/TestPrimaryKey.java | 179 + .../model/TestPrimaryKeyColumn.java | 109 + .../model/TestPrimaryKeySchema.java | 153 + .../model/TestPrimaryKeyValue.java} | 117 +- .../model/TestReservedThroughput.java | 29 + .../tablestore/model/TestRow.java | 220 + .../tablestore/model/TestRowDeleteChange.java | 77 + .../tablestore/model/TestRowPutChange.java | 206 + .../model/TestRowQueryCriteria.java | 170 + .../tablestore/model/TestRowUpdateChange.java | 145 + .../model/TestSingleRowQueryCriteria.java | 55 + .../tablestore/model/TestSplit.java | 64 + .../tablestore/model/TestTableMeta.java | 372 + .../tablestore/model/TestTimeRange.java | 77 + .../model/UnifiedConditionalUpdateTest.java | 552 + .../model/UnifiedFilterAdvanceTest.java} | 380 +- ...FilterRestrictionAndParamCheckingTest.java | 1572 + .../tablestore/model/UpdateRowTest.java | 252 + .../model/filter/TestCompositeFilter.java | 37 + .../filter/TestSingleColumnValueFilter.java | 92 + .../tablestore/smoketest/SmokeTest.java | 250 + .../tunnel/functiontest/TestTunnel.java | 113 + .../functiontest/TestTunnelLiveTail.java | 242 + .../tunnel/functiontest/TestTunnelWorker.java | 61 + .../TestTunnelWorkerReconnect.java | 172 + .../TestTunnelWorkerSimplePerf.java | 74 + .../unittest/MockBadChannelProcessor.java | 22 + .../tunnel/unittest/MockChannelDialer.java | 19 + .../tunnel/unittest/MockChannelProcessor.java | 21 + .../unittest/MockChannelProcessorFactory.java | 19 + .../tunnel/unittest/MockTunnelClient.java | 127 + .../tunnel/unittest/TestChannelConnect.java | 359 + .../unittest/TestFailedChannelConnect.java | 149 + .../unittest/TestTunnelStateMachine.java | 231 + .../tablestore}/writer/MultiPMultiC.java | 4 +- .../tablestore}/writer/OnePOneC.java | 7 +- .../tablestore}/writer/RingBufferPerf.java | 7 +- .../tablestore/writer/TestWriter.java | 556 + .../tablestore}/writer/TestWriterPerf.java | 146 +- .../openservices/ots/OTSCompressUtilTest.java | 37 - .../openservices/ots/common/BaseFT.java | 93 - .../openservices/ots/common/OTSHelper.java | 206 - .../aliyun/openservices/ots/common/Utils.java | 12 - .../integration/ConditionalUpdateTest.java | 467 - ...FilterRestrictionAndParamCheckingTest.java | 1446 - .../ots/integration/OTSClientFactory.java | 98 - .../ots/integration/OTSClientTest.java | 1542 - .../ots/integration/OTSRetryStrategyTest.java | 132 - .../ots/integration/RelationFilterTest.java | 2702 - .../ots/internal/BatchOpRetryTest.java | 235 - .../ots/model/CapacityChangeTest.java | 39 - .../ots/model/OTSProtocolHelperTest.java | 195 - .../ots/model/PrimaryKeyTest.java | 60 - .../openservices/ots/model/RowChangeTest.java | 59 - .../ots/model/RowQueryCriteriaTest.java | 68 - .../openservices/ots/model/TableMetaTest.java | 29 - .../ots/utils/BinaryFunction.java | 5 - .../ots/utils/DateUtilUnittest.java | 32 - .../ots/utils/ResourceManagerTest.java | 35 - .../openservices/ots/utils/StreamUtils.java | 54 - .../openservices/ots/utils/TestUtil.java | 89 - .../openservices/ots/writer/TestWriter.java | 391 - .../{OTSAsyncSample.java => AsyncSample.java} | 587 +- .../examples/CallRecordsUsingGlobalIndex.java | 381 + .../examples/ComputeSplitsBySizeSample.java | 166 + .../java/examples/DataOperationSample.java | 416 + src/test/java/examples/GlobalIndexSample.java | 293 + src/test/java/examples/GlobalUniqueID.java | 110 + .../java/examples/LocalTransactionSample.java | 99 + .../examples/OTSConditionalUpdateSample.java | 230 - src/test/java/examples/OTSFilterSample.java | 188 - .../java/examples/OTSMultiDataSample.java | 265 - .../OTSMultiTableOperationSample.java | 275 - .../examples/OTSPaginationReadSample.java | 197 - .../java/examples/OTSSingleDataSample.java | 223 - .../examples/OTSTableOperationSample.java | 149 - src/test/java/examples/OTSWriterSample.java | 226 - src/test/java/examples/PkAutoIncrSample.java | 360 + src/test/java/examples/SearchIndexSample.java | 576 + .../java/examples/TableOperationSample.java | 113 + src/test/java/examples/TunnelQuickStart.java | 63 + src/test/resources/conf.properties | 1 + src/test/resources/log4j2.xml | 76 +- src/test/resources/tunnel.config | 4 + 699 files changed, 154541 insertions(+), 55587 deletions(-) mode change 100644 => 100755 pom.xml create mode 100644 src/main/java/com/alicloud/openservices/tablestore/AsyncClient.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/AsyncClientInterface.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/ClientConfiguration.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/ClientException.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/DefaultTableStoreWriter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/InternalClient.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/PartialResultFailedException.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/PrepareCallback.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/SyncClient.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/SyncClientInterface.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/TableStoreCallback.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/TableStoreException.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/TableStoreWriter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/TunnelClient.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/TunnelClientInterface.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/AbortTransactionLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/AbstractWatchableCallback.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/AsyncBatchGetRowCompletion.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/AsyncCompletion.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRangeCompletion.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRowCompletion.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/BatchGetRowLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/BatchWriteRowLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/CallbackImpledFuture.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/CheckpointLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/CommitTransactionLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ComputeSplitsBySizeLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ConnectTunnelLauncher.java rename src/main/java/com/{aliyun/openservices/ots/internal/OTSHTTPConstant.java => alicloud/openservices/tablestore/core/Constants.java} (70%) mode change 100755 => 100644 create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/CreateIndexLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/CreateSearchIndexLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/CreateTableLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/CreateTunnelLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DeleteIndexLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DeleteRowLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DeleteSearchIndexLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DeleteTableLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DeleteTunnelLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DescribeSearchIndexLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DescribeStreamLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DescribeTableLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/DescribeTunnelLauncher.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/ErrorCode.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/GetCheckpointLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/GetRangeLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/GetRowLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/GetShardIteratorLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/GetStreamRecordLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/HeartbeatLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/LauncherFactory.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ListSearchIndexLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ListStreamLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ListTableLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ListTunnelLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/OperationLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/PutRowLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ReadRecordsLauncher.java rename src/main/java/com/{aliyun/openservices/ots/internal/model => alicloud/openservices/tablestore/core}/ResponseContentWithMeta.java (57%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/SearchLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/ShutdownTunnelLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/StartLocalTransactionLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/TraceLogger.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/UpdateRowLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/UpdateTableLauncher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/WatchableCallback.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/AuthUtils.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/BasicCredentials.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsFetcher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProvider.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProviderFactory.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentialProvider.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentials.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/EnvironmentVariableCredentialsProvider.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/auth/HmacSHA1Signature.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/HttpCredentialsFetcher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentials.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsFetcher.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsProvider.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/InvalidCredentialsException.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSigner.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSignerInterface.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceCredentials.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceSignature.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/auth/SystemPropertiesCredentialsProvider.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/AbortTransactionResponseConsumer.java rename src/main/java/com/{aliyun/openservices/ots/comm => alicloud/openservices/tablestore/core/http}/AsyncServiceClient.java (54%) mode change 100755 => 100644 create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/BatchGetRowResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/BatchWriteRowResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/CheckpointResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/CommitTransactionResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/ComputeSplitsBySizeResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/ConnectTunnelResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/ContentMD5ResponseHandler.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/CreateIndexResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/CreateSearchIndexResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTableResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTunnelResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteIndexResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteRowResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteSearchIndexResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTableResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTunnelResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeSearchIndexResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeStreamResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTableResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTunnelResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/ErrorResponseHandler.java rename src/main/java/com/{aliyun/openservices/ots/comm => alicloud/openservices/tablestore/core/http}/ExecutionContext.java (69%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/GetCheckpointResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/GetRangeResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/GetRowResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/GetShardIteratorResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/GetStreamRecordResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/HeartbeatResponseConsumer.java rename src/main/java/com/{aliyun/openservices/ots/comm => alicloud/openservices/tablestore/core/http}/HttpFactory.java (77%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/ListSearchIndexResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/ListStreamResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/ListTableResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/ListTunnelResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/OTSDeflateResponseHandler.java rename src/main/java/com/{aliyun/openservices/ots/comm => alicloud/openservices/tablestore/core/http}/OTSUri.java (95%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/OTSValidationResponseHandler.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/PutRowResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/ReadRecordsResponseConsumer.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/RequestHandler.java rename src/main/java/com/{aliyun/openservices/ots/comm => alicloud/openservices/tablestore/core/http}/RequestMessage.java (57%) mode change 100755 => 100644 rename src/main/java/com/{aliyun/openservices/ots/internal/OTSAsyncResponseConsumer.java => alicloud/openservices/tablestore/core/http/ResponseConsumer.java} (57%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseHandler.java rename src/main/java/com/{aliyun/openservices/ots/comm => alicloud/openservices/tablestore/core/http}/ResponseMessage.java (91%) mode change 100755 => 100644 create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/SearchResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/ShutdownTunnelResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/StartLocalTransactionResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateRowResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateTableResponseConsumer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolBuilder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolParser.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsFilter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsInternalApi.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferBuilder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCell.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedInputStream.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedOutputStream.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConsts.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConversion.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCrc8.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferExtension.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferInputStream.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferOutputStream.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferRow.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferSequenceInfo.java rename src/main/java/com/{aliyun/openservices/ots/internal => alicloud/openservices/tablestore/core/protocol}/ProtocolBufferParser.java (55%) mode change 100755 => 100644 create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResponseFactory.java rename src/main/java/com/{aliyun/openservices/ots/parser => alicloud/openservices/tablestore/core/protocol}/ResultParseException.java (86%) rename src/main/java/com/{aliyun/openservices/ots/parser => alicloud/openservices/tablestore/core/protocol}/ResultParser.java (66%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParserFactory.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/Search.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolBuilder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolParser.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchQueryBuilder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchSortBuilder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchVariantType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelProtocolBuilder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelServiceApi.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_filter.proto create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_internal_api.proto create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/search.proto create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/protocol/tunnel_service_api.proto create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/Base64.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore/core}/utils/BinaryUtil.java (71%) rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore/core}/utils/Bytes.java (98%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/CalculateHelper.java rename src/main/java/com/{aliyun/openservices/ots/internal/OTSCompressUtil.java => alicloud/openservices/tablestore/core/utils/CompressUtil.java} (94%) rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore/core}/utils/DateUtil.java (92%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/FormatType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpResponse.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore/core}/utils/HttpUtil.java (84%) rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore/core}/utils/IOUtils.java (91%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/IniEditor.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/Jsonizable.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/LogUtil.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/MethodType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/Objects.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/OptionalValue.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore/core}/utils/Pair.java (97%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/ParamChecker.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore/core}/utils/Preconditions.java (82%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/core/utils/StringUtils.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/AbstractColumnIteratorImpl.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/AlwaysRetryStrategy.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/BatchGetRowRequest.java (80%) rename src/main/java/com/{aliyun/openservices/ots/model/BatchGetRowResult.java => alicloud/openservices/tablestore/model/BatchGetRowResponse.java} (52%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowResponse.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/CapacityUnit.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/Column.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/ColumnType.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/ColumnValue.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeResponse.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/Condition.java (63%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/ConsumedCapacity.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexResponse.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/CreateTableRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/CreateTableResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/DefaultRetryStrategy.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnSchema.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnType.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexResponse.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowResponse.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamResponse.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/DescribeTableRequest.java (59%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/DescribeTableResponse.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/Direction.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/Error.java (74%) rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/GetRangeRequest.java (67%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/GetRangeResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/GetRowColumnIteratorImpl.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/GetRowRequest.java (65%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/GetRowResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordResponse.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/IRow.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/IndexMeta.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/IndexType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/IndexUpdateMode.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/ListStreamRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/ListStreamResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/ListTableRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/ListTableResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/Measurable.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/MultiRowQueryCriteria.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/NameTimestampComparator.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/OperationNames.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/PartitionRange.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKey.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyBuilder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyColumn.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyOption.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeySchema.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyType.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyValue.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/PutRowRequest.java (60%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/PutRowResponse.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/RangeIteratorParameter.java (54%) rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/RangeRowQueryCriteria.java (57%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/RecordColumn.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/RecordSequenceInfo.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/Request.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/ReservedThroughput.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/ReservedThroughputDetails.java (59%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/Response.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/RetryStrategy.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/ReturnType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/Row.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/RowChange.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/RowDeleteChange.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/RowExistenceExpectation.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/RowIterator.java (69%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/RowPutChange.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/RowQueryCriteria.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/RowRangeColumnIteratorImpl.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/RowUpdateChange.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/SingleRowQueryCriteria.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/Split.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/Stream.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/StreamDetails.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/StreamRecord.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/StreamShard.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/StreamSpecification.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/StreamStatus.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/TableMeta.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/TableOptions.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/TimeRange.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/TxnRequest.java rename src/main/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/model/UpdateRowRequest.java (58%) create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/UpdateRowResponse.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableRequest.java create mode 100755 src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/WideColumnIterator.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/WideRowIterator.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnCondition.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnConditionType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/condition/CompositeColumnValueCondition.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/condition/SingleColumnValueCondition.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnPaginationFilter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnValueFilter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/filter/CompositeColumnValueFilter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/filter/Filter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/filter/FilterType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/filter/SingleColumnValueFilter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/Collapse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/FieldSchema.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/FieldType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/GeoPoint.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/IndexOptions.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSchema.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSetting.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/MeteringInfo.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/SearchIndexInfo.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/SearchQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/SearchRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/SearchResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/SyncStat.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/BoolQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/ConstScoreQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/FieldValueFactor.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/FunctionScoreQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoBoundingBoxQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoDistanceQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoPolygonQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchAllQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchPhraseQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/NestedQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/PrefixQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/Query.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryOperator.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/RangeQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/ScoreMode.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermsQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/query/WildcardQuery.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/FieldSort.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceSort.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/NestedFilter.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/PrimaryKeySort.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/ScoreSort.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/Sort.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortMode.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortOrder.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelInfo.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelStatus.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelInfo.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelStage.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelType.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/Channel.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelRequest.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelResponse.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/AbstractStage.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/IBackoff.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Pipeline.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/PipelineContext.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataBackoff.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipeline.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipelineContext.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Stage.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/StageException.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ThreadPoolStageDecorator.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Utils.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnect.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnectStatus.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelDialer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelProcessFactory.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/Checkpointer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/DefaultChannelProcessor.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/FailedChannelConnect.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelConnect.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelDialer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessor.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessorFactory.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ICheckpointer.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ITunnelWorker.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ProcessRecordsInput.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ReadRecordsPipeResult.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelClientConfig.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelStateMachine.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorker.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerConfig.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerException.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerStatus.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/writer/DefaultWriterStatistics.java create mode 100644 src/main/java/com/alicloud/openservices/tablestore/writer/FlushCallback.java rename src/main/java/com/{aliyun/openservices/ots/internal => alicloud/openservices/tablestore}/writer/RowChangeEvent.java (66%) rename src/main/java/com/{aliyun/openservices/ots/internal => alicloud/openservices/tablestore}/writer/RowChangeEventHandler.java (64%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/writer/RowWriteResult.java rename src/main/java/com/{aliyun/openservices/ots/internal => alicloud/openservices/tablestore}/writer/WriteRPCBuffer.java (60%) rename src/main/java/com/{aliyun/openservices/ots/internal => alicloud/openservices/tablestore}/writer/WriterConfig.java (71%) create mode 100644 src/main/java/com/alicloud/openservices/tablestore/writer/WriterStatistics.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/ClientConfiguration.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/ClientErrorCode.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/ClientException.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/DefaultOTSWriter.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/OTS.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/OTSActionNames.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/OTSAsync.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/OTSClient.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/OTSClientAsync.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/OTSErrorCode.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/OTSException.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/OTSServiceConfiguration.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/OTSWriter.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/PartialResultFailedException.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/ServiceException.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/auth/HmacSHA1Signature.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/auth/RequestSigner.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/auth/ServiceCredentials.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/auth/ServiceSignature.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/comm/AsyncClientFutureCallback.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/comm/RequestHandler.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/comm/ResponseHandler.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/comm/ServiceClient.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowCallable.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowExecutionContext.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowCallable.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowExecutionContext.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/CreateTableAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/CreateTableCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/DeleteRowAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/DeleteRowCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/DeleteTableAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/DeleteTableCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/DescribeTableAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/DescribeTableCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/GetRangeAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/GetRangeCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/GetRowAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/GetRowCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/ListTableAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/ListTableCallable.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/OTSAlwaysRetryStrategy.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncDataOperation.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncTableOperation.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/OTSCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSCallback.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSConsts.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSContentMD5ResponseHandler.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/OTSDefaultRetryStrategy.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSDeflateResponseHandler.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSErrorResponseHandler.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSExceptionFactory.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/OTSExecutionContext.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/OTSLoggerConstant.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSOperation.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSRequestSigner.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSResultParserFactory.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/OTSRetryStrategy.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/OTSTraceLogger.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSUtil.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/OTSValidationResponseHandler.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/PutRowAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/PutRowCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/UpdateRowAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/UpdateRowCallable.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/internal/UpdateTableAsyncResponseConsumer.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/UpdateTableCallable.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/internal/writer/FlushCallback.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/log/LogUtil.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowRequest.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/CapacityUnit.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/ColumnType.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/ColumnValue.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/ConsumedCapacity.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/CreateTableRequest.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/CreateTableResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/DeleteRowRequest.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/DeleteRowResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/DeleteTableRequest.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/DeleteTableResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/DescribeTableResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/Direction.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/GetRangeResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/GetRowResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/ListTableRequest.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/ListTableResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/MultiRowQueryCriteria.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/OTSBasicFuture.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/OTSContext.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/OTSFuture.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/OTSFutureCallback.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/OTSProtocolHelper.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/OTSResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/OTSResultFactory.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyType.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyValue.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/PutRowResult.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/RecordColumn.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/ReservedThroughput.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/ReservedThroughputChange.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/Row.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/RowChange.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/RowDeleteChange.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/RowExistenceExpectation.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/RowPrimaryKey.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/RowPutChange.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/RowQueryCriteria.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/RowUpdateChange.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/SingleRowQueryCriteria.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/TableMeta.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/UpdateRowResult.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/UpdateTableRequest.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/model/UpdateTableResult.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/condition/ColumnCondition.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionBuilder.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionType.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/condition/CompositeCondition.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/model/condition/RelationalCondition.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/protocol/OtsProtocol2.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/protocol/ots_protocol.2.proto delete mode 100644 src/main/java/com/aliyun/openservices/ots/utils/CalculateHelper.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/utils/ClientConfigurationUtil.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/utils/CodingUtils.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/utils/HttpHeaders.java delete mode 100644 src/main/java/com/aliyun/openservices/ots/utils/ParamChecker.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/utils/ResourceManager.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/utils/ServiceConstants.java delete mode 100755 src/main/java/com/aliyun/openservices/ots/utils/VersionInfoUtils.java rename src/main/resources/{ots.properties => tablestore.properties} (93%) rename src/main/resources/{ots_zh_CN.properties => tablestore_zh_CN.properties} (92%) create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/BaseFT.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/OTSHelper.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/OTSRestrictedItemConst.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/OTSRowBuilder.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/OTSTableBuilder.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/OTSTestConst.java rename src/test/java/com/{aliyun/openservices/ots/utils => alicloud/openservices/tablestore/common}/ServiceSettings.java (96%) create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/Table.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/TestUtil.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/common/Utils.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncBatchGetRowCompletion.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRangeCompletion.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRowCompletion.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/auth/TestCredentials.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/auth/TestInstanceProfileCredentialsProvider.java rename src/test/java/com/{aliyun/openservices/ots/auth/ServiceSignatureTest.java => alicloud/openservices/tablestore/core/auth/TestServiceSigner.java} (59%) create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/http/TestOTSUri.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferCrc8.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferInputStream.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferOutputStream.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/core/utils/ParamCheckerTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/APITest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/DataOperationTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/IncrementRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/LocalTxnTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSAPIBehaviorTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSBasicCompaFourTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/ParameterLegalityTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/RestrictedItemTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/functiontest/TestComputeSplitsBySize.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/BatchWriteTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/CapacityUnitTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/CreateTableTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/DeleteRowTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/GetRowTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/PutRowTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowResponse.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowResponse.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestCapacityUnit.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestColumn.java rename src/test/java/com/{aliyun/openservices/ots/model/ColumnValueTest.java => alicloud/openservices/tablestore/model/TestColumnValue.java} (77%) create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeResponse.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestCreateTableRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestDefaultRetryStrategy.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteRowRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteTableRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestDescribeTableRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestGetRangeRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestGetRowRequest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestMultiRowQueryCriteria.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestNameTimestampComparator.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestPartitionRange.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKey.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeyColumn.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeySchema.java rename src/test/java/com/{aliyun/openservices/ots/model/PrimaryKeyValueTest.java => alicloud/openservices/tablestore/model/TestPrimaryKeyValue.java} (63%) create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestReservedThroughput.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestRow.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestRowDeleteChange.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestRowPutChange.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestRowQueryCriteria.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestRowUpdateChange.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestSingleRowQueryCriteria.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestSplit.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestTableMeta.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/TestTimeRange.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/UnifiedConditionalUpdateTest.java rename src/test/java/com/{aliyun/openservices/ots/integration/FilterAdvanceTest.java => alicloud/openservices/tablestore/model/UnifiedFilterAdvanceTest.java} (51%) create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/UnifiedFilterRestrictionAndParamCheckingTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/UpdateRowTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/filter/TestCompositeFilter.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/model/filter/TestSingleColumnValueFilter.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/smoketest/SmokeTest.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnel.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelLiveTail.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorker.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerReconnect.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerSimplePerf.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockBadChannelProcessor.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelDialer.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessor.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessorFactory.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockTunnelClient.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestChannelConnect.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestFailedChannelConnect.java create mode 100644 src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestTunnelStateMachine.java rename src/test/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/writer/MultiPMultiC.java (97%) rename src/test/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/writer/OnePOneC.java (95%) rename src/test/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/writer/RingBufferPerf.java (95%) create mode 100644 src/test/java/com/alicloud/openservices/tablestore/writer/TestWriter.java rename src/test/java/com/{aliyun/openservices/ots => alicloud/openservices/tablestore}/writer/TestWriterPerf.java (61%) delete mode 100644 src/test/java/com/aliyun/openservices/ots/OTSCompressUtilTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/common/BaseFT.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/common/OTSHelper.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/common/Utils.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/integration/ConditionalUpdateTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/integration/FilterRestrictionAndParamCheckingTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/integration/OTSClientFactory.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/integration/OTSClientTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/integration/OTSRetryStrategyTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/integration/RelationFilterTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/internal/BatchOpRetryTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/model/CapacityChangeTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/model/OTSProtocolHelperTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/model/PrimaryKeyTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/model/RowChangeTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/model/RowQueryCriteriaTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/model/TableMetaTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/utils/BinaryFunction.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/utils/DateUtilUnittest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/utils/ResourceManagerTest.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/utils/StreamUtils.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/utils/TestUtil.java delete mode 100644 src/test/java/com/aliyun/openservices/ots/writer/TestWriter.java rename src/test/java/examples/{OTSAsyncSample.java => AsyncSample.java} (62%) mode change 100755 => 100644 create mode 100644 src/test/java/examples/CallRecordsUsingGlobalIndex.java create mode 100644 src/test/java/examples/ComputeSplitsBySizeSample.java create mode 100644 src/test/java/examples/DataOperationSample.java create mode 100644 src/test/java/examples/GlobalIndexSample.java create mode 100644 src/test/java/examples/GlobalUniqueID.java create mode 100644 src/test/java/examples/LocalTransactionSample.java delete mode 100755 src/test/java/examples/OTSConditionalUpdateSample.java delete mode 100755 src/test/java/examples/OTSFilterSample.java delete mode 100755 src/test/java/examples/OTSMultiDataSample.java delete mode 100755 src/test/java/examples/OTSMultiTableOperationSample.java delete mode 100755 src/test/java/examples/OTSPaginationReadSample.java delete mode 100755 src/test/java/examples/OTSSingleDataSample.java delete mode 100755 src/test/java/examples/OTSTableOperationSample.java delete mode 100755 src/test/java/examples/OTSWriterSample.java create mode 100644 src/test/java/examples/PkAutoIncrSample.java create mode 100644 src/test/java/examples/SearchIndexSample.java create mode 100644 src/test/java/examples/TableOperationSample.java create mode 100644 src/test/java/examples/TunnelQuickStart.java create mode 100644 src/test/resources/tunnel.config diff --git a/README.md b/README.md index 220b240..3e31d27 100644 --- a/README.md +++ b/README.md @@ -9,19 +9,19 @@ - 阿里云表格存储是阿里云自主研发的NoSQL数据存储服务,提供海量结构化数据的存储和实时访问。 ## 版本 - - 当前版本:2.2.4 + - 当前版本:4.10.0 ## 运行环境 - JDK 6及其以上 ## 安装 #### Maven方式 -下载[最新版JAR包](https://search.maven.org/remote_content?g=com.aliyun.openservices&a=ots-public&v=LATEST)或者通过Maven: +下载[最新版JAR包](https://search.maven.org/remotecontent?filepath=com/aliyun/openservices/tablestore/4.10.0/tablestore-4.10.0.jar)或者通过Maven: ```xml - com.aliyun.openservices - ots-public - 2.2.4 + com.aliyun.openservices + tablestore + 4.10.0 ``` diff --git a/pom.xml b/pom.xml old mode 100644 new mode 100755 index 83e23cb..006234b --- a/pom.xml +++ b/pom.xml @@ -1,232 +1,225 @@ - - 4.0.0 - com.aliyun.openservices - ots-public - 2.2.5 - jar - Aliyun Open Services SDK for Java - http://www.aliyun.com - Aliyun Open Services SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 (C)阿里云计算有限公司 http://www.aliyun.com - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - - - - aliyunproducts - Aliyun SDK - aliyunsdk@aliyun.com - - - - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - - junit - junit - 4.10 - test - - - com.google.protobuf - protobuf-java - 2.4.1 - - - org.apache.httpcomponents - httpasyncclient - 4.0.2 - - - joda-time - joda-time - 2.9.1 - - - org.apache.logging.log4j - log4j-api - 2.0.2 - - - org.apache.logging.log4j - log4j-core - 2.0.2 - - - org.apache.logging.log4j - log4j-slf4j-impl - 2.0.2 - - - com.lmax - disruptor - 3.0.1 - - - - - - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - utf-8 - - - - org.apache.maven.plugins - maven-source-plugin - 2.3 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3.2 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.10 - - -Dfile.encoding=UTF-8 - - - - run-test - test - - test - - - - **/integration/*.java - - - - - - - maven-failsafe-plugin - 2.6 - - -Dfile.encoding=UTF-8 - - - - - integration-test - verify - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8 - - UTF-8 - com.aliyun.common.*;*.internal;*.internal.*;*.impl; - - - author - X - - - - - - package - - jar - - - - - - org.apache.maven.plugins - maven-shade-plugin - 1.4 - - - - commons-logging:commons-logging:jar: - joda-time:joda-time:jar: - org.apache.logging.log4j:log4j-api:jar: - org.apache.logging.log4j:log4j-core:jar: - org.apache.logging.log4j:log4j-slf4j-impl:jar: - org.slf4j:slf4j-api:jar: - - - - - com.google.protobuf - com.aliyun.ots.thirdparty.com.google.protobuf - - - org.apache.http - com.aliyun.ots.thirdparty.org.apache.http - - - jar-with-dependencies - true - - - - package - - shade - - - - - - maven-assembly-plugin - - - src/main/assembly/package.xml - - - - - dwzip - package - - single - - - - - - + + 4.0.0 + com.aliyun.openservices + tablestore + 4.10.0-SNAPSHOT + jar + AliCloud TableStore SDK for Java + http://www.aliyun.com + Aliyun Open Services SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 + (C)阿里云计算有限公司 http://www.aliyun.com + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + java8-doclint-disabled + + [1.8,) + + + -Xdoclint:none + + + + + + junit + junit + 4.10 + test + + + commons-io + commons-io + 2.4 + test + + + com.google.protobuf + protobuf-java + 2.4.1 + + + org.apache.httpcomponents + httpasyncclient + 4.0.2 + + + joda-time + joda-time + 2.9.1 + + + org.apache.logging.log4j + log4j-api + 2.0.2 + + + org.apache.logging.log4j + log4j-core + 2.0.2 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.0.2 + + + com.lmax + disruptor + 3.0.1 + + + com.google.code.gson + gson + 2.8.5 + + + + + + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + UTF-8 + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.2 + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.10 + + -Dfile.encoding=UTF-8 + + + + run-test + test + + test + + + + **/integration/*.java + + + + + + + maven-failsafe-plugin + 2.6 + + -Dfile.encoding=UTF-8 + + + + + integration-test + verify + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + UTF-8 + com.aliyun.common.*;*.internal;*.internal.*;*.impl; + + + author + X + + + + + + package + + jar + + + ${javadoc.opts} + + + + + + org.apache.maven.plugins + maven-shade-plugin + 1.4 + + + + commons-logging:commons-logging:jar: + joda-time:joda-time:jar: + org.apache.logging.log4j:log4j-api:jar: + org.apache.logging.log4j:log4j-core:jar: + org.apache.logging.log4j:log4j-slf4j-impl:jar: + org.slf4j:slf4j-api:jar: + com.lmax:disruptor:jar: + commons-codec:commons-codec:jar: + org.hamcrest:hamcrest-core:jar: + + + + + com.google.protobuf + com.aliyun.ots.thirdparty.com.google.protobuf + + + org.apache.http + com.aliyun.ots.thirdparty.org.apache + + + jar-with-dependencies + true + + + + package + + shade + + + + + + maven-assembly-plugin + + + src/main/assembly/package.xml + + + + + dwzip + package + + single + + + + + + diff --git a/src/main/assembly/package.xml b/src/main/assembly/package.xml index 4e26646..3896a77 100755 --- a/src/main/assembly/package.xml +++ b/src/main/assembly/package.xml @@ -10,7 +10,7 @@ target/ - ots*.jar + tablestore*.jar diff --git a/src/main/java/com/alicloud/openservices/tablestore/AsyncClient.java b/src/main/java/com/alicloud/openservices/tablestore/AsyncClient.java new file mode 100644 index 0000000..2b5d40b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/AsyncClient.java @@ -0,0 +1,324 @@ +package com.alicloud.openservices.tablestore; + +import java.util.Map; +import java.util.concurrent.Future; +import java.util.concurrent.ExecutorService; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.search.*; + +public class AsyncClient implements AsyncClientInterface { + + private InternalClient internalClient; + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + */ + public AsyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, null, null, null); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param stsToken Sts Token. + */ + public AsyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, String stsToken) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, null, null, stsToken); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + */ + public AsyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, + ClientConfiguration config) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, config, null, null); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param stsToken Sts Token. + */ + public AsyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, + ClientConfiguration config, String stsToken) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, config, null, stsToken); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param callbackExecutor 用于执行用户在调用异步接口时传入的Callback。如果传入null则使用默认配置( + * 线程数与CPU核数相同的线程池)。 + */ + public AsyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, + ClientConfiguration config, ExecutorService callbackExecutor) { + internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, config, callbackExecutor); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param callbackExecutor 用于执行用户在调用异步接口时传入的Callback。如果传入null则使用默认配置( + * 线程数与CPU核数相同的线程池)。 + * @param stsToken Sts Token. + */ + public AsyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, + ClientConfiguration config, ExecutorService callbackExecutor, String stsToken) { + internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, config, callbackExecutor, stsToken); + } + + AsyncClient(InternalClient internalClient) { + this.internalClient = internalClient; + } + + public void setExtraHeaders(Map extraHeaders) { + this.internalClient.setExtraHeaders(extraHeaders); + } + + /** + * 返回访问的TableStore Endpoint。 + * + * @return TableStore Endpoint。 + */ + public String getEndpoint() { + return internalClient.getEndpoint(); + } + + /** + * 返回访问的实例的名称 + * + * @return instance name + */ + public String getInstanceName() { + return internalClient.getInstanceName(); + } + + @Override + public Future listTable( + TableStoreCallback callback) + { + return internalClient.listTable(callback); + } + + @Override + public Future createTable( + CreateTableRequest request, + TableStoreCallback callback) + { + return internalClient.createTable(request, callback); + } + + @Override + public Future describeTable( + DescribeTableRequest request, + TableStoreCallback callback) + { + return internalClient.describeTable(request, callback); + } + + @Override + public Future deleteTable( + DeleteTableRequest request, + TableStoreCallback callback) + { + return internalClient.deleteTable(request, callback); + } + + @Override + public Future updateTable( + UpdateTableRequest request, + TableStoreCallback callback) + { + return internalClient.updateTable(request, callback); + } + + @Override + public Future createIndex( + CreateIndexRequest request, + TableStoreCallback callback) + { + return internalClient.createIndex(request, callback); + } + + @Override + public Future deleteIndex( + DeleteIndexRequest request, + TableStoreCallback callback) + { + return internalClient.deleteIndex(request, callback); + } + + @Override + public Future getRow(GetRowRequest request, + TableStoreCallback callback) + { + return internalClient.getRow(request, callback); + } + + @Override + public Future putRow( + PutRowRequest request, + TableStoreCallback callback) + { + return internalClient.putRow(request, callback); + } + + @Override + public Future updateRow( + UpdateRowRequest request, + TableStoreCallback callback) + { + return internalClient.updateRow(request, callback); + } + + @Override + public Future deleteRow( + DeleteRowRequest request, + TableStoreCallback callback) + { + return internalClient.deleteRow(request, callback); + } + + @Override + public Future batchGetRow( + BatchGetRowRequest request, + TableStoreCallback callback) + { + return internalClient.batchGetRowInternal(request, callback); + } + + @Override + public Future batchWriteRow( + BatchWriteRowRequest request, + TableStoreCallback callback) + { + return internalClient.batchWriteRow(request, callback); + } + + @Override + public Future getRange(GetRangeRequest request, + TableStoreCallback callback) + { + return internalClient.getRangeInternal(request, callback); + } + + @Override + public Future computeSplitsBySize( + ComputeSplitsBySizeRequest request, + TableStoreCallback callback) { + return internalClient.computeSplitsBySize(request, callback); + } + + @Override + public Future listStream(ListStreamRequest request, TableStoreCallback callback) { + return internalClient.listStream(request, callback); + } + + @Override + public Future describeStream(DescribeStreamRequest request, TableStoreCallback callback) { + return internalClient.describeStream(request, callback); + } + + @Override + public Future getShardIterator(GetShardIteratorRequest request, TableStoreCallback callback) { + return internalClient.getShardIterator(request, callback); + } + + @Override + public Future getStreamRecord(GetStreamRecordRequest request, TableStoreCallback callback) { + return internalClient.getStreamRecord(request, callback); + } + + @Override + public Future createSearchIndex(CreateSearchIndexRequest request, TableStoreCallback callback) { + return internalClient.createSearchIndex(request, callback); + } + + @Override + public Future listSearchIndex(ListSearchIndexRequest request, TableStoreCallback callback) { + return internalClient.listSearchIndex(request, callback); + } + + @Override + public Future deleteSearchIndex(DeleteSearchIndexRequest request, TableStoreCallback callback) { + return internalClient.deleteSearchIndex(request, callback); + } + + @Override + public Future describeSearchIndex(DescribeSearchIndexRequest request, TableStoreCallback callback) { + return internalClient.describeSearchIndex(request, callback); + } + + @Override + public Future search(SearchRequest request, TableStoreCallback callback) { + return internalClient.search(request, callback); + } + + @Override + public Future startLocalTransaction(StartLocalTransactionRequest request, TableStoreCallback callback) { + return internalClient.startLocalTransaction(request, callback); + } + + @Override + public Future commitTransaction(CommitTransactionRequest request, TableStoreCallback callback) { + return internalClient.commitTransaction(request, callback); + } + + @Override + public Future abortTransaction(AbortTransactionRequest request, TableStoreCallback callback) { + return internalClient.abortTransaction(request, callback); + } + + @Override + public SyncClientInterface asSyncClient() { + return new SyncClient(this.internalClient); + } + + @Override + public void shutdown() { + internalClient.shutdown(); + } + + @Override + public void switchCredentialsProvider(CredentialsProvider newCrdsProvider) { + internalClient.switchCredentialsProvider(newCrdsProvider); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/AsyncClientInterface.java b/src/main/java/com/alicloud/openservices/tablestore/AsyncClientInterface.java new file mode 100755 index 0000000..4d921b1 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/AsyncClientInterface.java @@ -0,0 +1,377 @@ +package com.alicloud.openservices.tablestore; + +import java.util.concurrent.Future; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.search.*; + +public interface AsyncClientInterface { + + /** + * 在用户的实例下创建一张新的表。 + *

表被创建后不能立即进行读写操作, 需要等待几秒钟.

+ * + * @param createTableRequest 执行CreateTable所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future createTable( + CreateTableRequest createTableRequest, + TableStoreCallback callback); + + /** + * 在表被创建之后,动态的更改表的配置或预留吞吐量。 + *

例如用户想要调整表的TTL、MaxVersions等配置或者用户发现当前预留吞吐量过小需要上调预留吞吐量。

+ *

UpdateTable操作不能用于更改表的TableMeta,可以调整的配置为:

+ *
    + *
  • 预留吞吐量({@link ReservedThroughput}): + * 表的预留吞吐量可被动态更改,读或写吞吐量都可以分别单独更改。调整每个表读写吞吐量的最小时间间隔为 1 分钟, + * 如果本次 UpdateTable 操作距上次 UpdateTable 或者 CreateTable 操作不到 1 分钟的话该请求将被拒绝。 + *
  • + *
  • 表的配置({@link TableOptions}): + * 只有表的部分配置项可以允许被动态更改,例如TTL、MaxVersions等。 + *
  • + *
+ * UpdateTable操作执行完毕后,会返回表的当前更改之后的预留吞吐量以及配置。 + * + * @param updateTableRequest 执行UpdateTable所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future updateTable( + UpdateTableRequest updateTableRequest, + TableStoreCallback callback); + + /** + *

获取表的详细信息,表的详细信息包括:

+ *
    + *
  • 表的结构({@link TableMeta})
  • + *
  • 表的预留吞吐量({@link ReservedThroughputDetails})
  • + *
  • 表的配置参数({@link TableOptions})
  • + *
+ * + * @param describeTableRequest 执行DescribeTable所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future describeTable( + DescribeTableRequest describeTableRequest, + TableStoreCallback callback); + + /** + * 返回用户当前实例下的所有表的列表。 + * + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future listTable( + TableStoreCallback callback); + + /** + * 删除用户指定的某个实例下的一张表。。 + *

注意:表被成功删除后该表下所有的数据都将会被清空,无法恢复,请谨慎操作!

+ * + * @param deleteTableRequest 执行DeleteTable所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future deleteTable( + DeleteTableRequest deleteTableRequest, + TableStoreCallback callback); + + /** + * 在用户指定的某张表下创建一张索引表 + * + * @param createIndexRequest 执行CreateIndex所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求返回的结果无效、或遇到网络异常 + */ + public Future createIndex( + CreateIndexRequest createIndexRequest, + TableStoreCallback callback); + + /** + * 在用户指定的某张表下删除一张索引表 + * + * @param deleteIndexRequest 执行deleteIndex所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求返回的结果无效、或遇到网络异常 + */ + public Future deleteIndex( + DeleteIndexRequest deleteIndexRequest, + TableStoreCallback callback); + + /** + * 读取表中的一行数据。 + * + * @param getRowRequest 执行GetRow操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future getRow( + GetRowRequest getRowRequest, TableStoreCallback callback); + + /** + * 向表中插入或覆盖一行数据。 + *

若要写入的行已经存在,则旧行会被删除后写入新的一行。

+ *

若要写入的行不存在,则直接写入新的一行。

+ * + * @param putRowRequest 执行PutRow操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future putRow( + PutRowRequest putRowRequest, TableStoreCallback callback); + + /** + * 更新表中的一行数据。 + *

若要更新的行不存在,则新写入一行数据。

+ *

更新操作可以包括新写入一个属性列或者删除一个属性列的一个或多个版本。

+ * + * @param updateRowRequest 执行UpdateRow操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future updateRow( + UpdateRowRequest updateRowRequest, TableStoreCallback callback); + + /** + * 删除表中的一行数据。 + *

若该行存在,则删除该行。

+ *

若该行不存在,则该操作不产生任何影响。

+ * + * @param deleteRowRequest 执行DeleteRow操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future deleteRow( + DeleteRowRequest deleteRowRequest, TableStoreCallback callback); + + /** + * 从多张表中读取多行数据。 + *

BatchGetRow 操作可视为多个 GetRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。

+ *

与执行大量的 GetRow 操作相比,使用 BatchGetRow 操作可以有效减少请求的响应时间,提高数据的读取速率。

+ *

但需要注意的是 BatchGetRow 只支持在表级别设置查询条件。操作完成后,需要逐个检查子请求的状态,并选择对失败的行进行重试。

+ * + * @param batchGetRowRequest 执行BatchGetRow操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future batchGetRow( + BatchGetRowRequest batchGetRowRequest, TableStoreCallback callback); + + /** + * 对多张表中对多行执行更新或者删除操作。 + *

BatchWriteRow 操作可视为多个PutRow、UpdateRow、DeleteRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。

+ *

执行 BatchWriteRow 操作后,需要逐个检查子请求的状态,来判断写入结果,并选择对失败的行进行重试。

+ * + * @param batchWriteRowRequest 执行BatchWriteRow操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future batchWriteRow( + BatchWriteRowRequest batchWriteRowRequest, TableStoreCallback callback); + + /** + * 从表中查询一个范围内的多行数据。 + * + * @param getRangeRequest 执行GetRange操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future getRange( + GetRangeRequest getRangeRequest, TableStoreCallback callback); + + /** + * 对表的数据根据一定的数据大小进行分块,并返回分块的信息以供数据获取接口使用。返回的数据分块按照主键列的递增顺序排列,返回的每个数据分块信息中包含分块所处的partition分区的ID的哈希值以及起始行和终止行的主键值,遵循左闭右开区间。 + * + * @param computeSplitsBySizeRequest 执行ComputeSplitsBySize操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future computeSplitsBySize(ComputeSplitsBySizeRequest computeSplitsBySizeRequest, TableStoreCallback callback); + + /** + * 获取用户当前实例下的全部Stream列表或者特定表下的Stream。 + * + * @param listStreamRequest 执行ListStream操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future listStream( + ListStreamRequest listStreamRequest, TableStoreCallback callback); + + /** + * 获取指定Stream的详细信息。通过此方法获取Shard列表。 + * + * @param describeStreamRequest 执行DescribeStream操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future describeStream( + DescribeStreamRequest describeStreamRequest, TableStoreCallback callback); + + /** + * 获取ShardIterator,可通过ShardIterator读取Shard中的数据。 + * + * @param getShardIteratorRequest 执行GetShardIterator操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future getShardIterator( + GetShardIteratorRequest getShardIteratorRequest, TableStoreCallback callback); + + /** + * 通过ShardIterator读取Shard中的数据。 + * + * @param getStreamRecordRequest 执行GetStreamRecord操作所需的参数。 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 获取结果的Future + */ + public Future getStreamRecord( + GetStreamRecordRequest getStreamRecordRequest, TableStoreCallback callback); + + /** + * 开启一个本地事务 + * @param request 启动本地事务操作所需的参数 + * @return + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future startLocalTransaction( + StartLocalTransactionRequest request, TableStoreCallback callback); + + /** + * 提交一个事务 + * @param request 提交事务操作所需的参数 + * @return + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future commitTransaction( + CommitTransactionRequest request, TableStoreCallback callback); + + /** + * 取消一个事务 + * @param request 取消事务操作所需的参数 + * @return + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future abortTransaction( + AbortTransactionRequest request, TableStoreCallback callback); + + /** + * 创建SearchIndex + * @param request 创建SearchIndex所需的参数,详见{@link CreateSearchIndexRequest} + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return SearchIndex服务返回的创建结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future createSearchIndex( + CreateSearchIndexRequest request, TableStoreCallback callback); + + /** + * 获取表下的SearchIndex列表 + *

一个table下面,可以存在多个SearchIndex表,通过该函数,将能够获取一个table下面的所有SearchIndex信息

+ * @param request 获取SearchIndex列表所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return TableStore指定表下的SearchIndex列表 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future listSearchIndex( + ListSearchIndexRequest request, TableStoreCallback callback); + + /** + * 删除SearchIndex + *

通过指定 tableName 和 indexName 即可删除一个index

+ *

提示:在没有删除一个table下面所有的index之前,是不允许删除table的

+ * @param request 删除SearchIndex所需的参数 + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 删除SearchIndex服务执行后返回的删除结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future deleteSearchIndex( + DeleteSearchIndexRequest request, TableStoreCallback callback); + + /** + * 获取一个SearchIndex的信息 + * @param request 获取SearchIndex所需的参数(tableName 和 indexName) + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 返回指定index的 schema 和目前的同步状态信息 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future describeSearchIndex( + DescribeSearchIndexRequest request, TableStoreCallback callback); + + /** + * 搜索功能 + *

构建自己的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); + * + *

+ * @param request 进行搜索所需的参数,详见{@link SearchRequest} + * @param callback 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数 + * @return 搜索结果,详见{@link SearchResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Future search( + SearchRequest request, TableStoreCallback callback); + + + /** + * 转换成同步接口的Client。 + * @return 同步Client + */ + public SyncClientInterface asSyncClient(); + + /** + * 释放资源。 + *

请确保在所有请求执行完毕之后释放资源。释放资源之后将不能再发送请求,正在执行的请求可能无法返回结果。

+ */ + public void shutdown(); + + /** + * Switch CredentialsProvider。 + * + * @param newCrdsProvider new CredentialsProvider, see {@link com.alicloud.openservices.tablestore.core.auth.CredentialsProviderFactory}. + */ + public void switchCredentialsProvider(CredentialsProvider newCrdsProvider); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/ClientConfiguration.java b/src/main/java/com/alicloud/openservices/tablestore/ClientConfiguration.java new file mode 100755 index 0000000..c461a84 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/ClientConfiguration.java @@ -0,0 +1,406 @@ +package com.alicloud.openservices.tablestore; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.DefaultRetryStrategy; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +/** + * 访问阿里云服务的客户端配置。 + */ +public class ClientConfiguration { + private static final int AVAILABLE_PROCESSORS = Runtime.getRuntime().availableProcessors(); + + private int ioThreadCount = AVAILABLE_PROCESSORS; + private int maxConnections = 300; + private int socketTimeoutInMillisecond = 30 * 1000; + private int connectionTimeoutInMillisecond = 30 * 1000; + private int retryThreadCount = 1; + + private boolean enableRequestCompression = false; + private boolean enableResponseCompression = false; + private boolean enableResponseValidation = true; + private boolean enableResponseContentMD5Checking = false; + private RetryStrategy retryStrategy = new DefaultRetryStrategy(); + private int timeThresholdOfServerTracer = 500; + private int timeThresholdOfTraceLogger = 1000; + + private String proxyHost; + private int proxyPort; + private String proxyUsername; + private String proxyPassword; + private String proxyDomain; + private String proxyWorkstation; + + private long syncClientWaitFutureTimeoutInMillis = 60 * 1000; + + /** + * 构造新实例。 + */ + public ClientConfiguration() { + } + + + /** + * 设置是否需要对请求数据进行压缩 + * @param enableRequestCompression + * 是否需要压缩(true/false) + */ + public void setEnableRequestCompression(boolean enableRequestCompression) { + this.enableRequestCompression = enableRequestCompression; + } + + /** + * 返回是否需要对请求数据进行压缩 + * @return 是否需要对request进行压缩 + */ + public boolean isEnableRequestCompression() { + return enableRequestCompression; + } + + /** + * 是否需要告知TableStore对返回的响应内容进行压缩 + * @param enableResponseCompression + * 是否告知TableStore对返回的响应内容进行压缩 + */ + public void setEnableResponseCompression(boolean enableResponseCompression) { + this.enableResponseCompression = enableResponseCompression; + } + + /** + * 返回是否需要告知TableStore对返回的响应内容进行压缩 + * @return + * 是否需要告知TableStore对返回的响应内容进行压缩 + */ + public boolean isEnableResponseCompression() { + return enableResponseCompression; + } + + /** + * 返回是否需要对响应进行验证 + * @return + * 是否需要对响应进行验证 + */ + public boolean isEnableResponseValidation() { + return enableResponseValidation; + } + + /** + * 是否需要对响应进行验证, 如果需要验证, + * Client会验证头信息完整性、结果是否过期、授权信息是否正确 + * @param enableResponseValidation + * 是否需要对响应进行验证 + */ + public void setEnableResponseValidation(boolean enableResponseValidation) { + this.enableResponseValidation = enableResponseValidation; + } + + /** + * 返回HttpAsyncClient的IOReactor的线程数。 + * + * @return IOReactor的线程数 + */ + public int getIoThreadCount() { + return ioThreadCount; + } + + /** + * 设置HttpAsyncClient的IOReactor的线程数(因为采用的是异步IO,所以不需要配置大量线程,每个线程都能提供大量并发)。 + * + * @param ioThreadCount IOReactor的线程数 + */ + public void setIoThreadCount(int ioThreadCount) { + Preconditions.checkArgument(ioThreadCount > 0, "The io thread count must be greater than 0."); + this.ioThreadCount = ioThreadCount; + } + + /** + * 返回允许打开的最大HTTP连接数。 + * + * @return 最大HTTP连接数。 + */ + public int getMaxConnections() { + return maxConnections; + } + + /** + * 设置允许打开的最大HTTP连接数(连接数影响并发度,需要根据QPS、单个请求的时间、机器配置等因素来确定一个合理的值)。 + * + * @param maxConnections 最大HTTP连接数。 + */ + public void setMaxConnections(int maxConnections) { + Preconditions.checkArgument(maxConnections > 0, "The max connection must be greater than 0."); + this.maxConnections = maxConnections; + } + + /** + * 返回通过打开的连接传输数据的超时时间(单位:毫秒)。 0表示无限等待(但不推荐使用)。受系统超时时间的限制。 + * + * @return 通过打开的连接传输数据的超时时间(单位:毫秒)。 + */ + public int getSocketTimeoutInMillisecond() { + return socketTimeoutInMillisecond; + } + + /** + * 设置通过打开的连接传输数据的超时时间(单位:毫秒)。 0表示无限等待(但不推荐使用)。受系统超时时间的限制。 + * + * @param socketTimeoutInMillisecond 通过打开的连接传输数据的超时时间(单位:毫秒)。 + */ + public void setSocketTimeoutInMillisecond(int socketTimeoutInMillisecond) { + Preconditions.checkArgument(socketTimeoutInMillisecond > 0, "The socket timeout must be greater than 0."); + this.socketTimeoutInMillisecond = socketTimeoutInMillisecond; + } + + /** + * 返回建立连接的超时时间(单位:毫秒)。0表示无限等待(但不推荐使用)。受系统超时时间的限制。 + * + * @return 建立连接的超时时间(单位:毫秒)。 + */ + public int getConnectionTimeoutInMillisecond() { + return connectionTimeoutInMillisecond; + } + + /** + * 设置建立连接的超时时间(单位:毫秒)。0表示无限等待(但不推荐使用)。受系统超时时间的限制。 + * + * @param connectionTimeoutInMillisecond 建立连接的超时时间(单位:毫秒)。 + */ + public void setConnectionTimeoutInMillisecond(int connectionTimeoutInMillisecond) { + Preconditions.checkArgument(connectionTimeoutInMillisecond > 0, "The connection timeout must be greater than 0."); + this.connectionTimeoutInMillisecond = connectionTimeoutInMillisecond; + } + + /** + * 返回用于执行错误重试的线程池的线程的个数。该线程池为一个ScheduledExecutorService。 + * + * @return 用于执行错误重试的线程池的线程的个数。 + */ + public int getRetryThreadCount() { + return retryThreadCount; + } + + /** + * 设置用于执行错误重试的线程池的线程的个数。该线程池为一个ScheduledExecutorService。 + * + * @param retryThreadCount 用于执行错误重试的线程池的线程的个数。 + */ + public void setRetryThreadCount(int retryThreadCount) { + Preconditions.checkArgument(retryThreadCount > 0, "The retry thread count must be greater than 0."); + this.retryThreadCount = retryThreadCount; + } + + /** + * 返回是否需要对响应内容做MD5校验 + * + * @return 是否需要对MD5内容做MD5校验 + */ + public boolean isEnableResponseContentMD5Checking() { + return enableResponseContentMD5Checking; + } + + /** + * 是否需要对响应的内容做MD5校验, 如果需要校验, + * Client会计算响应数据的MD5值并与返回的响应头中的x-ots-contentmd5头的值进行比对 + * + * @param enableResponseContentMD5Checking 是否需要校验响应数据MD5 + */ + public void setEnableResponseContentMD5Checking( + boolean enableResponseContentMD5Checking) { + this.enableResponseContentMD5Checking = enableResponseContentMD5Checking; + } + + /** + * 返回TableStore的请求重试策略 + * + * @return 请求重试策略 + */ + public RetryStrategy getRetryStrategy() { + return retryStrategy; + } + + /** + * 设置TableStore的请求重试策略 + * + * @param retryStrategy TableStore的请求重试策略 + */ + public void setRetryStrategy(RetryStrategy retryStrategy) { + Preconditions.checkArgument(retryStrategy != null, "The retry strategy should not be null."); + this.retryStrategy = retryStrategy; + } + + /** + * 返回当前设置的时间阈值(单位:毫秒)。 + * 当一个请求的总执行时间(包含重试占用的时间)超过该阈值时,SDK会记录一条WARN级别的日志。 + * 该功能依赖于日志相关的配置。 + * + * @return 时间阈值 + */ + public int getTimeThresholdOfTraceLogger() { + return timeThresholdOfTraceLogger; + } + + /** + * 设置一个时间阈值(单位:毫秒)。 + * 当一个请求的总执行时间(包含重试占用的时间)超过该阈值时,SDK会记录一条WARN级别的日志。 + * 该功能依赖于日志相关的配置。 + * + * @param timeThresholdOfTraceLogger trace logger + */ + public void setTimeThresholdOfTraceLogger(int timeThresholdOfTraceLogger) { + Preconditions.checkArgument(timeThresholdOfTraceLogger > 0, "The time threshold of trace logger must be greater than 0."); + this.timeThresholdOfTraceLogger = timeThresholdOfTraceLogger; + } + + /** + * 返回当前设置的服务端Tracer时间阈值(单位:毫秒)。 + * 当一个请求在服务端的执行时间超过该阈值时,SDK会收到服务端的tracer信息并记录。 + * 该功能依赖于服务端相关配置。 + * + * @return 时间阈值 + */ + public int getTimeThresholdOfServerTracer() { + return timeThresholdOfServerTracer; + } + + /** + * 设置服务端Tracer的时间阈值(单位:毫秒)。 + * 当一个请求在服务端的执行时间超过该阈值时,SDK会收到服务端的tracer信息并记录。 + * 该功能依赖于服务端相关配置 + * + * @param timeThresholdOfServerTracer trace logger + */ + public void setTimeThresholdOfServerTracer(int timeThresholdOfServerTracer) { + Preconditions.checkArgument(timeThresholdOfServerTracer > 0, "The time threshold of server tracer must be greater than 0."); + this.timeThresholdOfServerTracer = timeThresholdOfServerTracer; + } + + /** + * 返回代理服务器主机地址。 + * + * @return 代理服务器主机地址。 + */ + public String getProxyHost() { + return proxyHost; + } + + /** + * 设置代理服务器主机地址。 + * + * @param proxyHost + * 代理服务器主机地址。 + */ + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + /** + * 返回代理服务器端口。 + * + * @return 代理服务器端口。 + */ + public int getProxyPort() { + return proxyPort; + } + + /** + * 设置代理服务器端口。 + * + * @param proxyPort + * 代理服务器端口。 + */ + public void setProxyPort(int proxyPort) { + this.proxyPort = proxyPort; + } + + /** + * 返回代理服务器验证的用户名。 + * + * @return 用户名。 + */ + public String getProxyUsername() { + return proxyUsername; + } + + /** + * 设置代理服务器验证的用户名。 + * + * @param proxyUsername + * 用户名。 + */ + public void setProxyUsername(String proxyUsername) { + this.proxyUsername = proxyUsername; + } + + /** + * 返回代理服务器验证的密码。 + * + * @return 密码。 + */ + public String getProxyPassword() { + return proxyPassword; + } + + /** + * 设置代理服务器验证的密码。 + * + * @param proxyPassword + * 密码。 + */ + public void setProxyPassword(String proxyPassword) { + this.proxyPassword = proxyPassword; + } + + /** + * 返回访问NTLM验证的代理服务器的Windows域名(可选)。 + * + * @return 域名。 + */ + public String getProxyDomain() { + return proxyDomain; + } + + /** + * 设置访问NTLM验证的代理服务器的Windows域名(可选)。 + * + * @param proxyDomain + * 域名。 + */ + public void setProxyDomain(String proxyDomain) { + this.proxyDomain = proxyDomain; + } + + /** + * 返回NTLM代理服务器的Windows工作站名称。 + * + * @return NTLM代理服务器的Windows工作站名称。 + */ + public String getProxyWorkstation() { + return proxyWorkstation; + } + + /** + * 设置NTLM代理服务器的Windows工作站名称。 (可选,如果代理服务器非NTLM,不需要设置该参数)。 + * + * @param proxyWorkstation + * NTLM代理服务器的Windows工作站名称。 + */ + public void setProxyWorkstation(String proxyWorkstation) { + this.proxyWorkstation = proxyWorkstation; + } + + /** + * 获取同步Client内等待异步调用返回的最大超时时间。 + * @return + */ + public long getSyncClientWaitFutureTimeoutInMillis() { + return syncClientWaitFutureTimeoutInMillis; + } + + /** + * 设置同步Client内等待异步调用返回的最大超时时间。 + * @param syncClientWaitFutureTimeoutInMillis + */ + public void setSyncClientWaitFutureTimeoutInMillis(long syncClientWaitFutureTimeoutInMillis) { + this.syncClientWaitFutureTimeoutInMillis = syncClientWaitFutureTimeoutInMillis; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/ClientException.java b/src/main/java/com/alicloud/openservices/tablestore/ClientException.java new file mode 100755 index 0000000..39d2f5e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/ClientException.java @@ -0,0 +1,87 @@ +package com.alicloud.openservices.tablestore; + +/** + * {@link ClientException} 发生在请求的返回结果无效或遇到网络异常。 + *

TraceId: 在SDK内部提供的日志中会追踪某个请求的各个阶段的执行信息,可以通过这个ID来追踪日志排查问题。

+ */ +public class ClientException extends RuntimeException { + + private static final long serialVersionUID = 1870835486798448798L; + + /** + * 在SDK内部提供的日志中会追踪某个请求的各个阶段的执行信息,可以通过这个ID来追踪日志排查问题。 + */ + private String traceId; + + /** + * 构造新实例。 + */ + public ClientException() { + super(); + } + + /** + * 构造函数。 + * + * @param message 异常信息 + */ + public ClientException(String message) { + super(message); + } + + /** + * 构造函数。 + * + * @param cause 异常原因 + */ + public ClientException(Throwable cause) { + super(cause); + } + + /** + * 构造函数。 + * + * @param message 异常信息 + * @param traceId TraceId + */ + public ClientException(String message, String traceId) { + super(message); + this.traceId = traceId; + } + + /** + * 构造函数。 + * + * @param message 异常信息 + * @param cause 异常原因 + */ + public ClientException(String message, Throwable cause) { + super(message, cause); + } + + /** + * 构造函数。 + * + * @param message 异常信息 + * @param cause 异常原因 + * @param traceId TraceId + */ + public ClientException(String message, Throwable cause, String traceId) { + super(message, cause); + this.traceId = traceId; + } + + /** + * 返回TraceId。 + * + * @return TraceId。 + */ + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/DefaultTableStoreWriter.java b/src/main/java/com/alicloud/openservices/tablestore/DefaultTableStoreWriter.java new file mode 100644 index 0000000..d52adc2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/DefaultTableStoreWriter.java @@ -0,0 +1,273 @@ +package com.alicloud.openservices.tablestore; + +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.core.utils.ParamChecker; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.writer.*; +import com.lmax.disruptor.InsufficientCapacityException; +import com.lmax.disruptor.RingBuffer; +import com.lmax.disruptor.dsl.Disruptor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.ReentrantLock; + +public class DefaultTableStoreWriter implements TableStoreWriter { + private Logger logger = LoggerFactory.getLogger(TableStoreWriter.class); + + private AsyncClientInterface ots; + + private Executor executor; + + private WriterConfig writerConfig; + + private TableStoreCallback callback; + + private TableStoreCallback resultCallback; + + private String tableName; + + private TableMeta tableMeta; + + private Timer flushTimer; + + private Disruptor disruptor; + + private RingBuffer ringBuffer; + + private RowChangeEventHandler eventHandler; + + private ExecutorService disruptorExecutor; + + private DefaultWriterStatistics writerStatistics; + + private AtomicBoolean closed = new AtomicBoolean(false); + + public DefaultTableStoreWriter(AsyncClientInterface ots, String tableName, WriterConfig config, TableStoreCallback callback, Executor executor) { + Preconditions.checkNotNull(ots, "The ots client can not be null."); + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), "The table name can not be null or empty."); + Preconditions.checkNotNull(executor, "The executor service can not be null."); + this.writerStatistics = new DefaultWriterStatistics(); + this.ots = ots; + this.tableName = tableName; + this.writerConfig = config; + this.callback = callback; + this.resultCallback = createResultCallback(callback); + this.executor = executor; + flushTimer = new Timer(); + + initialize(); + closed.set(false); + } + + private TableStoreCallback createResultCallback(final TableStoreCallback callback) { + if (callback != null) { + return new TableStoreCallback() { + @Override + public void onCompleted(RowChange req, RowWriteResult res) { + callback.onCompleted(req, res.getConsumedCapacity()); + } + + @Override + public void onFailed(RowChange req, Exception ex) { + callback.onFailed(req, ex); + } + }; + } else { + return null; + } + } + + private void initialize() { + logger.info("Start initialize ots writer, table name: {}.", tableName); + DescribeTableRequest request = new DescribeTableRequest(); + request.setTableName(tableName); + Future result = ots.describeTable(request, null); + DescribeTableResponse res = null; + try { + res = result.get(); + } catch (Exception e) { + throw new ClientException(e); + } + this.tableMeta = res.getTableMeta(); + logger.info("End initialize with table meta: {}.", tableMeta); + + RowChangeEvent.RowChangeEventFactory factory = new RowChangeEvent.RowChangeEventFactory(); + + // start flush thread, we only need one event handler, so we just set a thread pool with fixed size 1. + disruptorExecutor = Executors.newFixedThreadPool(1); + disruptor = new Disruptor(factory, writerConfig.getBufferSize(), disruptorExecutor); + ringBuffer = disruptor.getRingBuffer(); + eventHandler = new RowChangeEventHandler(ots, writerConfig, resultCallback, executor, writerStatistics); + disruptor.handleEventsWith(eventHandler); + disruptor.start(); + + // start flush timer + startFlushTimer(writerConfig.getFlushInterval()); + } + + public void startFlushTimer(int flushInterval) { + + this.flushTimer.cancel(); + + this.flushTimer = new Timer(); + this.flushTimer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + triggerFlush(); + } + }, flushInterval, flushInterval); + } + + @Override + public void addRowChange(RowChange rowChange) { + if (writerConfig.isEnableSchemaCheck()) { + ParamChecker.checkRowChange(tableMeta, rowChange, writerConfig); + } + + while (true) { + if (!addRowChangeInternal(rowChange)) { + try { + Thread.sleep(1); + } catch (InterruptedException exp) { + } + } else { + break; + } + } + } + + @Override + public boolean tryAddRowChange(RowChange rowChange) { + if (writerConfig.isEnableSchemaCheck()) { + ParamChecker.checkRowChange(tableMeta, rowChange, writerConfig); + } + + return addRowChangeInternal(rowChange); + } + + public boolean addRowChangeInternal(RowChange rowChange) { + if (closed.get()) { + throw new ClientException("The writer has been closed."); + } + + try { + long sequence = ringBuffer.tryNext(); + RowChangeEvent event = ringBuffer.get(sequence); + event.setValue(rowChange); + ringBuffer.publish(sequence); + return true; + } catch (InsufficientCapacityException e) { + return false; + } + } + + private void addSignal(CountDownLatch latch) { + while (true) { + try { + long sequence = ringBuffer.tryNext(); + RowChangeEvent event = ringBuffer.get(sequence); + event.setValue(latch); + ringBuffer.publish(sequence); + return; + } catch (InsufficientCapacityException e) { + try { + Thread.sleep(1); + } catch (InterruptedException exp) { + } + } + } + } + + @Override + public void addRowChange(List rowChanges, List dirtyRows) throws ClientException { + dirtyRows.clear(); + for (RowChange rowChange : rowChanges) { + try { + addRowChange(rowChange); + } catch (ClientException e) { + dirtyRows.add(rowChange); + } + } + if (!dirtyRows.isEmpty()) { + throw new ClientException("There is dirty rows."); + } + } + + @Override + public void setCallback(final TableStoreCallback callback) { + this.callback = callback; + this.resultCallback = createResultCallback(callback); + eventHandler.setCallback(resultCallback); + } + + @Override + public void setResultCallback(TableStoreCallback resultCallback) { + this.callback = null; + this.resultCallback = resultCallback; + eventHandler.setCallback(resultCallback); + } + + @Override + public TableStoreCallback getCallback() { + return this.callback; + } + + @Override + public TableStoreCallback getResultCallback() { + return this.resultCallback; + } + + + @Override + public WriterConfig getWriterConfig() { + return writerConfig; + } + + @Override + public WriterStatistics getWriterStatistics() { + return writerStatistics; + } + + private CountDownLatch triggerFlush() { + CountDownLatch latch = new CountDownLatch(1); + addSignal(latch); + return latch; + } + + @Override + public synchronized void flush() throws ClientException { + logger.debug("trigger flush and waiting."); + if (closed.get()) { + throw new ClientException("The writer has been closed."); + } + + CountDownLatch latch = triggerFlush(); + try { + latch.await(); + } catch (InterruptedException e) { + throw new ClientException(e); + } + logger.debug("user trigger flush finished."); + } + + @Override + public synchronized void close() { + if (closed.get()) { + throw new ClientException("The writer has already been closed."); + } + + flushTimer.cancel(); + flush(); + disruptor.shutdown(); + disruptorExecutor.shutdown(); + + closed.set(true); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/InternalClient.java b/src/main/java/com/alicloud/openservices/tablestore/InternalClient.java new file mode 100644 index 0000000..ac4a235 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/InternalClient.java @@ -0,0 +1,1212 @@ +package com.alicloud.openservices.tablestore; + +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProviderFactory; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.*; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.search.*; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelResponse; + +public class InternalClient { + private static int AVAILABLE_PROCESSORS = Runtime.getRuntime().availableProcessors(); + private String endpoint; // TableStore endpoint + private String instanceName; // 实例的名称 + private CredentialsProvider crdsProvider; // 用户身份信息。 + private AsyncServiceClient httpClient; + private ScheduledExecutorService retryExecutor; + private ExecutorService callbackExecutor; // 用于执行Callback + private ClientConfiguration clientConfig; + private RetryStrategy retryStrategy; + private LauncherFactory launcherFactory; + private Random random = new Random(); + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint + * TableStore服务的endpoint。 + * @param accessKeyId + * 访问TableStore服务的Access ID。 + * @param accessKeySecret + * 访问TableStore服务的Access Key。 + * @param instanceName + * 访问TableStore服务的实例名称。 + */ + public InternalClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, null); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint + * TableStore服务的endpoint。 + * @param accessKeyId + * 访问TableStore服务的Access ID。 + * @param accessKeySecret + * 访问TableStore服务的Access Key。 + * @param instanceName + * 访问TableStore服务的实例名称。 + * @param config + * 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + */ + public InternalClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, + ClientConfiguration config) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, config, null); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint + * TableStore服务的endpoint。 + * @param accessKeyId + * 访问TableStore服务的Access ID。 + * @param accessKeySecret + * 访问TableStore服务的Access Key。 + * @param instanceName + * 访问TableStore服务的实例名称。 + * @param config + * 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param callbackExecutor + * 用于执行用户在调用异步接口时传入的Callback。如果传入null则使用默认配置( 线程数与CPU核数相同的线程池)。 + */ + public InternalClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, + ClientConfiguration config, ExecutorService callbackExecutor) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, config, callbackExecutor, null); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link AsyncClient}实例。 + * + * @param endpoint + * TableStore服务的endpoint。 + * @param accessKeyId + * 访问TableStore服务的Access ID。 + * @param accessKeySecret + * 访问TableStore服务的Access Key。 + * @param instanceName + * 访问TableStore服务的实例名称。 + * @param config + * 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param callbackExecutor + * 用于执行用户在调用异步接口时传入的Callback。如果传入null则使用默认配置( 线程数与CPU核数相同的线程池)。 + * @param stsToken + * Sts Token. + */ + public InternalClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, + ClientConfiguration config, ExecutorService callbackExecutor, String stsToken) { + this(endpoint, CredentialsProviderFactory.newDefaultCredentialProvider(accessKeyId, accessKeySecret, stsToken), + instanceName, config, callbackExecutor); + + + } + + public InternalClient(String endpoint, CredentialsProvider credsProvider, String instanceName, + ClientConfiguration config, ExecutorService callbackExecutor) { + Preconditions.checkArgument(endpoint != null && !endpoint.isEmpty(), + "The end point should not be null or empty."); + Preconditions.checkArgument(instanceName != null && !instanceName.isEmpty(), + "The name of instance should not be null or empty."); + Preconditions.checkArgument(instanceName.length() == instanceName.getBytes(Constants.UTF8_CHARSET).length, + "InstanceName should not have multibyte character."); + + if (!endpoint.startsWith("http://") && !endpoint.startsWith("https://")) { + throw new IllegalArgumentException("the endpoint must start with \"http://\" or \"https://\"."); + } + this.endpoint = endpoint; + + this.crdsProvider = credsProvider; + + if (config == null) { + config = new ClientConfiguration(); + } + + this.clientConfig = config; + + this.httpClient = new AsyncServiceClient(config); + + this.retryExecutor = Executors.newScheduledThreadPool(config.getRetryThreadCount(), + new ThreadFactory() { + private final AtomicInteger counter = new AtomicInteger(1); + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "tablestore-retry-scheduled-" + counter.getAndIncrement()); + } + }); + + this.retryStrategy = config.getRetryStrategy(); + + this.instanceName = instanceName; + + if (callbackExecutor != null) { + this.callbackExecutor = callbackExecutor; + } else { + this.callbackExecutor = Executors.newFixedThreadPool(AVAILABLE_PROCESSORS, + new ThreadFactory() { + private final AtomicInteger counter = new AtomicInteger(1); + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "tablestore-callback-" + counter.getAndIncrement()); + } + }); + } + + this.launcherFactory = new LauncherFactory(endpoint, instanceName, httpClient, crdsProvider, config); + } + + public void setExtraHeaders(Map extraHeaders) { + this.httpClient.setExtraHeaders(extraHeaders); + } + + /** + * 返回访问的TableStore Endpoint。 + * + * @return TableStore Endpoint。 + */ + public String getEndpoint() { + return endpoint; + } + + /** + * 返回访问的实例的名称 + * + * @return instance name + */ + public String getInstanceName() { + return instanceName; + } + + + /** + * 返回Client配置。 + * @return + */ + public ClientConfiguration getClientConfig() { + return clientConfig; + } + + private TraceLogger getTraceLogger() { + String traceId = new UUID(random.nextLong(), (new Random()).nextLong()).toString(); + return new TraceLogger(traceId, this.clientConfig.getTimeThresholdOfTraceLogger()); + } + + public Future listTable(TableStoreCallback callback) { + ListTableRequest request = new ListTableRequest(); + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + ListTableLauncher launcher = launcherFactory.listTable(tracer, retry, request); + + AsyncCompletion completion; + completion = new AsyncCompletion(launcher, request, tracer, + callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future createTable(CreateTableRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + CreateTableLauncher launcher = launcherFactory.createTable(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future describeTable(DescribeTableRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + DescribeTableLauncher launcher = launcherFactory.describeTable(tracer, retry, request); + + AsyncCompletion completion; + completion = new AsyncCompletion(launcher, request, tracer, + callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future deleteTable(DeleteTableRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + DeleteTableLauncher launcher = launcherFactory.deleteTable(tracer, retry, request); + + AsyncCompletion completion; + completion = new AsyncCompletion(launcher, request, tracer, + callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future updateTable(UpdateTableRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + UpdateTableLauncher launcher = launcherFactory.updateTable(tracer, retry, request); + + AsyncCompletion completion; + completion = new AsyncCompletion(launcher, request, tracer, + callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future createIndex(CreateIndexRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + CreateIndexLauncher launcher = launcherFactory.createIndex(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future deleteIndex(DeleteIndexRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + DeleteIndexLauncher launcher = launcherFactory.deleteIndex(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future getRowInternal(GetRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + GetRowLauncher launcher = launcherFactory.getRow(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future getRow(GetRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + GetRowLauncher launcher = launcherFactory.getRow(tracer, retry, request); + + AsyncGetRowCompletion completion = new AsyncGetRowCompletion(launcher, request, tracer, callbackExecutor, retry, + retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future putRow(PutRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + PutRowLauncher launcher = launcherFactory.putRow(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future updateRow(UpdateRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + UpdateRowLauncher launcher = launcherFactory.updateRow(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future deleteRow(DeleteRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + DeleteRowLauncher launcher = launcherFactory.deleteRow(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future batchGetRowInternal(BatchGetRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + BatchGetRowLauncher launcher = launcherFactory.batchGetRow(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future batchGetRow(BatchGetRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + BatchGetRowLauncher launcher = launcherFactory.batchGetRow(tracer, retry, request); + + AsyncBatchGetRowCompletion completion = new AsyncBatchGetRowCompletion(launcher, request, tracer, + callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future batchWriteRow(BatchWriteRowRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + BatchWriteRowLauncher launcher = launcherFactory.batchWriteRow(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future getRangeInternal(GetRangeRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + GetRangeLauncher launcher = launcherFactory.getRange(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future getRange(GetRangeRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + GetRangeLauncher launcher = launcherFactory.getRange(tracer, retry, request); + + AsyncGetRangeCompletion completion = new AsyncGetRangeCompletion(launcher, request, tracer, callbackExecutor, + retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future computeSplitsBySize(ComputeSplitsBySizeRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + Preconditions.checkStringNotNullAndEmpty(request.getTableName(), + "The table name for ComputeSplitsBySize should not be null or empty."); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + ComputeSplitsBySizeLauncher launcher = launcherFactory.computeSplitsBySize(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public void shutdown() { + this.retryExecutor.shutdownNow(); + this.callbackExecutor.shutdownNow(); + this.httpClient.shutdown(); + } + + public Future listStream(ListStreamRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + ListStreamLauncher launcher = launcherFactory.listStream(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future describeStream(DescribeStreamRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + DescribeStreamLauncher launcher = launcherFactory.describeStream(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future getShardIterator(GetShardIteratorRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + GetShardIteratorLauncher launcher = launcherFactory.getShardIterator(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future getStreamRecord(GetStreamRecordRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + GetStreamRecordLauncher launcher = launcherFactory.getStreamRecord(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future startLocalTransaction(StartLocalTransactionRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + StartLocalTransactionLauncher launcher = launcherFactory.startLocalTransaction(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future commitTransaction(CommitTransactionRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + CommitTransactionLauncher launcher = launcherFactory.commitTransaction(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future abortTransaction(AbortTransactionRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + AbortTransactionLauncher launcher = launcherFactory.abortTransaction(tracer, retry, request); + + AsyncCompletion completion = new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future createSearchIndex(CreateSearchIndexRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + CreateSearchIndexLauncher launcher = launcherFactory.createSearchIndex(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future listSearchIndex(ListSearchIndexRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + ListSearchIndexLauncher launcher = launcherFactory.listSearchIndex(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future deleteSearchIndex(DeleteSearchIndexRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + DeleteSearchIndexLauncher launcher = launcherFactory.deleteSearchIndex(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future describeSearchIndex(DescribeSearchIndexRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + DescribeSearchIndexLauncher launcher = launcherFactory.describeSearchIndex(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future search(SearchRequest request, TableStoreCallback callback) { + Preconditions.checkNotNull(request); + + TraceLogger tracer = getTraceLogger(); + RetryStrategy retry = this.retryStrategy.clone(); + SearchLauncher launcher = launcherFactory.search(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future createTunnel(CreateTunnelRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + CreateTunnelLauncher launcher = launcherFactory.createTunnel(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future listTunnel(ListTunnelRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + ListTunnelLauncher launcher = launcherFactory.listTunnel(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future describeTunnel(DescribeTunnelRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + DescribeTunnelLauncher launcher = launcherFactory.describeTunnel(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future deleteTunnel(DeleteTunnelRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + DeleteTunnelLauncher launcher = launcherFactory.deleteTunnel(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future connectTunnel(ConnectTunnelRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + ConnectTunnelLauncher launcher = launcherFactory.connectTunnel(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + + public Future heartbeat(HeartbeatRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + HeartbeatLauncher launcher = launcherFactory.heartbeat(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future shutdownTunnel(ShutdownTunnelRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + ShutdownTunnelLauncher launcher = launcherFactory.shutdownTunnel(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future getCheckpoint(GetCheckpointRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + GetCheckpointLauncher launcher = launcherFactory.getCheckpoint(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future readRecords(ReadRecordsRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + ReadRecordsLauncher launcher = launcherFactory.readRecords(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public Future checkpoint(CheckpointRequest request, + TableStoreCallback callback) { + Preconditions.checkNotNull(request); + TraceLogger tracer = getTraceLogger(); + + RetryStrategy retry = this.retryStrategy.clone(); + CheckpointLauncher launcher = launcherFactory.checkpoint(tracer, retry, request); + + AsyncCompletion completion = + new AsyncCompletion( + launcher, request, tracer, callbackExecutor, retry, retryExecutor + ); + CallbackImpledFuture f = + new CallbackImpledFuture(); + completion.watchBy(f); + + if (callback != null) { + // user callback must be triggered after completion of the return + // future. + f.watchBy(callback); + } + + launcher.fire(request, completion); + + return f; + } + + public void setCredentials(ServiceCredentials credentials) { + CredentialsProvider newCrdsProvider = CredentialsProviderFactory.newDefaultCredentialProvider(credentials.getAccessKeyId(), + credentials.getAccessKeySecret(), credentials.getSecurityToken()); + switchCredentialsProvider(newCrdsProvider); + } + + public void switchCredentialsProvider(CredentialsProvider newCrdsProvider) { + this.crdsProvider = newCrdsProvider; + this.launcherFactory.setCredentialsProvider(newCrdsProvider); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/PartialResultFailedException.java b/src/main/java/com/alicloud/openservices/tablestore/PartialResultFailedException.java new file mode 100644 index 0000000..2551582 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/PartialResultFailedException.java @@ -0,0 +1,37 @@ +package com.alicloud.openservices.tablestore; + +import com.alicloud.openservices.tablestore.model.Response; + +import java.util.ArrayList; +import java.util.List; + +public class PartialResultFailedException extends TableStoreException { + + private Response response; + private List errors = new ArrayList(); + + /** + * 构造函数。 + * + * @param cause 错误原因 + * @param requestId RequestId + * @param response 请求返回结果 + */ + public PartialResultFailedException(Throwable cause, String requestId, Response response) { + super("Partial result failed in batch operations.", cause, "", requestId, 0); + this.response = response; + } + + public void addError(TableStoreException ex) { + errors.add(ex); + } + + public List getErrors() { + return this.errors; + } + + public Response getResult() { + return this.response; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/PrepareCallback.java b/src/main/java/com/alicloud/openservices/tablestore/PrepareCallback.java new file mode 100644 index 0000000..1ebe21f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/PrepareCallback.java @@ -0,0 +1,6 @@ +package com.alicloud.openservices.tablestore; + +public interface PrepareCallback { + void onPrepare(); +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/SyncClient.java b/src/main/java/com/alicloud/openservices/tablestore/SyncClient.java new file mode 100755 index 0000000..70d54cd --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/SyncClient.java @@ -0,0 +1,461 @@ +package com.alicloud.openservices.tablestore; + +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.*; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.search.*; +import org.apache.http.concurrent.FutureCallback; +import com.alicloud.openservices.tablestore.PrepareCallback; + +public class SyncClient implements SyncClientInterface { + public class DefaultPrepareCallback implements PrepareCallback { + public DefaultPrepareCallback() { + } + + public void onPrepare() { + } + } + private InternalClient internalClient; + private PrepareCallback prepareCallback = new DefaultPrepareCallback(); + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link SyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + */ + public SyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName) { + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link SyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param stsToken Sts Token. + */ + public SyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, String stsToken) { + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, null, null, stsToken); + } + + /** + * 使用指定的TableStore Endpoint和配置构造一个新的{@link SyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + */ + public SyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, + ClientConfiguration config) { + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, config); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link SyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param stsToken Sts Token. + */ + public SyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, ClientConfiguration config, String stsToken) { + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, config, null, stsToken); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link SyncClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param stsToken Sts Token. + * @param callbackExecutor 执行callback的线程池,需要注意的是,client在shutdown的时候也会shutdown这个线程池。 + */ + public SyncClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, ClientConfiguration config, String stsToken, ExecutorService callbackExecutor) { + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, config, callbackExecutor, stsToken); + } + + SyncClient(InternalClient internalClient) { + this.internalClient = internalClient; + } + + public void setExtraHeaders(Map extraHeaders) { + this.internalClient.setExtraHeaders(extraHeaders); + } + + /** + * 返回访问的TableStore Endpoint。 + * + * @return TableStore Endpoint。 + */ + public String getEndpoint() { + return this.internalClient.getEndpoint(); + } + + /** + * 返回访问的实例的名称 + * + * @return instance name + */ + public String getInstanceName() { + return this.internalClient.getInstanceName(); + } + + @Override + public CreateTableResponse createTable(CreateTableRequest createTableRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(createTableRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.createTable(createTableRequest, null); + return waitForFuture(res); + } + + @Override + public ListTableResponse listTable() + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.listTable(null); + return waitForFuture(res); + } + + @Override + public DescribeTableResponse describeTable(DescribeTableRequest request) + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.describeTable(request, null); + return waitForFuture(res); + } + + @Override + public DeleteTableResponse deleteTable(DeleteTableRequest deleteTableRequest) + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(deleteTableRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.deleteTable(deleteTableRequest, null); + return waitForFuture(res); + } + + @Override + public UpdateTableResponse updateTable(UpdateTableRequest request) + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.updateTable(request, null); + return waitForFuture(res); + } + + @Override + public CreateIndexResponse createIndex(CreateIndexRequest createIndexRequest) + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(createIndexRequest); + + Future res = this.internalClient.createIndex(createIndexRequest, null); + return waitForFuture(res); + } + + @Override + public DeleteIndexResponse deleteIndex(DeleteIndexRequest deleteIndexRequest) + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(deleteIndexRequest); + + Future res = this.internalClient.deleteIndex(deleteIndexRequest, null); + return waitForFuture(res); + } + + @Override + public GetRowResponse getRow(GetRowRequest getRowRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(getRowRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.getRow(getRowRequest, null); + return waitForFuture(res); + } + + @Override + public PutRowResponse putRow(PutRowRequest putRowRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(putRowRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.putRow(putRowRequest, null); + return waitForFuture(res); + } + + @Override + public UpdateRowResponse updateRow(UpdateRowRequest updateRowRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(updateRowRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.updateRow(updateRowRequest, null); + return waitForFuture(res); + } + + @Override + public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(deleteRowRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.deleteRow(deleteRowRequest, null); + return waitForFuture(res); + } + + @Override + public BatchGetRowResponse batchGetRow(final BatchGetRowRequest batchGetRowRequest) + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(batchGetRowRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.batchGetRow(batchGetRowRequest, null); + return waitForFuture(res); + } + + @Override + public BatchWriteRowResponse batchWriteRow(final BatchWriteRowRequest batchWriteRowRequest) + throws TableStoreException, ClientException + { + Preconditions.checkNotNull(batchWriteRowRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.batchWriteRow(batchWriteRowRequest, null); + return waitForFuture(res); + } + + @Override + public GetRangeResponse getRange(GetRangeRequest getRangeRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(getRangeRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.getRange(getRangeRequest, null); + return waitForFuture(res); + } + + @Override + public ComputeSplitsBySizeResponse computeSplitsBySize(ComputeSplitsBySizeRequest computeSplitsBySizeRequest) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(computeSplitsBySizeRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.computeSplitsBySize(computeSplitsBySizeRequest, null); + return waitForFuture(res); + } + + @Override + public Iterator createRangeIterator( + RangeIteratorParameter rangeIteratorParameter) throws TableStoreException, + ClientException { + return new RowIterator(this, rangeIteratorParameter); + } + + @Override + public WideColumnIterator createWideColumnIterator(GetRowRequest getRowRequest) throws TableStoreException, ClientException { + GetRowColumnIteratorImpl getRowColumnIterator = new GetRowColumnIteratorImpl(internalClient, getRowRequest); + if (getRowColumnIterator.isRowExistent()) { + return new WideColumnIterator(getRowRequest.getRowQueryCriteria().getPrimaryKey(), getRowColumnIterator); + } else { + return null; + } + } + + @Override + public ListStreamResponse listStream(ListStreamRequest listStreamRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(listStreamRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.listStream(listStreamRequest, null); + return waitForFuture(res); + } + + @Override + public DescribeStreamResponse describeStream(DescribeStreamRequest describeStreamRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(describeStreamRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.describeStream(describeStreamRequest, null); + return waitForFuture(res); + } + + @Override + public GetShardIteratorResponse getShardIterator(GetShardIteratorRequest getShardIteratorRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(getShardIteratorRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.getShardIterator(getShardIteratorRequest, null); + return waitForFuture(res); + } + + @Override + public GetStreamRecordResponse getStreamRecord(GetStreamRecordRequest getStreamRecordRequest) throws TableStoreException, ClientException { + Preconditions.checkNotNull(getStreamRecordRequest); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.getStreamRecord(getStreamRecordRequest, null); + return waitForFuture(res); + } + + @Override + public CreateSearchIndexResponse createSearchIndex(CreateSearchIndexRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.createSearchIndex(request, null); + return waitForFuture(res); + } + + @Override + public ListSearchIndexResponse listSearchIndex(ListSearchIndexRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.listSearchIndex(request, null); + return waitForFuture(res); + } + + @Override + public DeleteSearchIndexResponse deleteSearchIndex(DeleteSearchIndexRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.deleteSearchIndex(request, null); + return waitForFuture(res); + } + + @Override + public DescribeSearchIndexResponse describeSearchIndex(DescribeSearchIndexRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkStringNotNullAndEmpty(request.getTableName(), "TableName should not be null or empty."); + Preconditions.checkStringNotNullAndEmpty(request.getIndexName(), "TableName should not be null or empty."); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.describeSearchIndex(request, null); + return waitForFuture(res); + } + + @Override + public SearchResponse search(SearchRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.search(request, null); + return waitForFuture(res); + } + + @Override + public StartLocalTransactionResponse startLocalTransaction(StartLocalTransactionRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.startLocalTransaction(request, null); + return waitForFuture(res); + } + + @Override + public CommitTransactionResponse commitTransaction(CommitTransactionRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.commitTransaction(request, null); + return waitForFuture(res); + } + + @Override + public AbortTransactionResponse abortTransaction(AbortTransactionRequest request) throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(prepareCallback); + + prepareCallback.onPrepare(); + Future res = this.internalClient.abortTransaction(request, null); + return waitForFuture(res); + } + + private Res waitForFuture(Future f) { + try { + return f.get(this.internalClient.getClientConfig().getSyncClientWaitFutureTimeoutInMillis(), TimeUnit.MILLISECONDS); + } catch(InterruptedException e) { + throw new ClientException(String.format( + "The thread was interrupted: %s", e.getMessage())); + } catch(ExecutionException e) { + throw new ClientException("The thread was aborted", e); + } catch (TimeoutException e) { + throw new ClientException("Wait future timeout", e); + } + } + + @Override + public AsyncClientInterface asAsyncClient() { + return new AsyncClient(this.internalClient); + } + + @Override + public void shutdown() { + this.internalClient.shutdown(); + } + + public void setPrepareCallback(PrepareCallback cb) { + prepareCallback = cb; + } + + public void setCredentials(ServiceCredentials credentials) { + internalClient.setCredentials(credentials); + } + + @Override + public void switchCredentialsProvider(CredentialsProvider newCrdsProvider) { + internalClient.switchCredentialsProvider(newCrdsProvider); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/SyncClientInterface.java b/src/main/java/com/alicloud/openservices/tablestore/SyncClientInterface.java new file mode 100755 index 0000000..97e7608 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/SyncClientInterface.java @@ -0,0 +1,391 @@ +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore; + +import java.util.Iterator; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.search.*; + +/** + * 阿里云表格存储(TableStore, 原OTS)的访问接口。 + *

+ * 阿里云表格存储(TableStore)是构建在阿里云大规模分布式计算系统之上的海量数据存储与实时查询的服务。 + *

+ */ +public interface SyncClientInterface { + + /** + * 在用户的实例下创建一张新的表。 + *

表被创建后不能立即进行读写操作, 需要等待几秒钟.

+ * + * @param createTableRequest 执行CreateTable所需的参数 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public CreateTableResponse createTable(CreateTableRequest createTableRequest) + throws TableStoreException, ClientException; + + /** + * 在表被创建之后,动态的更改表的配置或预留吞吐量。 + *

例如用户想要调整表的TTL、MaxVersions等配置或者用户发现当前预留吞吐量过小需要上调预留吞吐量。

+ *

UpdateTable操作不能用于更改表的TableMeta,可以调整的配置为:

+ *
    + *
  • 预留吞吐量({@link ReservedThroughput}): + * 表的预留吞吐量可被动态更改,读或写吞吐量都可以分别单独更改。调整每个表读写吞吐量的最小时间间隔为 1 分钟, + * 如果本次 UpdateTable 操作距上次 UpdateTable 或者 CreateTable 操作不到 1 分钟的话该请求将被拒绝。 + *
  • + *
  • 表的配置({@link TableOptions}): + * 只有表的部分配置项可以允许被动态更改,例如TTL、MaxVersions等。 + *
  • + *
+ * UpdateTable操作执行完毕后,会返回表的当前更改之后的预留吞吐量以及配置。 + * + * @param updateTableRequest 执行UpdateTable所需的参数 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public UpdateTableResponse updateTable(UpdateTableRequest updateTableRequest) + throws TableStoreException, ClientException; + + /** + *

获取表的详细信息,表的详细信息包括:

+ *
    + *
  • 表的结构({@link TableMeta})
  • + *
  • 表的预留吞吐量({@link ReservedThroughputDetails})
  • + *
  • 表的配置参数({@link TableOptions})
  • + *
+ * + * @param describeTableRequest 执行DescribeTable所需的参数 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public DescribeTableResponse describeTable(DescribeTableRequest describeTableRequest) + throws TableStoreException, ClientException; + + /** + * 返回用户当前实例下的所有表的列表。 + * + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public ListTableResponse listTable() throws TableStoreException, ClientException; + + /** + * 删除用户指定的某个实例下的一张表。。 + *

注意:表被成功删除后该表下所有的数据都将会被清空,无法恢复,请谨慎操作!

+ * + * @param deleteTableRequest 执行DeleteTable所需的参数 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public DeleteTableResponse deleteTable(DeleteTableRequest deleteTableRequest) + throws TableStoreException, ClientException; + + /** + * 在用户指定的某张表下创建一张索引表 + * + * @param createIndexRequest + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求返回的结果无效,或遇到网络异常 + */ + public CreateIndexResponse createIndex(CreateIndexRequest createIndexRequest) + throws TableStoreException, ClientException; + + /** + * 删除用户指定的某张表下的某张索引表 + *

注意:索引表被成功删除后该索引表下所有的数据都将被清空,无法恢复,请谨慎操作!

+ * + * @param deleteIndexRequest 招待DeleteIndex所需的参数 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public DeleteIndexResponse deleteIndex(DeleteIndexRequest deleteIndexRequest) + throws TableStoreException, ClientException; + + /** + * 读取表中的一行数据。 + * + * @param getRowRequest 执行GetRow操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public GetRowResponse getRow(GetRowRequest getRowRequest) + throws TableStoreException, ClientException; + + /** + * 向表中插入或覆盖一行数据。 + *

若要写入的行已经存在,则旧行会被删除后写入新的一行。

+ *

若要写入的行不存在,则直接写入新的一行。

+ * + * @param putRowRequest 执行PutRow操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public PutRowResponse putRow(PutRowRequest putRowRequest) + throws TableStoreException, ClientException; + + /** + * 更新表中的一行数据。 + *

若要更新的行不存在,则新写入一行数据。

+ *

更新操作可以包括新写入一个属性列或者删除一个属性列的一个或多个版本。

+ * + * @param updateRowRequest 执行UpdateRow操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public UpdateRowResponse updateRow(UpdateRowRequest updateRowRequest) + throws TableStoreException, ClientException; + + /** + * 删除表中的一行数据。 + *

若该行存在,则删除该行。

+ *

若该行不存在,则该操作不产生任何影响。

+ * + * @param deleteRowRequest 执行DeleteRow操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) + throws TableStoreException, ClientException; + + /** + * 从多张表中读取多行数据。 + *

BatchGetRow 操作可视为多个 GetRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。

+ *

与执行大量的 GetRow 操作相比,使用 BatchGetRow 操作可以有效减少请求的响应时间,提高数据的读取速率。

+ *

但需要注意的是 BatchGetRow 只支持在表级别设置查询条件。操作完成后,需要逐个检查子请求的状态,并选择对失败的行进行重试。

+ * + * @param batchGetRowRequest 执行BatchGetRow操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public BatchGetRowResponse batchGetRow(BatchGetRowRequest batchGetRowRequest) + throws TableStoreException, ClientException; + + /** + * 对多张表中对多行执行更新或者删除操作。 + *

BatchWriteRow 操作可视为多个PutRow、UpdateRow、DeleteRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。

+ *

执行 BatchWriteRow 操作后,需要逐个检查子请求的状态,来判断写入结果,并选择对失败的行进行重试。

+ * + * @param batchWriteRowRequest 执行BatchWriteRow操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public BatchWriteRowResponse batchWriteRow(BatchWriteRowRequest batchWriteRowRequest) + throws TableStoreException, ClientException; + + /** + * 从表中查询一个范围内的多行数据。 + * + * @param getRangeRequest 执行GetRange操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public GetRangeResponse getRange(GetRangeRequest getRangeRequest) + throws TableStoreException, ClientException; + + /** + * 对表的数据根据一定的数据大小进行分块,并返回分块的信息以供数据获取接口使用。返回的数据分块按照主键列的递增顺序排列,返回的每个数据分块信息中包含分块所处的partition分区的ID的哈希值以及起始行和终止行的主键值,遵循左闭右开区间。 + * + * @param computeSplitsBySizeRequest 执行ComputeSplitsBySize操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public ComputeSplitsBySizeResponse computeSplitsBySize(ComputeSplitsBySizeRequest computeSplitsBySizeRequest) + throws TableStoreException, ClientException; + + /** + * 以迭代器的形式封装{@link #getRange(GetRangeRequest)}接口。 + * + * @param rangeIteratorParameter 执行createRangeIterator操作所需的参数。 + * @return 行的迭代器 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public Iterator createRangeIterator( + RangeIteratorParameter rangeIteratorParameter) throws TableStoreException, + ClientException; + + public WideColumnIterator createWideColumnIterator(GetRowRequest getRowRequest) throws TableStoreException, + ClientException; + + /** + * 获取用户当前实例下的全部Stream列表或者特定表下的Stream。 + * + * @param listStreamRequest 执行ListStream操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public ListStreamResponse listStream(ListStreamRequest listStreamRequest) + throws TableStoreException, ClientException; + + /** + * 获取指定Stream的详细信息。通过此方法获取Shard列表。 + * + * @param describeStreamRequest 执行DescribeStream操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public DescribeStreamResponse describeStream(DescribeStreamRequest describeStreamRequest) + throws TableStoreException, ClientException; + + /** + * 获取ShardIterator,可通过ShardIterator读取Shard中的数据。 + * + * @param getShardIteratorRequest 执行GetShardIterator操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public GetShardIteratorResponse getShardIterator(GetShardIteratorRequest getShardIteratorRequest) + throws TableStoreException, ClientException; + + /** + * 通过ShardIterator读取Shard中的数据。 + * + * @param getStreamRecordRequest 执行GetStreamRecord操作所需的参数。 + * @return TableStore服务返回的结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public GetStreamRecordResponse getStreamRecord(GetStreamRecordRequest getStreamRecordRequest) + throws TableStoreException, ClientException; + + /** + * 创建SearchIndex + * @param request 创建SearchIndex所需的参数,详见{@link CreateSearchIndexRequest} + * @return SearchIndex服务返回的创建结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public CreateSearchIndexResponse createSearchIndex(CreateSearchIndexRequest request) + throws TableStoreException, ClientException; + + /** + * 获取表下的SearchIndex列表 + *

一个table下面,可以存在多个SearchIndex表,通过该函数,将能够获取一个table下面的所有SearchIndex信息

+ * @param request 获取SearchIndex列表所需的参数 + * @return TableStore指定表下的SearchIndex列表 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public ListSearchIndexResponse listSearchIndex(ListSearchIndexRequest request) + throws TableStoreException, ClientException; + + /** + * 删除SearchIndex + *

通过指定 tableName 和 indexName 即可删除一个index

+ *

提示:在没有删除一个table下面所有的index之前,是不允许删除table的

+ * @param request 删除SearchIndex所需的参数 + * @return 删除SearchIndex服务执行后返回的删除结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public DeleteSearchIndexResponse deleteSearchIndex(DeleteSearchIndexRequest request) + throws TableStoreException, ClientException; + + /** + * 获取一个SearchIndex的信息 + * @param request 获取SearchIndex所需的参数(tableName 和 indexName) + * @return 返回指定index的 schema 和目前的同步状态信息 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public DescribeSearchIndexResponse describeSearchIndex(DescribeSearchIndexRequest request) + throws TableStoreException, ClientException; + + /** + * 搜索功能 + *

构建自己的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); + * + *

+ * @param request 进行搜索所需的参数,详见{@link SearchRequest} + * @return 搜索结果,详见{@link SearchResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public SearchResponse search(SearchRequest request) + throws TableStoreException, ClientException; + + /** + * 开启一个本地事务 + * @param request 启动本地事务操作所需的参数 + * @return + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public StartLocalTransactionResponse startLocalTransaction(StartLocalTransactionRequest request) + throws TableStoreException, ClientException; + + /** + * 提交一个事务 + * @param request 提交事务操作所需的参数 + * @return + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public CommitTransactionResponse commitTransaction(CommitTransactionRequest request) + throws TableStoreException, ClientException; + + /** + * 取消一个事务 + * @param request 取消事务操作所需的参数 + * @return + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + public AbortTransactionResponse abortTransaction(AbortTransactionRequest request) + throws TableStoreException, ClientException; + + /** + * 转换成异步接口的Client。 + * @return 异步接口Client。 + */ + public AsyncClientInterface asAsyncClient(); + + /** + * 释放资源。 + *

请确保在所有请求执行完毕之后释放资源。释放资源之后将不能再发送请求,正在执行的请求可能无法返回结果。

+ */ + public void shutdown(); + + /** + * Switch CredentialsProvider。 + * + * @param newCrdsProvider new CredentialsProvider, see {@link com.alicloud.openservices.tablestore.core.auth.CredentialsProviderFactory}. + */ + public void switchCredentialsProvider(CredentialsProvider newCrdsProvider); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/TableStoreCallback.java b/src/main/java/com/alicloud/openservices/tablestore/TableStoreCallback.java new file mode 100644 index 0000000..d22dfd0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/TableStoreCallback.java @@ -0,0 +1,18 @@ +package com.alicloud.openservices.tablestore; + +public interface TableStoreCallback { + /** + * 当用户的异步操作成功,将调用此方法。 + * + * @param req 用户的请求 + * @param res 用户请求的结果 + */ + public void onCompleted(final Request req, final Response res); + /** + * 当用户的异步操作出错,将调用此方法。 + * + * @param req 用户的请求 + * @param ex 请求的返回结果无效、或遇到网络异常,则为ClientException;TableStore服务返回的异常,则为TableStoreException。 + */ + public void onFailed(final Request req, final Exception ex); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/TableStoreException.java b/src/main/java/com/alicloud/openservices/tablestore/TableStoreException.java new file mode 100755 index 0000000..217ee15 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/TableStoreException.java @@ -0,0 +1,110 @@ +package com.alicloud.openservices.tablestore; + +/** + * {@link TableStoreException} 表示TableStore返回的异常。 + *

RequestId: TableStore为每个请求分配的唯一ID,若需要TableStore开发协助调查慢请求或者失败请求等问题,请提供该ID。

+ *

TraceId: 在SDK内部提供的日志中会追踪某个请求的各个阶段的执行信息,可以通过这个ID来追踪日志排查问题。

+ *

HttpStatus: 本次请求的Http返回码

+ */ + +public class TableStoreException extends RuntimeException { + + private static final long serialVersionUID = 781283289032342L; + + /** + * TableStore返回的错误码。 + */ + private String errorCode; + + /** + * TableStore为每个请求分配的唯一ID,若需要TableStore开发协助调查慢请求或者失败请求等问题,请提供该ID。 + */ + private String requestId; + + /** + * 在SDK内部提供的日志中会追踪某个请求的各个阶段的执行信息,可以通过这个ID来追踪日志排查问题。 + */ + private String traceId; + + /** + * 本次操作的Http返回状态码。 + */ + private int httpStatus; + + /** + * 构造函数。 + * + * @param message 错误消息 + * @param cause 错误原因 + * @param errorCode 错误代码 + * @param requestId RequestId + * @param httpStatus Http状态码 + */ + public TableStoreException(String message, Throwable cause, + String errorCode, + String requestId, int httpStatus) { + super(message, cause); + this.errorCode = errorCode; + this.requestId = requestId; + this.httpStatus = httpStatus; + } + + /** + * 构造函数 + * @param message 错误信息 + * @param errorCode 错误代码 + */ + public TableStoreException(String message, String errorCode) { + super(message); + this.errorCode = errorCode; + } + + /** + * 返回错误代码的字符串表示。 + * + * @return 错误代码的字符串表示。 + */ + public String getErrorCode() { + return errorCode; + } + + /** + * 返回Request标识。 + * + * @return Request标识。 + */ + public String getRequestId() { + return requestId; + } + + /** + * 返回TraceId。 + * + * @return TraceId。 + */ + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + + /** + * 返回Http状态码 + * + * @return Http状态码 + */ + public int getHttpStatus() { + return httpStatus; + } + + @Override + public String toString() { + return "[ErrorCode]:" + errorCode + ", " + + "[Message]:" + getMessage() + ", [RequestId]:" + requestId + + ", [TraceId]:" + traceId + ", [HttpStatus:]" + httpStatus; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/TableStoreWriter.java b/src/main/java/com/alicloud/openservices/tablestore/TableStoreWriter.java new file mode 100644 index 0000000..62fac37 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/TableStoreWriter.java @@ -0,0 +1,144 @@ +package com.alicloud.openservices.tablestore; + +import com.alicloud.openservices.tablestore.model.ConsumedCapacity; +import com.alicloud.openservices.tablestore.model.RowChange; +import com.alicloud.openservices.tablestore.writer.RowWriteResult; +import com.alicloud.openservices.tablestore.writer.WriterConfig; +import com.alicloud.openservices.tablestore.writer.WriterStatistics; + +import java.util.List; + +/** + * TableStore提供了BatchWriteRow接口让用户能够向TableStore批量导入数据,但是在实际使用过程中,BatchWriteRow接口的使用方式对开发者并不友好。例如用户 + * 需要自己计算并控制一次BatchWriteRow的数据量大小,需要关注行大小或者列大小是否超过TableStore的限制,需要对主键去重以及处理单行错误的重试等等。 + * + * TableStoreWriter旨在针对批量数据导入的场景提供一个更加易用的接口,但是不是所有场景均适用TableStoreWriter,在使用之前,请详细了解它的行为,否则会造成数据正确性的问题: + * - TableStoreWriter所有接口保证线程安全。 + * - 调用{@link #addRowChange}接口向TableStoreWriter写入一行返回后,并不代表该行已经写入TableStore,该行会保存在TableStoreWriter的本地缓冲中,等待flush,flush成功后该行才会被写入TableStore。 + * - 向TableStoreWriter写入的行的顺序与最终写入TableStore的行的顺序不保证一致。 + * - 所有通过TableStoreWriter的写入操作,需要使用者保证是幂等的,因为TableStoreWriter内部默认会启用重试,某一行可能会多次写入。 + * - TableStoreWriter对缓冲区的flush时机由两个因素来控制:一个是flushInterval,根据时间定期的进行flush; + * 另一个是{@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxBatchSize},根据缓冲区的数据量来决定是否需要flush。 + * - TableStoreWriter在写入数据时,会自动对导入失败的行进行重试,但是并不保证所有行重试后最终一定能够被写入成功(例如:某一行在写入时加了存在性检查,若已经存在,则永远写不成功)。 + * 此时经过若干次重试后若还有数据无法被写入成功,则这些行会被认为是脏数据,脏数据会通过TableStoreCallback反馈给使用者。 + * - 再向TableStoreWriter写入数据之前,请先注册好Callback,否则若在注册CallBack之前已经有数据写入失败,则失败的行会直接被抛弃。 + * - 程序退出前,需要显式调用{@link #flush}或{@link #close},将还存在缓冲区中的数据进行flush,否则会造成这部分数据丢失。 + * + * TableStoreWriter对批量导入数据的处理流程: + * 1. addRowChange接口是线程安全的,支持用户线程并发的写入 + * 2. 通过addRowChange接口写入的数据会暂存到缓冲区 + * 3. 每个TableStoreWriter会启动一个后台导入线程,缓冲区的数据会由该后台线程进行flush。为提升导入效率,该线程会异步并发发送多个RPC,并发数可以配置。 + * 4. 发送成功或者失败的行都会通过callback反馈给使用者,callback的调用会在另外一个ExecutorService(用户可定制)内执行。 + * + * 用户如何使用TableStoreWriter: + * 1. 初始化TableStoreWriter,可配置RestrictionConfig、缓冲区Queue、Callback ExecutorService等等 + * 2. 调用{@link #addRowChange}并发的向TableStoreWriter中写入数据 + * 3. 若写入完毕,调用{@link #flush}对缓冲区内的数据进行flush + * 4. 调用{@link #close}关闭TableStoreWriter,释放资源 + */ +public interface TableStoreWriter { + /** + * 向本地缓冲区增加一行数据。 + * + * 在写入缓冲区之前,会对该行数据做如下检查: + * - 该行的主键的Schema是否与表定义的相同。 + * - 该行的主键列或属性列的值大小是否超过限制,值的限制配置在{@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxPKColumnSize}和{@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxAttrColumnSize}。 + * - 该行的属性列的个数是否超过{@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxColumnsCount}。 + * - 该行的大小是否超过{@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxBatchSize}。 + * - 属性列中是否有列名与主键列相同。 + * + * 若在写入缓冲区之前被判定为脏数据,该部分数据不会触发CallBack的调用。 + * + * 以上检查会在SDK端带来额外的CPU消耗,但是这些检查是必要的,为了减少不必要的RPC开销,以及避免脏数据污染同一批次Batch写入的行。 + * + * 注意:若缓冲区满,则该操作会被block。 + * + * 若判断该行为脏数据,该接口会抛出{@link com.alicloud.openservices.tablestore.ClientException}。 + * + * @param rowChange 要写入的行 + * @throws com.alicloud.openservices.tablestore.ClientException 若该行被判定为脏数据 + */ + void addRowChange(RowChange rowChange) throws ClientException; + + /** + * Same with {@link #addRowChange(RowChange)}, but it won't be blocked if the buffer is full. + * + * @param rowChange + * @return true if add succeed, return false if the buffer is full. + * @throws ClientException + */ + boolean tryAddRowChange(RowChange rowChange) throws ClientException; + + /** + * 向本地缓冲区批量写入行。 + * + * 批量写入的每一行会做与{@link #addRowChange(RowChange)}一样的检查,若批量写入的行中存在脏数据,则该函数会抛{@link ClientException}, + * 且所有的脏数据会写入dirtyRows。 + + * @param rowChanges 批量写入的行 + * @param dirtyRows 用于传出脏数据的列表 + * @throws ClientException 若存在脏数据 + */ + void addRowChange(List rowChanges, List dirtyRows) throws ClientException; + + /** + * @see #setResultCallback(TableStoreCallback) + * + * @deprecated please change to {@link #setResultCallback(TableStoreCallback)} + */ + void setCallback(TableStoreCallback callback); + + /** + * 设置Callback,数据写入成功或者失败均会通过Callback来反馈。 + * + * 注意:callback会被写入TableStoreWriter的所有行共享,会被并发的调用。 + * 这与{@link com.alicloud.openservices.tablestore.AsyncClientInterface}中每个接口的Callback不同,其callback会与每个请求一一对应,且可以是独立的。 + * 但是这里的Callback是与RowChange对应,且所有RowChange都共享该callback。 + * + * @param callback + */ + void setResultCallback(TableStoreCallback callback); + + /** + * @see #getResultCallback() + * + * @deprecated please change to {@link #getResultCallback()} + */ + TableStoreCallback getCallback(); + + /** + * 获取设置的Callback。 + * + * @return callback + */ + TableStoreCallback getResultCallback(); + + /** + * 获取限制项配置。 + * + * @return 限制项配置 + */ + WriterConfig getWriterConfig(); + + /** + * 获取数据导入期间的统计信息。 + * + * @return 数据导入的统计信息 + */ + WriterStatistics getWriterStatistics(); + + /** + * 主动flush缓冲区中的数据,该函数会等待缓冲区中的所有数据被flush完毕。 + * + * 注意:若在调用flush之后继续向缓冲区中写入数据,flush不会等待这部分新数据的写入,新数据的flush需要重新调用一次flush。 + */ + void flush() throws ClientException; + + /** + * 关闭TableStoreWriter,在关闭之前,会先flush掉缓冲区内的所有数据。 + * + * 注意:若在close过程中或者close之后仍然调用{@link #addRowChange}向缓冲区写入数据,则该部分数据不保证会写入TableStore。 + * addRowChange和close两个操作之间的互斥由调用方来保证,请务必保证在调用close之前,没有任何其他线程会继续使用该writer,否则会有预期外的行为。 + */ + void close(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/TunnelClient.java b/src/main/java/com/alicloud/openservices/tablestore/TunnelClient.java new file mode 100644 index 0000000..937c39d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/TunnelClient.java @@ -0,0 +1,239 @@ +package com.alicloud.openservices.tablestore; + +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelResponse; + +public class TunnelClient implements TunnelClientInterface { + private InternalClient internalClient; + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link TunnelClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + */ + public TunnelClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName) { + ClientConfiguration conf = new ClientConfiguration(); + conf.setEnableResponseValidation(false); + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, conf); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link TunnelClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param stsToken Sts Token. + */ + public TunnelClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, String stsToken) { + ClientConfiguration conf = new ClientConfiguration(); + conf.setEnableResponseValidation(false); + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, conf, null, + stsToken); + } + + /** + * 使用指定的TableStore Endpoint和配置构造一个新的{@link TunnelClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + */ + public TunnelClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, + ClientConfiguration config) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, config, null); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link TunnelClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param stsToken Sts Token. + */ + public TunnelClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, ClientConfiguration config, String stsToken) { + this(endpoint, accessKeyId, accessKeySecret, instanceName, config, stsToken, null); + } + + /** + * 使用指定的TableStore Endpoint和默认配置构造一个新的{@link TunnelClient}实例。 + * + * @param endpoint TableStore服务的endpoint。 + * @param accessKeyId 访问TableStore服务的Access ID。 + * @param accessKeySecret 访问TableStore服务的Access Key。 + * @param instanceName 访问TableStore服务的实例名称。 + * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 + * @param stsToken Sts Token. + * @param callbackExecutor 执行callback的线程池,需要注意的是,client在shutdown的时候也会shutdown这个线程池。 + */ + public TunnelClient(String endpoint, String accessKeyId, + String accessKeySecret, String instanceName, ClientConfiguration config, String stsToken, + ExecutorService callbackExecutor) { + if (config != null) { + config.setEnableResponseValidation(false); + } else { + config = new ClientConfiguration(); + config.setEnableResponseValidation(false); + } + this.internalClient = new InternalClient(endpoint, accessKeyId, accessKeySecret, instanceName, config, + callbackExecutor, stsToken); + } + + TunnelClient(InternalClient internalClient) { + this.internalClient = internalClient; + } + + public void setExtraHeaders(Map extraHeaders) { + this.internalClient.setExtraHeaders(extraHeaders); + } + + /** + * 返回访问的TableStore Endpoint。 + * + * @return TableStore Endpoint。 + */ + public String getEndpoint() { + return this.internalClient.getEndpoint(); + } + + /** + * 返回访问的实例的名称 + * + * @return instance name + */ + public String getInstanceName() { + return this.internalClient.getInstanceName(); + } + + @Override + public CreateTunnelResponse createTunnel(CreateTunnelRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.createTunnel(request, null); + return waitForFuture(resp); + } + + @Override + public ListTunnelResponse listTunnel(ListTunnelRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.listTunnel(request, null); + return waitForFuture(resp); + } + + @Override + public DescribeTunnelResponse describeTunnel(DescribeTunnelRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.describeTunnel(request, null); + return waitForFuture(resp); + } + + @Override + public DeleteTunnelResponse deleteTunnel(DeleteTunnelRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.deleteTunnel(request, null); + return waitForFuture(resp); + } + + @Override + public ConnectTunnelResponse connectTunnel(ConnectTunnelRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.connectTunnel(request, null); + return waitForFuture(resp); + } + + @Override + public HeartbeatResponse heartbeat(HeartbeatRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.heartbeat(request, null); + return waitForFuture(resp); + } + + @Override + public ShutdownTunnelResponse shutdownTunnel(ShutdownTunnelRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.shutdownTunnel(request, null); + return waitForFuture(resp); + } + + @Override + public GetCheckpointResponse getCheckpoint(GetCheckpointRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.getCheckpoint(request, null); + return waitForFuture(resp); + } + + @Override + public ReadRecordsResponse readRecords(ReadRecordsRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.readRecords(request, null); + return waitForFuture(resp); + } + + @Override + public CheckpointResponse checkpoint(CheckpointRequest request) + throws TableStoreException, ClientException { + Preconditions.checkNotNull(request); + Future resp = internalClient.checkpoint(request, null); + return waitForFuture(resp); + } + + private Res waitForFuture(Future f) { + try { + return f.get(); + } catch (InterruptedException e) { + throw new ClientException(String.format( + "The thread was interrupted: %s", e.getMessage())); + } catch (ExecutionException e) { + throw new ClientException("The thread was aborted", e); + } + } + + @Override + public void shutdown() { + this.internalClient.shutdown(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/TunnelClientInterface.java b/src/main/java/com/alicloud/openservices/tablestore/TunnelClientInterface.java new file mode 100644 index 0000000..9f4bbb5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/TunnelClientInterface.java @@ -0,0 +1,138 @@ +package com.alicloud.openservices.tablestore; + +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelResponse; + +public interface TunnelClientInterface { + /** + * 创建一个Tunnel。 + * @param request 创建Tunnel所需的参数,详见{@link CreateTunnelRequest} + * @return 创建Tunnel返回的结果, 详见{@link CreateTunnelResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + CreateTunnelResponse createTunnel(CreateTunnelRequest request) + throws TableStoreException, ClientException; + + /** + * 获取某个表下的Tunnel信息。 + * @param request 列举某张表下的Tunnel所需的参数,详见{@link ListTunnelRequest} + * @return Tunnel的详细信息列表, 详见{@link ListTunnelResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + ListTunnelResponse listTunnel(ListTunnelRequest request) + throws TableStoreException, ClientException; + + /** + * 获取某个Tunnel下的具体信息。 + * @param request 描述某个Tunnel下的详细信息所需的参数,详见{@link DescribeTunnelRequest} + * @return Tunnel下的具体信息,包括Channel信息和RPO信息等,详见{@link DescribeTunnelResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + DescribeTunnelResponse describeTunnel(DescribeTunnelRequest request) + throws TableStoreException, ClientException; + + /** + * 删除一个Tunnel。 + * @param request 删除某个Tunnel所需的参数,详见{@link DeleteTunnelRequest} + * @return 删除Tunnel的结果,详见{@link DeleteTunnelResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + DeleteTunnelResponse deleteTunnel(DeleteTunnelRequest request) + throws TableStoreException, ClientException; + + /** + * 高级接口: 不推荐直接使用,无特殊需求,请优先使用TunnelWorker自动化数据处理框架。 + * 为指定Tunnel分配客户端标识(ClientId), 同时可以传输一些Client的参数给Master,比如client心跳超时时间,client的类型等。 + * @param request 连接某个Tunnel所需的参数,详见{@link ConnectTunnelRequest} + * @return 连接Tunnel的结果,详见{@link ConnectTunnelResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + ConnectTunnelResponse connectTunnel(ConnectTunnelRequest request) + throws TableStoreException, ClientException; + + /** + * 高级接口: 不推荐直接使用,无特殊需求,请优先使用TunnelWorker自动化数据处理框架。 + * Heartbeat操作的作用为(TunnelClient)保持心跳,同时可以获取可以消费的Channel,上报一些处理状态。 + * 当心跳超时后认为TunnelClient下线,需要重新Connect。 + * @param request 探测心跳所需的参数,详见{@link HeartbeatRequest} + * @return 探测心跳的结果,详见{@link HeartbeatResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + HeartbeatResponse heartbeat(HeartbeatRequest request) + throws TableStoreException, ClientException; + + /** + * 高级接口: 不推荐直接使用,无特殊需求,请优先使用TunnelWorker自动化数据处理框架。 + * 关闭某个TunnelClient, 断开与Tunnel的服务端的连接。 + * @param request 关闭TunnelClient所需的参数,详见{@link ShutdownTunnelRequest} + * @return 关闭TunnelClient的结果,详见{@link ShutdownTunnelResponse} + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + ShutdownTunnelResponse shutdownTunnel(ShutdownTunnelRequest request) + throws TableStoreException, ClientException; + + /** + * 高级接口: 不推荐直接使用,无特殊需求,请优先使用TunnelWorker自动化数据处理框架。 + * 获取某个Channel上次记录的Checkpoint和Checkpoint对应的SequenceNumber。 + * @param request 获取某个Channel的Checkpoint所需的参数,详见{@link GetCheckpointRequest} + * @return 某个Channel上次记录的Checkpoint结果 + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + GetCheckpointResponse getCheckpoint(GetCheckpointRequest request) + throws TableStoreException, ClientException; + + /** + * 高级接口: 不推荐直接使用,无特殊需求,请优先使用TunnelWorker自动化数据处理框架。 + * 从某个Channel中读取数据,读取时需要指定Tunnel ID, Client ID, Channel ID和起始Token值。第一次读取时, + * 使用上次记录的Token(Checkpoint)开始读取,之后每次使用返回的NextToken开始读取。 + * @param request 读取某个Channel中的数据, 详见{@link ReadRecordsRequest} + * @return 某个Channel上的数据(全量或增量类型数据) + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + ReadRecordsResponse readRecords(ReadRecordsRequest request) + throws TableStoreException, ClientException; + + /** + * 高级接口: 不推荐直接使用,无特殊需求,请优先使用TunnelWorker自动化数据处理框架。 + * 设置某个Channel的Checkpoint和Checkpoint对应的SequenceNumber。 + * @param request 设置某个Channel上的Checkpoint + * @return + * @throws TableStoreException TableStore服务返回的异常 + * @throws ClientException 请求的返回结果无效、或遇到网络异常 + */ + CheckpointResponse checkpoint(CheckpointRequest request) + throws TableStoreException, ClientException; + + /** + * 释放资源。 + *

请确保在所有请求执行完毕之后释放资源。释放资源之后将不能再发送请求,正在执行的请求可能无法返回结果。

+ */ + void shutdown(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/AbortTransactionLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/AbortTransactionLauncher.java new file mode 100644 index 0000000..69098dd --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/AbortTransactionLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AbortTransactionResponseConsumer; +import com.alicloud.openservices.tablestore.model.*; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; + +public class AbortTransactionLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public AbortTransactionLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + AbortTransactionRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(AbortTransactionRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.AbortTransactionResponse defaultResponse = + OtsInternalApi.AbortTransactionResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildAbortTransactionRequest(req), + tracer, + new AbortTransactionResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/AbstractWatchableCallback.java b/src/main/java/com/alicloud/openservices/tablestore/core/AbstractWatchableCallback.java new file mode 100644 index 0000000..4545096 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/AbstractWatchableCallback.java @@ -0,0 +1,20 @@ +package com.alicloud.openservices.tablestore.core; + +import java.util.List; +import java.util.LinkedList; +import com.alicloud.openservices.tablestore.TableStoreCallback; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +abstract class AbstractWatchableCallback + implements WatchableCallback { + + protected List> downstreams = + new LinkedList>(); + + public AbstractWatchableCallback watchBy(TableStoreCallback downstream) { + Preconditions.checkNotNull(downstream, "downstream must not be null."); + + this.downstreams.add(downstream); + return this; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/AsyncBatchGetRowCompletion.java b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncBatchGetRowCompletion.java new file mode 100644 index 0000000..7cf7080 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncBatchGetRowCompletion.java @@ -0,0 +1,193 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.Error; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; + +public class AsyncBatchGetRowCompletion + extends AsyncCompletion { + + static class PartialRowResult { + Error error; + PrimaryKey primaryKey; + List columns; + ConsumedCapacity consumedCapacity; + byte[] nextToken; + + boolean isComplete() { + return (error != null) || (nextToken == null); + } + } + + BatchGetRowRequest nextRequest; + Map tableToResults; + List requestIds; + + public AsyncBatchGetRowCompletion( + OperationLauncher launcher, + BatchGetRowRequest request, TraceLogger tracer, + ExecutorService callbackExecutor, + RetryStrategy retry, ScheduledExecutorService retryExecutor) + { + super(launcher, request, tracer, callbackExecutor, retry, retryExecutor); + } + + @Override + public void completed(BatchGetRowResponse result) { + result.setTraceId(tracer.getTraceId()); + LogUtil.logOnCompleted(tracer, retry, result.getRequestId()); + tracer.printLog(); + + if (isCompleted(result)) { + // 如果不是第一次请求, 需要与已有的结果合并 + if (nextRequest != null) { + handleResult(result); + onCompleted(request, buildFinalResult()); + } else { + onCompleted(request, result); + } + } else { + handleResult(result); + sendNextRequest(); + } + } + + // 所有成功的行中, 如果有nextToken, 则需要继续发起请求. + boolean isCompleted(BatchGetRowResponse result) { + for (BatchGetRowResponse.RowResult rowResult : result.getSucceedRows()) { + if (rowResult.hasNextToken()) { + return false; + } + } + return true; + } + + void handleConsumedCapacity(ConsumedCapacity base, ConsumedCapacity delta) { + base.getCapacityUnit().setReadCapacityUnit(base.getCapacityUnit().getReadCapacityUnit() + + delta.getCapacityUnit().getReadCapacityUnit()); + base.getCapacityUnit().setWriteCapacityUnit(base.getCapacityUnit().getWriteCapacityUnit() + + delta.getCapacityUnit().getWriteCapacityUnit()); + } + + void handleResult(BatchGetRowResponse result) { + // 处理第一个Result + if (tableToResults == null) { + tableToResults = new ConcurrentHashMap(); + for (Map.Entry> entry : result.getTableToRowsResult().entrySet()) { + PartialRowResult[] partialRowResults = new PartialRowResult[entry.getValue().size()]; + tableToResults.put(entry.getKey(), partialRowResults); + int idx = 0; + for (BatchGetRowResponse.RowResult rowResult : entry.getValue()) { + partialRowResults[idx] = new PartialRowResult(); + if (rowResult.isSucceed()) { + partialRowResults[idx].consumedCapacity = rowResult.getConsumedCapacity(); + if (rowResult.hasNextToken()) { + partialRowResults[idx].nextToken = rowResult.getNextToken(); + } + if (rowResult.getRow() != null) { + partialRowResults[idx].primaryKey = rowResult.getRow().getPrimaryKey(); + partialRowResults[idx].columns = new ArrayList(Arrays.asList(rowResult.getRow().getColumns())); + } + } else { + partialRowResults[idx].error = rowResult.getError(); + } + idx++; + } + } + } else { + for (Map.Entry> entry : result.getTableToRowsResult().entrySet()) { + PartialRowResult[] partialRowResults = tableToResults.get(entry.getKey()); + int idx = 0; + for (BatchGetRowResponse.RowResult rowResult : entry.getValue()) { + while (partialRowResults[idx].isComplete()) { + idx++; + } + if (rowResult.isSucceed()) { + handleConsumedCapacity(partialRowResults[idx].consumedCapacity, rowResult.getConsumedCapacity()); + if (rowResult.hasNextToken()) { + partialRowResults[idx].nextToken = rowResult.getNextToken(); + } else { + partialRowResults[idx].nextToken = null; + } + if (rowResult.getRow() != null) { + try { + if (partialRowResults[idx].primaryKey == null) { + partialRowResults[idx].primaryKey = rowResult.getRow().getPrimaryKey(); + partialRowResults[idx].columns = new ArrayList(); + } + partialRowResults[idx].columns.addAll(Arrays.asList(rowResult.getRow().getColumns())); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } else { + partialRowResults[idx].error = rowResult.getError(); + } + idx++; + } + } + } + if (requestIds == null) { + requestIds = new ArrayList(); + } + requestIds.add(result.getRequestId()); + } + + void buildNextRequest() { + nextRequest = new BatchGetRowRequest(); + for (Map.Entry entry : tableToResults.entrySet()) { + String tableName = entry.getKey(); + PartialRowResult[] partialRowResults = entry.getValue(); + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + for (int i = 0; i < partialRowResults.length; i++) { + if (!partialRowResults[i].isComplete()) { + request.getCriteria(tableName).copyTo(multiRowQueryCriteria); + multiRowQueryCriteria.addRow(request.getPrimaryKey(tableName, i), partialRowResults[i].nextToken); + } + } + if (!multiRowQueryCriteria.isEmpty()) { + nextRequest.addMultiRowQueryCriteria(multiRowQueryCriteria); + } + } + } + + void sendNextRequest() { + buildNextRequest(); + retry = retry.clone(); + launcher.fire(nextRequest, this); + } + + BatchGetRowResponse buildFinalResult() { + BatchGetRowResponse batchGetRowResponse = new BatchGetRowResponse(new Response(requestIds.get(0))); + for (Map.Entry entry : tableToResults.entrySet()) { + String tableName = entry.getKey(); + PartialRowResult[] partialRowResults = entry.getValue(); + for (int i = 0; i < partialRowResults.length; i++) { + Preconditions.checkArgument(partialRowResults[i].isComplete()); + if (partialRowResults[i].error != null) { + BatchGetRowResponse.RowResult rowResult = + new BatchGetRowResponse.RowResult(tableName, partialRowResults[i].error, i); + batchGetRowResponse.addResult(rowResult); + } else { + Row row = null; + if (partialRowResults[i].primaryKey != null) { + row = new Row(partialRowResults[i].primaryKey, partialRowResults[i].columns); + } + BatchGetRowResponse.RowResult rowResult = + new BatchGetRowResponse.RowResult(tableName, row, partialRowResults[i].consumedCapacity, i); + batchGetRowResponse.addResult(rowResult); + } + } + } + return batchGetRowResponse; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/AsyncCompletion.java b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncCompletion.java new file mode 100644 index 0000000..c05f3d0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncCompletion.java @@ -0,0 +1,125 @@ +package com.alicloud.openservices.tablestore.core; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.PartialResultFailedException; +import com.alicloud.openservices.tablestore.TableStoreCallback; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.Request; +import com.alicloud.openservices.tablestore.model.Response; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; + +public class AsyncCompletion + extends AbstractWatchableCallback + implements FutureCallback { + + protected Req request; + protected OperationLauncher launcher; + protected TraceLogger tracer; + protected ExecutorService callbackExecutor; + protected RetryStrategy retry; + protected ScheduledExecutorService retryExecutor; + + public AsyncCompletion( + OperationLauncher launcher, + Req request, TraceLogger tracer, + ExecutorService callbackExecutor, + RetryStrategy retry, ScheduledExecutorService retryExecutor) + { + Preconditions.checkNotNull(launcher, "launcher must not be null."); + Preconditions.checkNotNull(request, "request must not be null."); + Preconditions.checkNotNull(tracer, "tracer must not be null."); + Preconditions.checkNotNull(callbackExecutor, "callbackExecutor must not be null."); + Preconditions.checkNotNull(retry, "retry must not be null."); + Preconditions.checkNotNull(retryExecutor, "retryExecutor must not be null."); + + this.launcher = launcher; + this.request = request; + this.tracer = tracer; + this.callbackExecutor = callbackExecutor; + this.retry = retry.clone(); + this.retryExecutor = retryExecutor; + } + + @Override + public void completed(Res result) { + result.setTraceId(tracer.getTraceId()); + LogUtil.logOnCompleted(tracer, retry, result.getRequestId()); + tracer.printLog(); + onCompleted(request, result); + } + + @Override + public void failed(Exception ex) { + final Exception e; + String requestId = null; + if (ex instanceof TableStoreException) { + e = ex; + requestId = ((TableStoreException) ex).getRequestId(); + ((TableStoreException) e).setTraceId(tracer.getTraceId()); + } else if (ex instanceof ClientException) { + e = ex; + ((ClientException) e).setTraceId(tracer.getTraceId()); + } else { + e = new ClientException("Unexpected error: " + ex, ex, tracer.getTraceId()); + } + long nextPause = retry.nextPause(request.getOperationName(), e); + LogUtil.logOnFailed(tracer, retry, e, requestId, nextPause > 0); + if (nextPause <= 0) { + tracer.printLog(); + if (e instanceof PartialResultFailedException) { + onCompleted(this.request, (Res)((PartialResultFailedException)e).getResult()); + } else { + onFailed(request, e); + } + } else { + final AsyncCompletion self = this; + retryExecutor.schedule( + new Runnable() { + @Override + public void run() { + try { + Req requestForRetry = (Req)launcher.getRequestForRetry(e); + launcher.fire(requestForRetry, self); + } catch(Exception ex) { + failed(new ClientException("Fail to retry.", ex)); + } + } + }, + nextPause, TimeUnit.MILLISECONDS); + } + } + + @Override public void cancelled() { + } + + @Override public void onCompleted(final Req req, final Res res) { + for(final TableStoreCallback cb : downstreams) { + callbackExecutor.submit( + new Runnable() { + @Override + public void run() { + cb.onCompleted(req, res); + } + }); + } + } + + @Override public void onFailed(final Req req, final Exception ex) { + for(final TableStoreCallback cb : downstreams) { + callbackExecutor.submit( + new Runnable() { + @Override + public void run() { + cb.onFailed(req, ex); + } + }); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRangeCompletion.java b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRangeCompletion.java new file mode 100644 index 0000000..9e9d3c0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRangeCompletion.java @@ -0,0 +1,143 @@ +package com.alicloud.openservices.tablestore.core; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; + +public class AsyncGetRangeCompletion + extends AsyncCompletion { + + GetRangeRequest nextRequest; + List completeRows = new ArrayList(); + PrimaryKey nextPrimaryKey; + PrimaryKey lastRowPK; + List lastRowColumns; + CapacityUnit capacityUnit; + List requestIds; + + public AsyncGetRangeCompletion( + OperationLauncher launcher, + GetRangeRequest request, TraceLogger tracer, + ExecutorService callbackExecutor, + RetryStrategy retry, ScheduledExecutorService retryExecutor) + { + super(launcher, request, tracer, callbackExecutor, retry, retryExecutor); + } + + @Override + public void completed(GetRangeResponse result) { + result.setTraceId(tracer.getTraceId()); + LogUtil.logOnCompleted(tracer, retry, result.getRequestId()); + tracer.printLog(); + + // 终止条件: 没有nextToken 或 行数多于1行 + if (!result.hasNextToken() || result.getRows().size() > 1) { + // 如果不是第一次请求, 需要与已有数据合并 + if (nextRequest != null) { + handleResult(result); + onCompleted(request, buildFinalResult()); + } else { + // 如果最后一行不完整, 舍弃最后一行 + if (result.getRows().size() > 1) { + Row lastRow = result.getRows().get(result.getRows().size() - 1); + if (result.hasNextToken() && lastRow.getPrimaryKey().equals(result.getNextStartPrimaryKey())) { + result.getRows().remove(result.getRows().size() - 1); + result.setNextToken(null); + } + } + onCompleted(request, result); + } + } else { + handleResult(result); + sendNextRequest(result.getNextStartPrimaryKey(), result.getNextToken()); + } + } + + void buildNextRequest(PrimaryKey nextStartPrimaryKey, byte[] token) { + if (nextRequest == null) { + RangeRowQueryCriteria originCriteria = request.getRangeRowQueryCriteria(); + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(originCriteria.getTableName()); + rangeRowQueryCriteria.setDirection(originCriteria.getDirection()); + rangeRowQueryCriteria.setLimit(originCriteria.getLimit()); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(originCriteria.getExclusiveEndPrimaryKey()); + originCriteria.copyTo(rangeRowQueryCriteria); + nextRequest = new GetRangeRequest(rangeRowQueryCriteria); + } + nextRequest.getRangeRowQueryCriteria().setInclusiveStartPrimaryKey(nextStartPrimaryKey); + nextRequest.getRangeRowQueryCriteria().setToken(token); + } + + void sendNextRequest(PrimaryKey nextStartPrimaryKey, byte[] token) { + buildNextRequest(nextStartPrimaryKey, token); + retry = retry.clone(); + launcher.fire(nextRequest, this); + } + + void mergeLastRow(Row row, boolean complete) { + Preconditions.checkArgument(lastRowPK != null); + if (row != null) { + lastRowColumns.addAll(Arrays.asList(row.getColumns())); + } + if (complete) { + completeRows.add(new Row(lastRowPK, lastRowColumns)); + lastRowPK = null; + lastRowColumns = new ArrayList(); + } + } + + void handleResult(GetRangeResponse result) { + if (result.getRows().size() > 0) { + List rows = result.getRows(); + // 处理已经存在的不完整的一行 + if (lastRowPK != null) { + if (rows.get(0).getPrimaryKey().equals(lastRowPK)) { + mergeLastRow(rows.get(0), !lastRowPK.equals(result.getNextStartPrimaryKey())); + rows.remove(0); + } else { + mergeLastRow(null, true); + } + } + // 有多余的行时 + if (rows.size() > 0) { + // 增加完整的行 + for (int i = 0; i < rows.size() - 1; i++) { + completeRows.add(rows.get(i)); + } + // 处理最后一行 + PrimaryKey resultLastRowPK = rows.get(rows.size() - 1).getPrimaryKey(); + if (result.hasNextToken() && resultLastRowPK.equals(result.getNextStartPrimaryKey())) { + lastRowPK = resultLastRowPK; + if (lastRowColumns == null) { + lastRowColumns = new ArrayList(); + } + lastRowColumns.addAll(Arrays.asList(rows.get(rows.size() - 1).getColumns())); + } else { + completeRows.add(rows.get(rows.size() - 1)); + } + } + } + nextPrimaryKey = result.getNextStartPrimaryKey(); + if (capacityUnit == null) { + capacityUnit = new CapacityUnit(0, 0); + } + if (requestIds == null) { + requestIds = new ArrayList(); + } + capacityUnit.setReadCapacityUnit(capacityUnit.getReadCapacityUnit() + result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); + capacityUnit.setWriteCapacityUnit(capacityUnit.getWriteCapacityUnit() + result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit()); + requestIds.add(result.getRequestId()); + } + + GetRangeResponse buildFinalResult() { + GetRangeResponse getRangeResponse = new GetRangeResponse(new Response(requestIds.get(0)), new ConsumedCapacity(capacityUnit)); + getRangeResponse.setRows(completeRows); + getRangeResponse.setNextStartPrimaryKey(nextPrimaryKey); + return getRangeResponse; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRowCompletion.java b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRowCompletion.java new file mode 100644 index 0000000..7e2b79b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/AsyncGetRowCompletion.java @@ -0,0 +1,95 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.model.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; + +public class AsyncGetRowCompletion + extends AsyncCompletion { + + GetRowRequest nextRequest; + PrimaryKey primaryKey; + List columns; + CapacityUnit capacityUnit; + List requestIds; + + public AsyncGetRowCompletion( + OperationLauncher launcher, + GetRowRequest request, TraceLogger tracer, + ExecutorService callbackExecutor, + RetryStrategy retry, ScheduledExecutorService retryExecutor) + { + super(launcher, request, tracer, callbackExecutor, retry, retryExecutor); + } + + @Override + public void completed(GetRowResponse result) { + result.setTraceId(tracer.getTraceId()); + LogUtil.logOnCompleted(tracer, retry, result.getRequestId()); + tracer.printLog(); + + // 终止条件: 没有nextToken + if (!result.hasNextToken()) { + // 如果不是第一次请求, 需要与已有数据合并 + if (nextRequest != null) { + handleResult(result); + onCompleted(request, buildFinalResult()); + } else { + onCompleted(request, result); + } + } else { + handleResult(result); + sendNextRequest(result.getNextToken()); + } + } + + void handleResult(GetRowResponse result) { + if (result.getRow() != null) { + if (primaryKey == null) { + primaryKey = result.getRow().getPrimaryKey(); + } + if (columns == null) { + columns = new ArrayList(); + } + columns.addAll(Arrays.asList(result.getRow().getColumns())); + } + if (capacityUnit == null) { + capacityUnit = new CapacityUnit(0, 0); + } + if (requestIds == null) { + requestIds = new ArrayList(); + } + capacityUnit.setReadCapacityUnit(capacityUnit.getReadCapacityUnit() + result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); + capacityUnit.setWriteCapacityUnit(capacityUnit.getWriteCapacityUnit() + result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit()); + requestIds.add(result.getRequestId()); + } + + void buildNextRequest(byte[] token) { + if (nextRequest == null) { + SingleRowQueryCriteria singleRowQueryCriteria = new SingleRowQueryCriteria( + request.getRowQueryCriteria().getTableName(), request.getRowQueryCriteria().getPrimaryKey()); + request.getRowQueryCriteria().copyTo(singleRowQueryCriteria); + nextRequest = new GetRowRequest(singleRowQueryCriteria); + } + nextRequest.getRowQueryCriteria().setToken(token); + } + + void sendNextRequest(byte[] token) { + buildNextRequest(token); + retry = retry.clone(); + launcher.fire(nextRequest, this); + } + + GetRowResponse buildFinalResult() { + Row row = null; + if (primaryKey != null) { + row = new Row(primaryKey, columns); + } + return new GetRowResponse(new Response(this.requestIds.get(0)), row, new ConsumedCapacity(capacityUnit)); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/BatchGetRowLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/BatchGetRowLauncher.java new file mode 100644 index 0000000..72a848c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/BatchGetRowLauncher.java @@ -0,0 +1,74 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.PartialResultFailedException; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.BatchGetRowResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.BatchGetRowRequest; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse; + +public class BatchGetRowLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public BatchGetRowLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + BatchGetRowRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public BatchGetRowRequest getRequestForRetry(Exception e) { + BatchGetRowRequest request = this.originRequest; + if (e instanceof PartialResultFailedException) { + lastResult = (BatchGetRowResponse) ((PartialResultFailedException) e).getResult(); + request = this.originRequest.createRequestForRetry(lastResult.getFailedRows()); + } + return request; + } + + @Override + public void fire(BatchGetRowRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.BatchGetRowResponse defaultResponse = + OtsInternalApi.BatchGetRowResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildBatchGetRowRequest(req.getCriteriasByTable()), + tracer, + new BatchGetRowResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/BatchWriteRowLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/BatchWriteRowLauncher.java new file mode 100644 index 0000000..2053b61 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/BatchWriteRowLauncher.java @@ -0,0 +1,75 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.PartialResultFailedException; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.BatchWriteRowResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.BatchWriteRowRequest; +import com.alicloud.openservices.tablestore.model.BatchWriteRowResponse; + +public class BatchWriteRowLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public BatchWriteRowLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + BatchWriteRowRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public BatchWriteRowRequest getRequestForRetry(Exception e) { + BatchWriteRowRequest request = this.originRequest; + if (e instanceof PartialResultFailedException) { + lastResult = (BatchWriteRowResponse) ((PartialResultFailedException) e).getResult(); + request = this.originRequest.createRequestForRetry( + lastResult.getFailedRows()); + } + return request; + } + + @Override + public void fire(BatchWriteRowRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.BatchWriteRowResponse defaultResponse = + OtsInternalApi.BatchWriteRowResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildBatchWriteRowRequest(req), + tracer, + new BatchWriteRowResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/CallbackImpledFuture.java b/src/main/java/com/alicloud/openservices/tablestore/core/CallbackImpledFuture.java new file mode 100644 index 0000000..60e4483 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/CallbackImpledFuture.java @@ -0,0 +1,119 @@ +package com.alicloud.openservices.tablestore.core; + +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; + +import com.alicloud.openservices.tablestore.TableStoreCallback; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class CallbackImpledFuture + extends AbstractWatchableCallback + implements Future { + private boolean completed; + private Res result; + private Exception ex; + + public CallbackImpledFuture() + { + this.completed = false; + } + + @Override + public void onCompleted(final Req request, final Res result) { + synchronized (this) { + if (this.completed) { + throw new IllegalStateException("completed() must not be invoked twice."); + } + this.completed = true; + this.result = result; + notifyAll(); + } + for(TableStoreCallback downstream : this.downstreams) { + downstream.onCompleted(request, result); + } + } + + @Override + public void onFailed(final Req request, final Exception ex) { + synchronized (this) { + if (this.completed) { + throw new IllegalStateException("completed() must not be invoked twice."); + } + this.completed = true; + this.ex = ex; + notifyAll(); + } + for(TableStoreCallback downstream : this.downstreams) { + downstream.onFailed(request, ex); + } + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + return false; + } + + @Override + public boolean isCancelled() { + return false; + } + + @Override + public boolean isDone() { + synchronized(this) { + return this.completed; + } + } + + @Override + public synchronized Res get() throws InterruptedException, ExecutionException { + while (!this.completed) { + wait(); + } + return getResultWithoutLock(); + } + + @Override + public Res get(long timeout, TimeUnit unit) + throws TimeoutException, InterruptedException, ExecutionException { + Preconditions.checkNotNull(unit, "Time unit should not be null"); + final long endTime = System.currentTimeMillis() + unit.toMillis(timeout); + synchronized(this) { + while(true) { + if (this.completed) { + return getResultWithoutLock(); + } else { + long waitTime = endTime - System.currentTimeMillis(); + if (waitTime <= 0) { + throw new TimeoutException(); + } else { + wait(waitTime); + } + } + } + } + } + + + private Res getResultWithoutLock() throws TableStoreException, ClientException { + if (this.ex instanceof TableStoreException) { + // create a new exception as this.ex doesn't has current stack trace + TableStoreException tmp = (TableStoreException)this.ex; + TableStoreException newExp = new TableStoreException(tmp.getMessage(), tmp, tmp.getErrorCode(), tmp.getRequestId(), tmp.getHttpStatus()); + newExp.setTraceId(tmp.getTraceId()); + throw newExp; + } else if (this.ex instanceof ClientException) { + // create a new exception as this.ex doesn't has current stack trace + throw new ClientException(this.ex.getMessage(), this.ex, ((ClientException) this.ex).getTraceId()); + } else { + return this.result; + } + } + +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/CheckpointLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/CheckpointLauncher.java new file mode 100644 index 0000000..9d24279 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/CheckpointLauncher.java @@ -0,0 +1,61 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.CheckpointResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import org.apache.http.concurrent.FutureCallback; + +public class CheckpointLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public CheckpointLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + CheckpointRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(CheckpointRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.CheckpointResponse defaultResponse = + TunnelServiceApi.CheckpointResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildCheckpointRequest(req), + tracer, + new CheckpointResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/CommitTransactionLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/CommitTransactionLauncher.java new file mode 100644 index 0000000..e5e71f6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/CommitTransactionLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.CommitTransactionResponseConsumer; +import com.alicloud.openservices.tablestore.model.*; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; + +public class CommitTransactionLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public CommitTransactionLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + CommitTransactionRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(CommitTransactionRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.CommitTransactionResponse defaultResponse = + OtsInternalApi.CommitTransactionResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildCommitTransactionRequest(req), + tracer, + new CommitTransactionResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ComputeSplitsBySizeLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ComputeSplitsBySizeLauncher.java new file mode 100644 index 0000000..8e96fd8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ComputeSplitsBySizeLauncher.java @@ -0,0 +1,66 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.ComputeSplitsBySizeResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.GetRangeResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.ComputeSplitsBySizeRequest; +import com.alicloud.openservices.tablestore.model.ComputeSplitsBySizeResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class ComputeSplitsBySizeLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ComputeSplitsBySizeLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ComputeSplitsBySizeRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ComputeSplitsBySizeRequest request, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.ComputeSplitPointsBySizeResponse defaultResponse = + OtsInternalApi.ComputeSplitPointsBySizeResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildComputeSplitsBySizeRequest(request), + tracer, + new ComputeSplitsBySizeResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ConnectTunnelLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ConnectTunnelLauncher.java new file mode 100644 index 0000000..95acdee --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ConnectTunnelLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.ConnectTunnelResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; +import org.apache.http.concurrent.FutureCallback; + +public class ConnectTunnelLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ConnectTunnelLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ConnectTunnelRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ConnectTunnelRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.ConnectResponse defaultResponse = + TunnelServiceApi.ConnectResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildConnectTunnelRequest(req), + tracer, + new ConnectTunnelResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSHTTPConstant.java b/src/main/java/com/alicloud/openservices/tablestore/core/Constants.java old mode 100755 new mode 100644 similarity index 70% rename from src/main/java/com/aliyun/openservices/ots/internal/OTSHTTPConstant.java rename to src/main/java/com/alicloud/openservices/tablestore/core/Constants.java index 6b151e6..3c5ef3e --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSHTTPConstant.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/Constants.java @@ -1,22 +1,27 @@ -package com.aliyun.openservices.ots.internal; +package com.alicloud.openservices.tablestore.core; -public class OTSHTTPConstant { +import java.nio.charset.Charset; + +public class Constants { // request headers + public static final String USER_AGENT = "ots-java-sdk 4.1.0"; public static final String OTS_HEADER_API_VERSION = "x-ots-apiversion"; public static final String OTS_HEADER_ACCESS_KEY_ID = "x-ots-accesskeyid"; - public static final String OTS_HEADER_STS_TOKEN = "x-ots-ststoken"; public static final String OTS_HEADER_OTS_CONTENT_MD5 = "x-ots-contentmd5"; public static final String OTS_HEADER_SIGNATURE = "x-ots-signature"; public static final String OTS_HEADER_INSTANCE_NAME = "x-ots-instancename"; public static final String OTS_HEADER_SDK_TRACE_ID = "x-ots-sdk-traceid"; + public static final String OTS_HEADER_TRACE_THRESHOLD = "x-ots-trace-threshold"; + public static final String OTS_HEADER_DATE = "x-ots-date"; + public static final String OTS_HEADER_STS_TOKEN = "x-ots-ststoken"; // response headers public static final String OTS_HEADER_PREFIX = "x-ots-"; - public static final String OTS_HEADER_DATE = "x-ots-date"; public static final String OTS_HEADER_OTS_CONTENT_TYPE = "x-ots-contenttype"; public static final String OTS_HEADER_AUTHORIZATION = "Authorization"; public static final String OTS_HEADER_REQUEST_ID = "x-ots-requestid"; public static final String OTS_MOVED_PERMANENTLY_LOCATION = "Location"; + public static final String OTS_HEADER_TRACE_INFO = "x-ots-traceinfo"; // request/response compress headers public final static String OTS_HEADER_REQUEST_COMPRESS_TYPE = "x-ots-request-compress-type"; @@ -31,4 +36,15 @@ public class OTSHTTPConstant { public final static int OTS_HTTP_MOVED_PERMANENTLY = 301; public final static int OTS_HTTP_ENTITY_TOO_LARGE = 413; + /** + * OTS RESTful API的版本号。 + */ + public static final String API_VERSION = "2015-12-31"; + + /** + * OTS请求的编码方法。 + */ + public static final String UTF8_ENCODING = "utf-8"; + public static final String HTTP_HEADER_ENCODING = "iso-8859-1"; + public static final Charset UTF8_CHARSET = Charset.forName("UTF-8"); } diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/CreateIndexLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/CreateIndexLauncher.java new file mode 100644 index 0000000..f056213 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/CreateIndexLauncher.java @@ -0,0 +1,65 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.CreateIndexResponseConsumer; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.CreateIndexRequest; +import com.alicloud.openservices.tablestore.model.CreateIndexResponse; + +public class CreateIndexLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public CreateIndexLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + CreateIndexRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(CreateIndexRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.CreateIndexResponse defaultResponse = + OtsInternalApi.CreateIndexResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildCreateIndexRequest(req), + tracer, + new CreateIndexResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/CreateSearchIndexLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/CreateSearchIndexLauncher.java new file mode 100644 index 0000000..9701c71 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/CreateSearchIndexLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.CreateSearchIndexResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.*; +import com.alicloud.openservices.tablestore.model.search.CreateSearchIndexResponse; +import com.alicloud.openservices.tablestore.model.search.CreateSearchIndexRequest; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class CreateSearchIndexLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public CreateSearchIndexLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + CreateSearchIndexRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(CreateSearchIndexRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + Search.CreateSearchIndexResponse defaultResponse = + Search.CreateSearchIndexResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + SearchProtocolBuilder.buildCreateSearchIndexRequest(req), + tracer, + new CreateSearchIndexResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/CreateTableLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/CreateTableLauncher.java new file mode 100644 index 0000000..ba17bbc --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/CreateTableLauncher.java @@ -0,0 +1,65 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.CreateTableResponseConsumer; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.CreateTableRequest; +import com.alicloud.openservices.tablestore.model.CreateTableResponse; + +public class CreateTableLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public CreateTableLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + CreateTableRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(CreateTableRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.CreateTableResponse defaultResponse = + OtsInternalApi.CreateTableResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildCreateTableRequest(req), + tracer, + new CreateTableResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/CreateTunnelLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/CreateTunnelLauncher.java new file mode 100644 index 0000000..085e8ca --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/CreateTunnelLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.CreateTunnelResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import org.apache.http.concurrent.FutureCallback; + +public class CreateTunnelLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public CreateTunnelLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + CreateTunnelRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(CreateTunnelRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.CreateTunnelResponse defaultResponse = + TunnelServiceApi.CreateTunnelResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildCreateTunnelRequest(req), + tracer, + new CreateTunnelResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DeleteIndexLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteIndexLauncher.java new file mode 100644 index 0000000..faf9094 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteIndexLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.model.*; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.DeleteIndexResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; + +public class DeleteIndexLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DeleteIndexLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DeleteIndexRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DeleteIndexRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.DropIndexResponse defaultResponse = + OtsInternalApi.DropIndexResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildDeleteIndexRequest(req), + tracer, + new DeleteIndexResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DeleteRowLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteRowLauncher.java new file mode 100644 index 0000000..b2b88c3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteRowLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.DeleteRowResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.DeleteRowRequest; +import com.alicloud.openservices.tablestore.model.DeleteRowResponse; + +public class DeleteRowLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DeleteRowLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DeleteRowRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DeleteRowRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.DeleteRowResponse defaultResponse = + OtsInternalApi.DeleteRowResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildDeleteRowRequest(req), + tracer, + new DeleteRowResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DeleteSearchIndexLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteSearchIndexLauncher.java new file mode 100644 index 0000000..dcadd54 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteSearchIndexLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.DeleteSearchIndexResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.*; +import com.alicloud.openservices.tablestore.model.search.DeleteSearchIndexRequest; +import com.alicloud.openservices.tablestore.model.search.DeleteSearchIndexResponse; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class DeleteSearchIndexLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DeleteSearchIndexLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DeleteSearchIndexRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DeleteSearchIndexRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + Search.DeleteSearchIndexResponse defaultResponse = + Search.DeleteSearchIndexResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + SearchProtocolBuilder.buildDeleteSearchIndexRequest(req), + tracer, + new DeleteSearchIndexResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DeleteTableLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteTableLauncher.java new file mode 100644 index 0000000..cd6cb03 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteTableLauncher.java @@ -0,0 +1,65 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.DeleteTableResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.DeleteTableRequest; +import com.alicloud.openservices.tablestore.model.DeleteTableResponse; + +public class DeleteTableLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DeleteTableLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DeleteTableRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DeleteTableRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.DeleteTableResponse defaultResponse = + OtsInternalApi.DeleteTableResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildDeleteTableRequest(req), + tracer, + new DeleteTableResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DeleteTunnelLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteTunnelLauncher.java new file mode 100644 index 0000000..9b1652c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DeleteTunnelLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.DeleteTunnelResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import org.apache.http.concurrent.FutureCallback; + +public class DeleteTunnelLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DeleteTunnelLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DeleteTunnelRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DeleteTunnelRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.DeleteTunnelResponse defaultResponse = + TunnelServiceApi.DeleteTunnelResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildDeleteTunnelRequest(req), + tracer, + new DeleteTunnelResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DescribeSearchIndexLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeSearchIndexLauncher.java new file mode 100644 index 0000000..21b7f07 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeSearchIndexLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.DescribeSearchIndexResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.*; +import com.alicloud.openservices.tablestore.model.search.DescribeSearchIndexRequest; +import com.alicloud.openservices.tablestore.model.search.DescribeSearchIndexResponse; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class DescribeSearchIndexLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DescribeSearchIndexLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DescribeSearchIndexRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DescribeSearchIndexRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + Search.DescribeSearchIndexResponse defaultResponse = + Search.DescribeSearchIndexResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + SearchProtocolBuilder.buildDescribeSearchIndexRequest(req), + tracer, + new DescribeSearchIndexResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DescribeStreamLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeStreamLauncher.java new file mode 100644 index 0000000..6692b71 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeStreamLauncher.java @@ -0,0 +1,62 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.DescribeStreamResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.*; +import org.apache.http.concurrent.FutureCallback; + +public class DescribeStreamLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DescribeStreamLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DescribeStreamRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DescribeStreamRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.DescribeStreamResponse defaultResponse = + OtsInternalApi.DescribeStreamResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildDescribeStreamRequest(req), + tracer, + new DescribeStreamResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DescribeTableLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeTableLauncher.java new file mode 100644 index 0000000..8a5e6b3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeTableLauncher.java @@ -0,0 +1,65 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.DescribeTableResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.DescribeTableRequest; +import com.alicloud.openservices.tablestore.model.DescribeTableResponse; + +public class DescribeTableLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DescribeTableLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DescribeTableRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DescribeTableRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.DescribeTableResponse defaultResponse = + OtsInternalApi.DescribeTableResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildDescribeTableRequest(req), + tracer, + new DescribeTableResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/DescribeTunnelLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeTunnelLauncher.java new file mode 100644 index 0000000..6662cb4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/DescribeTunnelLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.DescribeTunnelResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import org.apache.http.concurrent.FutureCallback; + +public class DescribeTunnelLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public DescribeTunnelLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + DescribeTunnelRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(DescribeTunnelRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.DescribeTunnelResponse defaultResponse = + TunnelServiceApi.DescribeTunnelResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildDescribeTunnelRequest(req), + tracer, + new DescribeTunnelResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ErrorCode.java b/src/main/java/com/alicloud/openservices/tablestore/core/ErrorCode.java new file mode 100755 index 0000000..5cdd0c5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ErrorCode.java @@ -0,0 +1,145 @@ +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.core; + +/** + * 表示来自开放结构化数据服务(Open Table Service,OTS)的错误代码。 + */ +public class ErrorCode { + + /** + * 用户身份验证失败。 + */ + public static final String AUTHORIZATION_FAILURE = "OTSAuthFailed"; + + /** + * 服务器内部错误。 + */ + public static final String INTERNAL_SERVER_ERROR = "OTSInternalServerError"; + + /** + * 参数错误。 + */ + public static final String INVALID_PARAMETER = "OTSParameterInvalid"; + + /** + * 整个请求过大。 + */ + public static final String REQUEST_TOO_LARGE = "OTSRequestBodyTooLarge"; + + /** + * 客户端请求超时。 + */ + public static final String REQUEST_TIMEOUT = "OTSRequestTimeout"; + + /** + * 用户的配额已经用满。 + */ + public static final String QUOTA_EXHAUSTED = "OTSQuotaExhausted"; + + /** + * 内部服务器发生failover,导致表的部分分区不可服务。 + */ + public static final String PARTITION_UNAVAILABLE = "OTSPartitionUnavailable"; + + /** + * 表刚被创建还无法立马提供服务。 + */ + public static final String TABLE_NOT_READY = "OTSTableNotReady"; + + /** + * 请求的表不存在。 + */ + public static final String OBJECT_NOT_EXIST = "OTSObjectNotExist"; + + /** + * 请求创建的表已经存在。 + */ + public static final String OBJECT_ALREADY_EXIST = "OTSObjectAlreadyExist"; + + /** + * 多个并发的请求写同一行数据,导致冲突。 + */ + public static final String ROW_OPERATION_CONFLICT = "OTSRowOperationConflict"; + + /** + * 主键不匹配。 + */ + public static final String INVALID_PK = "OTSInvalidPK"; + + /** + * 读写能力调整过于频繁。 + */ + public static final String TOO_FREQUENT_RESERVED_THROUGHPUT_ADJUSTMENT + = "OTSTooFrequentReservedThroughputAdjustment"; + + /** + * 该行总列数超出限制。 + */ + public static final String OUT_OF_COLUMN_COUNT_LIMIT = "OTSOutOfColumnCountLimit"; + + /** + * 该行所有列数据大小总和超出限制。 + */ + public static final String OUT_OF_ROW_SIZE_LIMIT = "OTSOutOfRowSizeLimit"; + + /** + * 剩余预留读写能力不足。 + */ + public static final String NOT_ENOUGH_CAPACITY_UNIT = "OTSNotEnoughCapacityUnit"; + + /** + * 预查条件检查失败。 + */ + public static final String CONDITION_CHECK_FAIL = "OTSConditionCheckFail"; + + /** + * 在OTS内部操作超时。 + */ + public static final String STORAGE_TIMEOUT = "OTSTimeout"; + + /** + * 在OTS内部有服务器不可访问。 + */ + public static final String SERVER_UNAVAILABLE = "OTSServerUnavailable"; + + /** + * OTS内部服务器繁忙。 + */ + public static final String SERVER_BUSY = "OTSServerBusy"; + + /** + * Tunnel资源不可用,比如Heartbeat超时或者Channel版本状态冲突。 + */ + public static final String RESOURCE_GONE = "OTSResourceGone"; + + /** + * Tunnel服务不可用。 + */ + public static final String TUNNEL_SERVER_UNAVAILABLE = "OTSTunnelServerUnavailable"; + + /** + * Tunnel Checkpoint序列号冲突。 + */ + public static final String SEQUENCE_NUMBER_NOT_MATCH = "OTSSequenceNumberNotMatch"; + + /** + * XXX: 用户使用错误。 + */ + public static final String CLIENT_ERROR = "OTSClientError"; + + /** + * 该Tunnel已经过期。 + */ + public static final String TUNNEL_EXPIRED = "OTSTunnelExpired"; + + /** + * 该Tunnel已经存在。 + */ + public static final String TUNNEL_EXIST = "OTSTunnelExist"; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/GetCheckpointLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/GetCheckpointLauncher.java new file mode 100644 index 0000000..4b8400d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/GetCheckpointLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.GetCheckpointResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import org.apache.http.concurrent.FutureCallback; + +public class GetCheckpointLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public GetCheckpointLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + GetCheckpointRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(GetCheckpointRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.GetCheckpointResponse defaultResponse = + TunnelServiceApi.GetCheckpointResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildGetCheckpointRequest(req), + tracer, + new GetCheckpointResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/GetRangeLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/GetRangeLauncher.java new file mode 100644 index 0000000..1d85815 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/GetRangeLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.GetRangeResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.GetRangeRequest; +import com.alicloud.openservices.tablestore.model.GetRangeResponse; + +public class GetRangeLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public GetRangeLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + GetRangeRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(GetRangeRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.GetRangeResponse defaultResponse = + OtsInternalApi.GetRangeResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildGetRangeRequest(req), + tracer, + new GetRangeResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/GetRowLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/GetRowLauncher.java new file mode 100644 index 0000000..d5f03d5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/GetRowLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.GetRowResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.GetRowRequest; +import com.alicloud.openservices.tablestore.model.GetRowResponse; + +public class GetRowLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public GetRowLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + GetRowRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(GetRowRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.GetRowResponse defaultResponse = + OtsInternalApi.GetRowResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildGetRowRequest(req), + tracer, + new GetRowResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/GetShardIteratorLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/GetShardIteratorLauncher.java new file mode 100644 index 0000000..149aa7f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/GetShardIteratorLauncher.java @@ -0,0 +1,64 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.GetShardIteratorResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.GetShardIteratorRequest; +import com.alicloud.openservices.tablestore.model.GetShardIteratorResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import org.apache.http.concurrent.FutureCallback; + +public class GetShardIteratorLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public GetShardIteratorLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + GetShardIteratorRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(GetShardIteratorRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.GetShardIteratorResponse defaultResponse = + OtsInternalApi.GetShardIteratorResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildGetShardIteratorRequest(req), + tracer, + new GetShardIteratorResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/GetStreamRecordLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/GetStreamRecordLauncher.java new file mode 100644 index 0000000..6ba834c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/GetStreamRecordLauncher.java @@ -0,0 +1,62 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.GetStreamRecordResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.GetStreamRecordRequest; +import com.alicloud.openservices.tablestore.model.GetStreamRecordResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import org.apache.http.concurrent.FutureCallback; + +public class GetStreamRecordLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public GetStreamRecordLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + GetStreamRecordRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(GetStreamRecordRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.GetStreamRecordResponse defaultResponse = + OtsInternalApi.GetStreamRecordResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildGetStreamRecordRequest(req), + tracer, + new GetStreamRecordResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/HeartbeatLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/HeartbeatLauncher.java new file mode 100644 index 0000000..a28d9c4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/HeartbeatLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.HeartbeatResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; +import org.apache.http.concurrent.FutureCallback; + +public class HeartbeatLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public HeartbeatLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + HeartbeatRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(HeartbeatRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.HeartbeatResponse defaultResponse = + TunnelServiceApi.HeartbeatResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildHeartbeatRequest(req), + tracer, + new HeartbeatResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/LauncherFactory.java b/src/main/java/com/alicloud/openservices/tablestore/core/LauncherFactory.java new file mode 100644 index 0000000..4b7b3d2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/LauncherFactory.java @@ -0,0 +1,396 @@ +package com.alicloud.openservices.tablestore.core; + +import java.util.Map; +import java.util.HashMap; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.search.*; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; + +import static com.alicloud.openservices.tablestore.model.OperationNames.*; + +public class LauncherFactory { + private Map contexts = new HashMap(); + private String instanceName; + private AsyncServiceClient client; + private CredentialsProvider crdsProvider; + private ClientConfiguration config; + + private class Context { + public OTSUri uri; + + public Context(OTSUri uri) { + this.uri = uri; + } + } + + public void setCredentialsProvider(CredentialsProvider crdsProvider) { + this.crdsProvider = crdsProvider; + } + + public LauncherFactory( + String endpoint, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config) + { + this.instanceName = instanceName; + this.client = client; + this.crdsProvider = crdsProvider; + this.config = config; + + contexts.put(OP_CREATE_TABLE, + new Context(new OTSUri(endpoint, OP_CREATE_TABLE))); + contexts.put(OP_DELETE_TABLE, + new Context(new OTSUri(endpoint, OP_DELETE_TABLE))); + contexts.put(OP_DESCRIBE_TABLE, + new Context(new OTSUri(endpoint, OP_DESCRIBE_TABLE))); + contexts.put(OP_LIST_TABLE, + new Context(new OTSUri(endpoint, OP_LIST_TABLE))); + contexts.put(OP_UPDATE_TABLE, + new Context(new OTSUri(endpoint, OP_UPDATE_TABLE))); + contexts.put(OP_CREATE_INDEX, + new Context(new OTSUri(endpoint, OP_CREATE_INDEX))); + contexts.put(OP_DELETE_INDEX, + new Context(new OTSUri(endpoint, OP_DELETE_INDEX))); + + contexts.put(OP_PUT_ROW, + new Context(new OTSUri(endpoint, OP_PUT_ROW))); + contexts.put(OP_UPDATE_ROW, + new Context(new OTSUri(endpoint, OP_UPDATE_ROW))); + contexts.put(OP_DELETE_ROW, + new Context(new OTSUri(endpoint, OP_DELETE_ROW))); + contexts.put(OP_GET_ROW, + new Context(new OTSUri(endpoint, OP_GET_ROW))); + contexts.put(OP_BATCH_GET_ROW, + new Context(new OTSUri(endpoint, OP_BATCH_GET_ROW))); + contexts.put(OP_BATCH_WRITE_ROW, + new Context(new OTSUri(endpoint, OP_BATCH_WRITE_ROW))); + contexts.put(OP_GET_RANGE, + new Context(new OTSUri(endpoint, OP_GET_RANGE))); + contexts.put(OP_LIST_STREAM, + new Context(new OTSUri(endpoint, OP_LIST_STREAM))); + contexts.put(OP_DESCRIBE_STREAM, + new Context(new OTSUri(endpoint, OP_DESCRIBE_STREAM))); + contexts.put(OP_GET_SHARD_ITERATOR, + new Context(new OTSUri(endpoint, OP_GET_SHARD_ITERATOR))); + contexts.put(OP_GET_STREAM_RECORD, + new Context(new OTSUri(endpoint, OP_GET_STREAM_RECORD))); + contexts.put(OP_COMPUTE_SPLITS_BY_SIZE, + new Context(new OTSUri(endpoint, OP_COMPUTE_SPLITS_BY_SIZE))); + contexts.put(OP_CREATE_SEARCH_INDEX, + new Context(new OTSUri(endpoint, OP_CREATE_SEARCH_INDEX))); + contexts.put(OP_LIST_SEARCH_INDEX, + new Context(new OTSUri(endpoint, OP_LIST_SEARCH_INDEX))); + contexts.put(OP_DELETE_SEARCH_INDEX, + new Context(new OTSUri(endpoint, OP_DELETE_SEARCH_INDEX))); + contexts.put(OP_DESCRIBE_SEARCH_INDEX, + new Context(new OTSUri(endpoint, OP_DESCRIBE_SEARCH_INDEX))); + contexts.put(OP_SEARCH, + new Context(new OTSUri(endpoint, OP_SEARCH))); + contexts.put(OP_START_LOCAL_TRANSACTION, + new Context(new OTSUri(endpoint, OP_START_LOCAL_TRANSACTION))); + contexts.put(OP_COMMIT_TRANSACTION, + new Context(new OTSUri(endpoint, OP_COMMIT_TRANSACTION))); + contexts.put(OP_ABORT_TRANSACTION, + new Context(new OTSUri(endpoint, OP_ABORT_TRANSACTION))); + + contexts.put(OP_CREATE_TUNNEL, + new Context(new OTSUri(endpoint, OP_CREATE_TUNNEL))); + contexts.put(OP_LIST_TUNNEL, + new Context(new OTSUri(endpoint, OP_LIST_TUNNEL))); + contexts.put(OP_DESCRIBE_TUNNEL, + new Context(new OTSUri(endpoint, OP_DESCRIBE_TUNNEL))); + contexts.put(OP_DELETE_TUNNEL, + new Context(new OTSUri(endpoint, OP_DELETE_TUNNEL))); + contexts.put(OP_CONNECT_TUNNEL, + new Context(new OTSUri(endpoint, OP_CONNECT_TUNNEL))); + contexts.put(OP_HEARTBEAT, + new Context(new OTSUri(endpoint, OP_HEARTBEAT))); + contexts.put(OP_SHUTDOWN_TUNNEL, + new Context(new OTSUri(endpoint, OP_SHUTDOWN_TUNNEL))); + contexts.put(OP_GETCHECKPOINT, + new Context(new OTSUri(endpoint, OP_GETCHECKPOINT))); + contexts.put(OP_READRECORDS, + new Context(new OTSUri(endpoint, OP_READRECORDS))); + contexts.put(OP_CHECKPOINT, + new Context(new OTSUri(endpoint, OP_CHECKPOINT))); + } + + public CreateTableLauncher createTable(TraceLogger tracer, RetryStrategy retry, CreateTableRequest originRequest) + { + Context ctx = contexts.get(OP_CREATE_TABLE); + return new CreateTableLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public DeleteTableLauncher deleteTable(TraceLogger tracer, RetryStrategy retry, DeleteTableRequest originRequest) + { + Context ctx = contexts.get(OP_DELETE_TABLE); + return new DeleteTableLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public DescribeTableLauncher describeTable(TraceLogger tracer, RetryStrategy retry, DescribeTableRequest originRequest) + { + Context ctx = contexts.get(OP_DESCRIBE_TABLE); + return new DescribeTableLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ListTableLauncher listTable(TraceLogger tracer, RetryStrategy retry, ListTableRequest originRequest) + { + Context ctx = contexts.get(OP_LIST_TABLE); + return new ListTableLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public UpdateTableLauncher updateTable(TraceLogger tracer, RetryStrategy retry, UpdateTableRequest originRequest) + { + Context ctx = contexts.get(OP_UPDATE_TABLE); + return new UpdateTableLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public CreateIndexLauncher createIndex(TraceLogger tracer, RetryStrategy retry, CreateIndexRequest originRequest) + { + Context ctx = contexts.get(OP_CREATE_INDEX); + return new CreateIndexLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public DeleteIndexLauncher deleteIndex(TraceLogger tracer, RetryStrategy retry, DeleteIndexRequest originRequest) + { + Context ctx = contexts.get(OP_DELETE_INDEX); + return new DeleteIndexLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + + public PutRowLauncher putRow(TraceLogger tracer, RetryStrategy retry, PutRowRequest originRequest) + { + Context ctx = contexts.get(OP_PUT_ROW); + return new PutRowLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + + public UpdateRowLauncher updateRow(TraceLogger tracer, RetryStrategy retry, UpdateRowRequest originRequest) + { + Context ctx = contexts.get(OP_UPDATE_ROW); + return new UpdateRowLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + + public DeleteRowLauncher deleteRow(TraceLogger tracer, RetryStrategy retry, DeleteRowRequest originRequest) + { + Context ctx = contexts.get(OP_DELETE_ROW); + return new DeleteRowLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public GetRowLauncher getRow(TraceLogger tracer, RetryStrategy retry, GetRowRequest originRequest) + { + Context ctx = contexts.get(OP_GET_ROW); + return new GetRowLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public BatchGetRowLauncher batchGetRow(TraceLogger tracer, RetryStrategy retry, BatchGetRowRequest originRequest) + { + Context ctx = contexts.get(OP_BATCH_GET_ROW); + return new BatchGetRowLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public BatchWriteRowLauncher batchWriteRow(TraceLogger tracer, RetryStrategy retry, BatchWriteRowRequest originRequest) + { + Context ctx = contexts.get(OP_BATCH_WRITE_ROW); + return new BatchWriteRowLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public GetRangeLauncher getRange(TraceLogger tracer, RetryStrategy retry, GetRangeRequest originRequest) + { + Context ctx = contexts.get(OP_GET_RANGE); + return new GetRangeLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ComputeSplitsBySizeLauncher computeSplitsBySize(TraceLogger tracer, RetryStrategy retry, + ComputeSplitsBySizeRequest originRequest) { + Context ctx = contexts.get(OP_COMPUTE_SPLITS_BY_SIZE); + return new ComputeSplitsBySizeLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ListStreamLauncher listStream(TraceLogger tracer, RetryStrategy retry, ListStreamRequest originRequest) + { + Context ctx = contexts.get(OP_LIST_STREAM); + return new ListStreamLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public DescribeStreamLauncher describeStream(TraceLogger tracer, RetryStrategy retry, DescribeStreamRequest originRequest) + { + Context ctx = contexts.get(OP_DESCRIBE_STREAM); + return new DescribeStreamLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public GetShardIteratorLauncher getShardIterator(TraceLogger tracer, RetryStrategy retry, GetShardIteratorRequest originRequest) + { + Context ctx = contexts.get(OP_GET_SHARD_ITERATOR); + return new GetShardIteratorLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public GetStreamRecordLauncher getStreamRecord(TraceLogger tracer, RetryStrategy retry, GetStreamRecordRequest originRequest) + { + Context ctx = contexts.get(OP_GET_STREAM_RECORD); + return new GetStreamRecordLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public StartLocalTransactionLauncher startLocalTransaction(TraceLogger tracer, RetryStrategy retry, StartLocalTransactionRequest originRequest) + { + Context ctx = contexts.get(OP_START_LOCAL_TRANSACTION); + return new StartLocalTransactionLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public CommitTransactionLauncher commitTransaction(TraceLogger tracer, RetryStrategy retry, CommitTransactionRequest originRequest) + { + Context ctx = contexts.get(OP_COMMIT_TRANSACTION); + return new CommitTransactionLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public AbortTransactionLauncher abortTransaction(TraceLogger tracer, RetryStrategy retry, AbortTransactionRequest originRequest) + { + Context ctx = contexts.get(OP_ABORT_TRANSACTION); + return new AbortTransactionLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public CreateSearchIndexLauncher createSearchIndex(TraceLogger tracer, RetryStrategy retry, CreateSearchIndexRequest originRequest) + { + Context ctx = contexts.get(OP_CREATE_SEARCH_INDEX); + return new CreateSearchIndexLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ListSearchIndexLauncher listSearchIndex(TraceLogger tracer, RetryStrategy retry, ListSearchIndexRequest originRequest) + { + Context ctx = contexts.get(OP_LIST_SEARCH_INDEX); + return new ListSearchIndexLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public DeleteSearchIndexLauncher deleteSearchIndex(TraceLogger tracer, RetryStrategy retry, DeleteSearchIndexRequest originRequest) + { + Context ctx = contexts.get(OP_DELETE_SEARCH_INDEX); + return new DeleteSearchIndexLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public DescribeSearchIndexLauncher describeSearchIndex(TraceLogger tracer, RetryStrategy retry, DescribeSearchIndexRequest originRequest) + { + Context ctx = contexts.get(OP_DESCRIBE_SEARCH_INDEX); + return new DescribeSearchIndexLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public SearchLauncher search(TraceLogger tracer, RetryStrategy retry, SearchRequest originRequest) + { + Context ctx = contexts.get(OP_SEARCH); + return new SearchLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public CreateTunnelLauncher createTunnel(TraceLogger tracer, RetryStrategy retry, + CreateTunnelRequest originRequest) { + Context ctx = contexts.get(OP_CREATE_TUNNEL); + return new CreateTunnelLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ListTunnelLauncher listTunnel(TraceLogger tracer, RetryStrategy retry, + ListTunnelRequest originRequest) { + Context ctx = contexts.get(OP_LIST_TUNNEL); + return new ListTunnelLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + + public DescribeTunnelLauncher describeTunnel(TraceLogger tracer, RetryStrategy retry, + DescribeTunnelRequest originRequest) { + Context ctx = contexts.get(OP_DESCRIBE_TUNNEL); + return new DescribeTunnelLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public DeleteTunnelLauncher deleteTunnel(TraceLogger tracer, RetryStrategy retry, + DeleteTunnelRequest originRequest) { + Context ctx = contexts.get(OP_DELETE_TUNNEL); + return new DeleteTunnelLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ConnectTunnelLauncher connectTunnel(TraceLogger tracer, RetryStrategy retry, + ConnectTunnelRequest originRequest) { + Context ctx = contexts.get(OP_CONNECT_TUNNEL); + return new ConnectTunnelLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public HeartbeatLauncher heartbeat(TraceLogger tracer, RetryStrategy retry, + HeartbeatRequest originRequest) { + Context ctx = contexts.get(OP_HEARTBEAT); + return new HeartbeatLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ShutdownTunnelLauncher shutdownTunnel(TraceLogger tracer, RetryStrategy retry, + ShutdownTunnelRequest originRequest) { + Context ctx = contexts.get(OP_SHUTDOWN_TUNNEL); + return new ShutdownTunnelLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public GetCheckpointLauncher getCheckpoint(TraceLogger tracer, RetryStrategy retry, + GetCheckpointRequest originRequest) { + Context ctx = contexts.get(OP_GETCHECKPOINT); + return new GetCheckpointLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public ReadRecordsLauncher readRecords(TraceLogger tracer, RetryStrategy retry, + ReadRecordsRequest originRequest) { + Context ctx = contexts.get(OP_READRECORDS); + return new ReadRecordsLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } + + public CheckpointLauncher checkpoint(TraceLogger tracer, RetryStrategy retry, + CheckpointRequest originRequest) { + Context ctx = contexts.get(OP_CHECKPOINT); + return new CheckpointLauncher( + ctx.uri, tracer, retry, instanceName, client, crdsProvider, config, originRequest); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ListSearchIndexLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ListSearchIndexLauncher.java new file mode 100644 index 0000000..9301ee5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ListSearchIndexLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.ListSearchIndexResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.*; +import com.alicloud.openservices.tablestore.model.search.ListSearchIndexRequest; +import com.alicloud.openservices.tablestore.model.search.ListSearchIndexResponse; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class ListSearchIndexLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ListSearchIndexLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ListSearchIndexRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ListSearchIndexRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + Search.ListSearchIndexResponse defaultResponse = + Search.ListSearchIndexResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + SearchProtocolBuilder.buildListSearchIndexRequest(req), + tracer, + new ListSearchIndexResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ListStreamLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ListStreamLauncher.java new file mode 100644 index 0000000..cfa59ff --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ListStreamLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.ListStreamResponseConsumer; +import com.alicloud.openservices.tablestore.model.*; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; + +public class ListStreamLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ListStreamLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ListStreamRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ListStreamRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.ListStreamResponse defaultResponse = + OtsInternalApi.ListStreamResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildListStreamRequest(req), + tracer, + new ListStreamResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ListTableLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ListTableLauncher.java new file mode 100644 index 0000000..42ecf54 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ListTableLauncher.java @@ -0,0 +1,65 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.ListTableResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.ListTableRequest; +import com.alicloud.openservices.tablestore.model.ListTableResponse; + +public class ListTableLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ListTableLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ListTableRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ListTableRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.ListTableResponse defaultResponse = + OtsInternalApi.ListTableResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildListTableRequest(), + tracer, + new ListTableResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ListTunnelLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ListTunnelLauncher.java new file mode 100644 index 0000000..bcf01e9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ListTunnelLauncher.java @@ -0,0 +1,61 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.ListTunnelResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import org.apache.http.concurrent.FutureCallback; + +public class ListTunnelLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ListTunnelLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ListTunnelRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ListTunnelRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.ListTunnelResponse defaultResponse = + TunnelServiceApi.ListTunnelResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildListTunnelRequest(req), + tracer, + new ListTunnelResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/OperationLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/OperationLauncher.java new file mode 100644 index 0000000..824a700 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/OperationLauncher.java @@ -0,0 +1,186 @@ +package com.alicloud.openservices.tablestore.core; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; +import java.util.zip.Deflater; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.google.protobuf.Message; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.concurrent.FutureCallback; +import org.apache.http.entity.ByteArrayEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.TableStoreCallback; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.DateUtil; +import com.alicloud.openservices.tablestore.core.utils.BinaryUtil; +import com.alicloud.openservices.tablestore.core.utils.CompressUtil; +import com.alicloud.openservices.tablestore.core.utils.Base64; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.auth.RequestSigner; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.ExecutionContext; +import com.alicloud.openservices.tablestore.core.http.ResponseConsumer; +import com.alicloud.openservices.tablestore.core.http.RequestMessage; +import com.alicloud.openservices.tablestore.core.http.ErrorResponseHandler; +import com.alicloud.openservices.tablestore.core.http.ContentMD5ResponseHandler; +import com.alicloud.openservices.tablestore.core.http.OTSDeflateResponseHandler; +import com.alicloud.openservices.tablestore.core.http.OTSValidationResponseHandler; +import com.alicloud.openservices.tablestore.model.BatchGetRowRequest; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse; + +import static com.alicloud.openservices.tablestore.core.Constants.*; + +public abstract class OperationLauncher { + private static Logger logger = LoggerFactory.getLogger(OperationLauncher.class); + + private String instanceName; + private AsyncServiceClient client; + private CredentialsProvider crdsProvider; + private ClientConfiguration config; + protected Req originRequest; + protected Res lastResult; + + public OperationLauncher( + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + Req originRequest) + { + Preconditions.checkNotNull(instanceName); + Preconditions.checkNotNull(client); + Preconditions.checkNotNull(crdsProvider); + Preconditions.checkNotNull(config); + + this.instanceName = instanceName; + this.client = client; + this.crdsProvider = crdsProvider; + this.config = config; + this.originRequest = originRequest; + } + + private static ExecutionContext createContext( + OTSUri uri, + String instanceName, + ServiceCredentials credentials, + ClientConfiguration config) + { + ExecutionContext ec = new ExecutionContext(); + ec.setSigner(new RequestSigner(instanceName, credentials)); + + // ResponseHandlers需要按照以下顺序. + ec.getResponseHandlers().add(new OTSDeflateResponseHandler()); + ec.getResponseHandlers().add(new ErrorResponseHandler()); + if (config.isEnableResponseContentMD5Checking()) { + ec.getResponseHandlers().add(new ContentMD5ResponseHandler()); + } + if (config.isEnableResponseValidation()) { + ec.getResponseHandlers().add( + new OTSValidationResponseHandler(credentials, uri)); + } + return ec; + } + + public Req getRequestForRetry(Exception ex) { + return this.originRequest; + } + + public abstract void fire(Req request, FutureCallback cb); + + protected void asyncInvokePost( + OTSUri actionURI, + Map queryParameters, + Message message, + TraceLogger traceLogger, + ResponseConsumer consumer, + FutureCallback callback) + { + URI uri = buildURI(actionURI, queryParameters); + HttpPost request = new HttpPost(uri); + + if (logger.isDebugEnabled()) { + logger.debug("Operation: {}, PBRequestMessage: {}, TraceId: {}", + actionURI, message.toString(), traceLogger.getTraceId()); + } + + byte[] content = message.toByteArray(); + + if (config.isEnableRequestCompression() && content != null && content.length > 0) { + int contentLength = content.length; + try { + content = CompressUtil.compress( + new ByteArrayInputStream(content), + new Deflater()); + request.addHeader(OTS_HEADER_REQUEST_COMPRESS_TYPE, OTS_COMPRESS_TYPE); + request.addHeader( + OTS_HEADER_REQUEST_COMPRESS_SIZE, Integer.toString(contentLength)); + } catch (IOException e) { + throw new ClientException("RequestCompressFail: " + e.getMessage()); + } + } + + if (content == null) { + content = new byte[0]; + } + + request.setEntity(new ByteArrayEntity(content)); + + String contentMd5 = Base64.toBase64String(BinaryUtil.calculateMd5(content)); + + // build a wrapper for HttpRequestBase to store additional information + RequestMessage requestMessage = new RequestMessage(request); + requestMessage.setActionUri(actionURI); + requestMessage.setContentMd5(contentMd5); + requestMessage.setContentLength(content.length); + + addRequiredHeaders(requestMessage, contentMd5, traceLogger.getTraceId()); + + ServiceCredentials credentials = crdsProvider.getCredentials(); + ExecutionContext ctx = createContext( + actionURI, instanceName, credentials, config); + client.asyncSendRequest(requestMessage, ctx, consumer, callback, traceLogger); + } + + private void addRequiredHeaders(RequestMessage request, String contentMd5, String traceId) { + request.addHeader(OTS_HEADER_SDK_TRACE_ID, traceId); + request.addHeader(OTS_HEADER_OTS_CONTENT_MD5, contentMd5); + request.addHeader(OTS_HEADER_API_VERSION, API_VERSION); + request.addHeader(OTS_HEADER_INSTANCE_NAME, instanceName); + request.addHeader(OTS_HEADER_TRACE_THRESHOLD, + Integer.toString(config.getTimeThresholdOfServerTracer())); + request.addHeader(OTS_HEADER_DATE, DateUtil.getCurrentIso8601Date()); + if (config.isEnableResponseCompression()) { + request.addHeader( + OTS_HEADER_RESPONSE_COMPRESS_TYPE, OTS_COMPRESS_TYPE); + } + } + + + private static URI buildURI(OTSUri actionUri, Map queryParameter) { + if (queryParameter == null || queryParameter.isEmpty()) { + return actionUri.getUri(); + } else { + try { + URIBuilder builder = new URIBuilder(actionUri.getUri()); + for (Map.Entry entry : queryParameter.entrySet()) { + builder.addParameter(entry.getKey(), entry.getValue()); + } + return builder.build(); + } catch (URISyntaxException e) { + throw new IllegalArgumentException(e); + } + } + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/PutRowLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/PutRowLauncher.java new file mode 100644 index 0000000..aff80eb --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/PutRowLauncher.java @@ -0,0 +1,64 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.PutRowResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.PutRowRequest; +import com.alicloud.openservices.tablestore.model.PutRowResponse; + +public class PutRowLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public PutRowLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + PutRowRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(PutRowRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.PutRowResponse defaultResponse = + OtsInternalApi.PutRowResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildPutRowRequest(req), + tracer, + new PutRowResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ReadRecordsLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ReadRecordsLauncher.java new file mode 100644 index 0000000..011c2a6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ReadRecordsLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.ReadRecordsResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; +import org.apache.http.concurrent.FutureCallback; + +public class ReadRecordsLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ReadRecordsLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ReadRecordsRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ReadRecordsRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.ReadRecordsResponse defaultResponse = + TunnelServiceApi.ReadRecordsResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildReadRecordsRequest(req), + tracer, + new ReadRecordsResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/model/ResponseContentWithMeta.java b/src/main/java/com/alicloud/openservices/tablestore/core/ResponseContentWithMeta.java similarity index 57% rename from src/main/java/com/aliyun/openservices/ots/internal/model/ResponseContentWithMeta.java rename to src/main/java/com/alicloud/openservices/tablestore/core/ResponseContentWithMeta.java index e5d1f98..2fec99a 100755 --- a/src/main/java/com/aliyun/openservices/ots/internal/model/ResponseContentWithMeta.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ResponseContentWithMeta.java @@ -1,27 +1,30 @@ -package com.aliyun.openservices.ots.internal.model; +package com.alicloud.openservices.tablestore.core; -import com.aliyun.openservices.ots.model.OTSResult; +import com.alicloud.openservices.tablestore.model.Response; import com.google.protobuf.Message; public class ResponseContentWithMeta { Message message; - OTSResult meta; - - public ResponseContentWithMeta(Message message, OTSResult meta) { + Response meta; + + public ResponseContentWithMeta(Message message, Response meta) { this.message = message; this.meta = meta; } - + public Message getMessage() { return message; } + public void setMessage(Message message) { this.message = message; } - public OTSResult getMeta() { + + public Response getMeta() { return meta; } - public void setMeta(OTSResult meta) { + + public void setMeta(Response meta) { this.meta = meta; } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/SearchLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/SearchLauncher.java new file mode 100644 index 0000000..3ab13d5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/SearchLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.SearchResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.*; +import com.alicloud.openservices.tablestore.model.search.SearchRequest; +import com.alicloud.openservices.tablestore.model.search.SearchResponse; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class SearchLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public SearchLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + SearchRequest originRequest) + { + super(instanceName, client,crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(SearchRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + Search.SearchResponse defaultResponse = + Search.SearchResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + SearchProtocolBuilder.buildSearchRequest(req), + tracer, + new SearchResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/ShutdownTunnelLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/ShutdownTunnelLauncher.java new file mode 100644 index 0000000..844615f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/ShutdownTunnelLauncher.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.ShutdownTunnelResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.core.protocol.TunnelProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelResponse; +import org.apache.http.concurrent.FutureCallback; + +public class ShutdownTunnelLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public ShutdownTunnelLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + ShutdownTunnelRequest originRequest) { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(ShutdownTunnelRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + TunnelServiceApi.ShutdownResponse defaultResponse = + TunnelServiceApi.ShutdownResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + TunnelProtocolBuilder.buildShutdownTunnelRequest(req), + tracer, + new ShutdownTunnelResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/StartLocalTransactionLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/StartLocalTransactionLauncher.java new file mode 100644 index 0000000..e1db402 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/StartLocalTransactionLauncher.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import com.alicloud.openservices.tablestore.core.http.StartLocalTransactionResponseConsumer; +import com.alicloud.openservices.tablestore.model.*; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; + +public class StartLocalTransactionLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public StartLocalTransactionLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + StartLocalTransactionRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(StartLocalTransactionRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.StartLocalTransactionResponse defaultResponse = + OtsInternalApi.StartLocalTransactionResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildStartLocalTransactionRequest(req), + tracer, + new StartLocalTransactionResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/TraceLogger.java b/src/main/java/com/alicloud/openservices/tablestore/core/TraceLogger.java new file mode 100644 index 0000000..359461f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/TraceLogger.java @@ -0,0 +1,55 @@ +package com.alicloud.openservices.tablestore.core; + +import java.util.LinkedList; +import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.alicloud.openservices.tablestore.core.utils.Pair; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; + +public class TraceLogger { + private String traceId; + private List> eventTimeRecord; + private List> requestInfoRecord; + private static Logger logger = LoggerFactory.getLogger(TraceLogger.class); + private int timeThreshold; + + public TraceLogger(String traceId, int timeThreshold) { + this.traceId = traceId; + this.timeThreshold = timeThreshold; + this.eventTimeRecord = new LinkedList>(); + this.requestInfoRecord = new LinkedList>(); + } + + public void addRequestInfo(String key, String value) { + this.requestInfoRecord.add(new Pair(key, value)); + } + + public void addEventTime(String event, Long time) { + this.eventTimeRecord.add(new Pair(event, time)); + } + + public void printLog() { + if (logger.isInfoEnabled()) { + long startTime = eventTimeRecord.get(0).getSecond(); + long totalTime = eventTimeRecord.get(eventTimeRecord.size() - 1).getSecond() - startTime; + if (totalTime > timeThreshold) { + StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(LogUtil.TRACE_ID_WITH_COLON + traceId + LogUtil.DELIMITER); + strBuilder.append(LogUtil.TOTAL_TIME_WITH_COLON + totalTime + LogUtil.DELIMITER); + for (Pair pair : requestInfoRecord) { + strBuilder.append(pair + LogUtil.DELIMITER); + } + for (Pair pair : eventTimeRecord) { + strBuilder.append(pair + LogUtil.DELIMITER); + } + logger.info(strBuilder.toString()); + } + } + } + + public String getTraceId() { + return traceId; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/UpdateRowLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/UpdateRowLauncher.java new file mode 100644 index 0000000..ccd6c52 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/UpdateRowLauncher.java @@ -0,0 +1,64 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.UpdateRowResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.UpdateRowRequest; +import com.alicloud.openservices.tablestore.model.UpdateRowResponse; + +public class UpdateRowLauncher extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public UpdateRowLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + UpdateRowRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(UpdateRowRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.UpdateRowResponse defaultResponse = + OtsInternalApi.UpdateRowResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildUpdateRowRequest(req), + tracer, + new UpdateRowResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/UpdateTableLauncher.java b/src/main/java/com/alicloud/openservices/tablestore/core/UpdateTableLauncher.java new file mode 100644 index 0000000..1e99972 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/UpdateTableLauncher.java @@ -0,0 +1,66 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.core.auth.CredentialsProvider; +import org.apache.http.concurrent.FutureCallback; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.OTSUri; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.core.http.UpdateTableResponseConsumer; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.protocol.ResultParserFactory; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.UpdateTableRequest; +import com.alicloud.openservices.tablestore.model.UpdateTableResponse; + +public class UpdateTableLauncher + extends OperationLauncher { + private OTSUri uri; + private TraceLogger tracer; + private RetryStrategy retry; + + public UpdateTableLauncher( + OTSUri uri, + TraceLogger tracer, + RetryStrategy retry, + String instanceName, + AsyncServiceClient client, + CredentialsProvider crdsProvider, + ClientConfiguration config, + UpdateTableRequest originRequest) + { + super(instanceName, client, crdsProvider, config, originRequest); + + Preconditions.checkNotNull(uri); + Preconditions.checkNotNull(tracer); + Preconditions.checkNotNull(retry); + + this.uri = uri; + this.tracer = tracer; + this.retry = retry; + } + + @Override + public void fire(UpdateTableRequest req, FutureCallback cb) { + LogUtil.logBeforeExecution(tracer, retry); + + OtsInternalApi.UpdateTableResponse defaultResponse = + OtsInternalApi.UpdateTableResponse.getDefaultInstance(); + asyncInvokePost( + uri, + null, + OTSProtocolBuilder.buildUpdateTableRequest(req), + tracer, + new UpdateTableResponseConsumer( + ResultParserFactory.createFactory().createProtocolBufferResultParser( + defaultResponse, tracer.getTraceId()), + tracer, retry, lastResult), + cb); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/WatchableCallback.java b/src/main/java/com/alicloud/openservices/tablestore/core/WatchableCallback.java new file mode 100644 index 0000000..cd9cbae --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/WatchableCallback.java @@ -0,0 +1,8 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.TableStoreCallback; + +public interface WatchableCallback + extends TableStoreCallback { + public WatchableCallback watchBy(TableStoreCallback watcher); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/AuthUtils.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/AuthUtils.java new file mode 100644 index 0000000..4447724 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/AuthUtils.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import java.io.*; + +public class AuthUtils { + + /** + * Default expiration time + */ + public static final int DEFAULT_EXPIRED_DURATION_SECONDS = 3600; + + /** + * Default expiration time adjustment factor + */ + public static final double DEFAULT_EXPIRED_FACTOR = 0.8; + + /** + * The maximum number of retries when getting AK/SK from ECS + */ + public static final int MAX_ECS_METADATA_FETCH_RETRY_TIMES = 3; + + /** + * AK/SK expiration time obtained from ECS Metadata Service, default 6 hours + */ + public static final int DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS = 3600 * 6; + + /** + * AK/SK expire time obtained from STS, default 1 hour + */ + public static final int DEFAULT_STS_SESSION_TOKEN_DURATION_SECONDS = 3600 * 1; + + /** + * Connection timeout when getting AK/SK, the default 5 seconds + */ + public static final int DEFAULT_HTTP_SOCKET_TIMEOUT_IN_MILLISECONDS = 5000; + + /** + * Environment variable name for the tablestore access key ID + */ + public static final String ACCESS_KEY_ENV_VAR = "TABLESTORE_ACCESS_KEY_ID"; + + /** + * Environment variable name for the tablestore secret key + */ + public static final String SECRET_KEY_ENV_VAR = "TABLESTORE_ACCESS_KEY_SECRET"; + + /** + * Environment variable name for the tablestore session token + */ + public static final String SESSION_TOKEN_ENV_VAR = "TABLESTORE_SESSION_TOKEN"; + + /** + * System property used when starting up the JVM to enable the default + * metrics collected by the TableStore SDK. + * + *
+     * Example: -Dtablestore.accessKeyId
+     * 
+ */ + /** System property name for the TableStore access key ID */ + public static final String ACCESS_KEY_SYSTEM_PROPERTY = "tablestore.accessKeyId"; + + /** System property name for the TableStore secret key */ + public static final String SECRET_KEY_SYSTEM_PROPERTY = "tablestore.accessKeySecret"; + + /** System property name for the TableStore session token */ + public static final String SESSION_TOKEN_SYSTEM_PROPERTY = "tablestore.sessionToken"; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/BasicCredentials.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/BasicCredentials.java new file mode 100644 index 0000000..d32b5d7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/BasicCredentials.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +public class BasicCredentials implements ServiceCredentials { + + public BasicCredentials(String accessKeyId, String accessKeySecret, String securityToken) { + this(accessKeyId, accessKeySecret, securityToken, 0); + } + + public BasicCredentials(String accessKeyId, String accessKeySecret, String securityToken, + long expiredDurationSeconds) { + this.accessKeyId = accessKeyId; + this.accessKeySecret = accessKeySecret; + this.securityToken = securityToken; + this.expiredDurationSeconds = expiredDurationSeconds; + this.startedTimeInMilliSeconds = System.currentTimeMillis(); + } + + public BasicCredentials withExpiredFactor(double expiredFactor) { + this.expiredFactor = expiredFactor; + return this; + } + + public BasicCredentials withExpiredDuration(long expiredDurationSeconds) { + this.expiredDurationSeconds = expiredDurationSeconds; + return this; + } + + @Override + public String getAccessKeyId() { + return accessKeyId; + } + + @Override + public String getAccessKeySecret() { + return accessKeySecret; + } + + @Override + public String getSecurityToken() { + return securityToken; + } + + public boolean willSoonExpire() { + if (expiredDurationSeconds == 0) { + return false; + } + long now = System.currentTimeMillis(); + return expiredDurationSeconds * expiredFactor < (now - startedTimeInMilliSeconds) / 1000.0; + } + + protected String accessKeyId; + protected String accessKeySecret; + protected String securityToken; + + protected long expiredDurationSeconds; + protected long startedTimeInMilliSeconds = 0; + protected double expiredFactor = AuthUtils.DEFAULT_EXPIRED_FACTOR; + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsFetcher.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsFetcher.java new file mode 100644 index 0000000..d3108e9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsFetcher.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.HttpRequest; +import com.alicloud.openservices.tablestore.core.utils.HttpResponse; + +import java.io.IOException; +import java.net.URL; + +public interface CredentialsFetcher { + + /** + * 构造授权服务器的URL + * + * @return the url of authorization server + * @throws ClientException + */ + public URL buildUrl() throws ClientException; + + /** + * 发送HTTP请求到授权服务器 + * + * @param request + * HTTP请求 + * @return http response + * @throws IOException + */ + public HttpResponse send(HttpRequest request) throws IOException; + + /** + * 解析授权服务器返回的授权信息,解析为Credentials + * + * @param response + * 授权服务器返回的授权信息 + * @return + * @throws ClientException + */ + public ServiceCredentials parse(HttpResponse response) throws ClientException; + + /** + * 从授权服务器获取授权 + * + * @return credentials + * @throws ClientException + */ + public ServiceCredentials fetch() throws ClientException; + + /** + * 从授权服务器获取授权 + * + * @param retryTimes + * 失败重试此时 + * @return credentials + * @throws ClientException + */ + public ServiceCredentials fetch(int retryTimes) throws ClientException; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProvider.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProvider.java new file mode 100644 index 0000000..6573de9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProvider.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +/** + * Abstract credentials provider that maintains only one user credentials. Users + * can switch to other valid credentials with + * @todo {@link com.alicloud.openservices.tablestore.SyncClient#switchCredentialsProvider(CredentialsProvider)} Note + * that implementations of this interface must be thread-safe. + */ +public interface CredentialsProvider { + + public void setCredentials(ServiceCredentials creds); + + public ServiceCredentials getCredentials(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProviderFactory.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProviderFactory.java new file mode 100644 index 0000000..9600b46 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/CredentialsProviderFactory.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; + +/** + * Credentials provider factory to share providers across potentially many + * clients. + */ +public class CredentialsProviderFactory { + + /** + * Create an instance of DefaultCredentialProvider. + * + * @param accessKeyId + * Access Key ID. + * @param secretAccessKey + * Secret Access Key. + * @return A {@link DefaultCredentialProvider} instance. + */ + public static DefaultCredentialProvider newDefaultCredentialProvider(String accessKeyId, String secretAccessKey) { + return new DefaultCredentialProvider(accessKeyId, secretAccessKey); + } + + /** + * Create an instance of DefaultCredentialProvider. + * + * @param accessKeyId + * Access Key ID. + * @param secretAccessKey + * Secret Access Key. + * @param securityToken + * Security Token from STS. + * @return A {@link DefaultCredentialProvider} instance. + */ + public static DefaultCredentialProvider newDefaultCredentialProvider(String accessKeyId, String secretAccessKey, + String securityToken) { + return new DefaultCredentialProvider(accessKeyId, secretAccessKey, securityToken); + } + + /** + * Create an instance of EnvironmentVariableCredentialsProvider by reading + * the environment variable to obtain the ak/sk, such as TABLESTORE_ACCESS_KEY_ID + * and TABLESTORE_ACCESS_KEY_SECRET + * + * @return A {@link EnvironmentVariableCredentialsProvider} instance. + * @throws ClientException + * TableStore Client side exception. + */ + public static EnvironmentVariableCredentialsProvider newEnvironmentVariableCredentialsProvider() + throws ClientException { + return new EnvironmentVariableCredentialsProvider(); + } + + /** + * Create an instance of EnvironmentVariableCredentialsProvider by reading + * the java system property used when starting up the JVM to enable the + * default metrics collected by the TableStore SDK, such as -Dtablestore.accessKeyId and + * -Dtablestore.accessKeySecret. + * + * @return A {@link SystemPropertiesCredentialsProvider} instance. + * @throws ClientException + * TableStore Client side exception. + */ + public static SystemPropertiesCredentialsProvider newSystemPropertiesCredentialsProvider() throws ClientException { + return new SystemPropertiesCredentialsProvider(); + } + + /** + * Create an instance of InstanceProfileCredentialsProvider obtained the + * ak/sk by ECS Metadata Service. + * + * @param roleName + * Role name of the ECS binding, NOT ROLE ARN. + * @return A {@link InstanceProfileCredentialsProvider} instance. + * @throws ClientException + * TableSTore Client side exception. + */ + public static InstanceProfileCredentialsProvider newInstanceProfileCredentialsProvider(String roleName) + throws ClientException { + return new InstanceProfileCredentialsProvider(roleName); + } +} \ No newline at end of file diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentialProvider.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentialProvider.java new file mode 100644 index 0000000..2f29af2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentialProvider.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +/** + * Default implementation of {@link CredentialsProvider}. + */ +public class DefaultCredentialProvider implements CredentialsProvider { + + private volatile ServiceCredentials creds; + + public DefaultCredentialProvider(ServiceCredentials creds) { + setCredentials(creds); + } + + public DefaultCredentialProvider(String accessKeyId, String secretAccessKey) { + this(accessKeyId, secretAccessKey, null); + } + + public DefaultCredentialProvider(String accessKeyId, String secretAccessKey, String securityToken) { + checkCredentials(accessKeyId, secretAccessKey); + setCredentials(new DefaultCredentials(accessKeyId, secretAccessKey, securityToken)); + } + + @Override + public synchronized void setCredentials(ServiceCredentials creds) { + if (creds == null) { + throw new InvalidCredentialsException("creds should not be null."); + } + + checkCredentials(creds.getAccessKeyId(), creds.getAccessKeySecret()); + this.creds = creds; + } + + @Override + public ServiceCredentials getCredentials() { + if (this.creds == null) { + throw new InvalidCredentialsException("Invalid credentials"); + } + + return this.creds; + } + + private static void checkCredentials(String accessKeyId, String secretAccessKey) { + if (accessKeyId == null || accessKeyId.equals("")) { + throw new InvalidCredentialsException("Access key id should not be null or empty."); + } + + if (secretAccessKey == null || secretAccessKey.equals("")) { + throw new InvalidCredentialsException("Access key secret should not be null or empty."); + } + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentials.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentials.java new file mode 100644 index 0000000..f80dfa5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/DefaultCredentials.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +/** + * Default implementation of {@link ServiceCredentials}. + */ +public class DefaultCredentials implements ServiceCredentials { + + private final String accessKeyId; + private final String secretAccessKey; + private final String securityToken; + + public DefaultCredentials(String accessKeyId, String secretAccessKey) { + this(accessKeyId, secretAccessKey, null); + } + + public DefaultCredentials(String accessKeyId, String secretAccessKey, String securityToken) { + if (accessKeyId == null || accessKeyId.equals("")) { + throw new InvalidCredentialsException("Access key id should not be null or empty."); + } + if (secretAccessKey == null || accessKeyId.equals("")) { + throw new InvalidCredentialsException("Secret access key should not be null or empty."); + } + + this.accessKeyId = accessKeyId; + this.secretAccessKey = secretAccessKey; + this.securityToken = securityToken; + } + + @Override + public String getAccessKeyId() { + return accessKeyId; + } + + @Override + public String getAccessKeySecret() { + return secretAccessKey; + } + + @Override + public String getSecurityToken() { + return securityToken; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/EnvironmentVariableCredentialsProvider.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/EnvironmentVariableCredentialsProvider.java new file mode 100644 index 0000000..acc9918 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/EnvironmentVariableCredentialsProvider.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.core.utils.StringUtils; + +/** + * {@link EnvironmentVariableCredentialsProvider} implementation that provides + * credentials by looking at the: TABLESTORE_ACCESS_KEY_ID and + * TABLESTORE_ACCESS_KEY_SECRET environment variables. + */ +public class EnvironmentVariableCredentialsProvider implements CredentialsProvider { + + @Override + public void setCredentials(ServiceCredentials creds) { + + } + + @Override + public ServiceCredentials getCredentials() { + String accessKeyId = StringUtils.trim(System.getenv(AuthUtils.ACCESS_KEY_ENV_VAR)); + String secretAccessKey = StringUtils.trim(System.getenv(AuthUtils.SECRET_KEY_ENV_VAR)); + String sessionToken = StringUtils.trim(System.getenv(AuthUtils.SESSION_TOKEN_ENV_VAR)); + + if (accessKeyId == null || accessKeyId.equals("")) { + throw new InvalidCredentialsException("Access key id should not be null or empty."); + } + if (secretAccessKey == null || secretAccessKey.equals("")) { + throw new InvalidCredentialsException("Secret access key should not be null or empty."); + } + + return new DefaultCredentials(accessKeyId, secretAccessKey, sessionToken); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/HmacSHA1Signature.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/HmacSHA1Signature.java new file mode 100755 index 0000000..03979f4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/HmacSHA1Signature.java @@ -0,0 +1,66 @@ +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.core.utils.Base64; +import com.alicloud.openservices.tablestore.core.utils.Bytes; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +public class HmacSHA1Signature implements ServiceSignature { + private static final String ALGORITHM = "HmacSHA1"; // Signature method. + private static final Object LOCK = new Object(); + private static Mac macInstance; // Prototype of the Mac instance. + + private Mac mac; + + public String getAlgorithm() { + return ALGORITHM; + } + + public HmacSHA1Signature(byte[] key) { + try { + // Because Mac.getInstance(String) calls a synchronized method, + // it could block on invoked concurrently. + // SO use prototype pattern to improve performance. + if (macInstance == null) { + synchronized (LOCK) { + if (macInstance == null) { + macInstance = Mac.getInstance(ALGORITHM); + } + } + } + + try { + mac = (Mac) macInstance.clone(); + } catch (CloneNotSupportedException e) { + // If it is not cloneable, create a new DefaultSigner + mac = Mac.getInstance(ALGORITHM); + } + mac.init(new SecretKeySpec(key, ALGORITHM)); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException("Unsupported algorithm: " + ALGORITHM, ex); + } catch (InvalidKeyException ex) { + throw new RuntimeException(ex); + } + } + + public void updateUTF8String(String data) { + update(Bytes.toBytes(data)); + } + + public void update(byte[] data) { + mac.update(data); + } + + @Override + public void update(byte data) { + mac.update(data); + } + + public String computeSignature() { + byte[] signature = mac.doFinal(); + return Base64.toBase64String(signature); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/HttpCredentialsFetcher.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/HttpCredentialsFetcher.java new file mode 100644 index 0000000..af4b54d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/HttpCredentialsFetcher.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.HttpRequest; +import com.alicloud.openservices.tablestore.core.utils.HttpResponse; +import com.alicloud.openservices.tablestore.core.utils.MethodType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; + +public abstract class HttpCredentialsFetcher implements CredentialsFetcher { + private static Logger logger = LoggerFactory.getLogger(HttpCredentialsFetcher.class); + + public abstract URL buildUrl() throws ClientException; + + public abstract ServiceCredentials parse(HttpResponse response) throws ClientException; + + @Override + public ServiceCredentials fetch() throws ClientException { + URL url = buildUrl(); + HttpRequest request = new HttpRequest(url.toString()); + request.setMethod(MethodType.GET); + request.setConnectTimeout(AuthUtils.DEFAULT_HTTP_SOCKET_TIMEOUT_IN_MILLISECONDS); + request.setReadTimeout(AuthUtils.DEFAULT_HTTP_SOCKET_TIMEOUT_IN_MILLISECONDS); + + HttpResponse response = null; + try { + response = send(request); + } catch (IOException e) { + logger.error("CredentialsFetcher.fetch failed.", e); + throw new ClientException("CredentialsFetcher.fetch exception: " + e); + } + + return parse(response); + } + + @Override + public HttpResponse send(HttpRequest request) throws IOException { + HttpResponse response = HttpResponse.getResponse(request); + if (response.getStatus() != HttpURLConnection.HTTP_OK) { + throw new IOException("HttpCode=" + response.getStatus()); + } + return response; + } + + @Override + public ServiceCredentials fetch(int retryTimes) throws ClientException { + for (int i = 1; i <= retryTimes; i++) { + try { + return fetch(); + } catch (Exception e) { + if (i == retryTimes) { + throw new ClientException(e); + } + + // simple retry strategy + try { + Thread.sleep(retryTimes * 100); + } catch (InterruptedException ie) { + } + } + } + + logger.error("Failed to connect ECS Metadata Service after retry '{}' times.", retryTimes); + throw new ClientException("Failed to connect ECS Metadata Service: Max retry times exceeded."); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentials.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentials.java new file mode 100644 index 0000000..8f80287 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentials.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +public class InstanceProfileCredentials extends BasicCredentials { + + public InstanceProfileCredentials(String accessKeyId, String accessKeySecret, String sessionToken, String expiration) { + super(accessKeyId, accessKeySecret, sessionToken, AuthUtils.DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS); + + // sample of expiration string: 2013-09-29T18:46:19Z + SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + parser.setTimeZone(TimeZone.getTimeZone("GMT")); + try { + Date date = parser.parse(expiration); + this.expirationInMilliseconds = date.getTime(); + } catch (ParseException e) { + throw new IllegalArgumentException("Failed to get valid expiration time from ECS Metadata service."); + } + } + + public InstanceProfileCredentials withExpiredFactor(double expiredFactor) { + this.expiredFactor = expiredFactor; + return this; + } + + public InstanceProfileCredentials withExpiredDuration(long expiredDurationSeconds) { + this.expiredDurationSeconds = expiredDurationSeconds; + return this; + } + + public InstanceProfileCredentials withRefreshIntervalInMilliseconds(long refreshIntervalInMilliseconds) { + this.refreshIntervalInMilliseconds = refreshIntervalInMilliseconds; + return this; + } + + @Override + public boolean willSoonExpire() { + long now = System.currentTimeMillis(); + return expiredDurationSeconds * (1.0 - expiredFactor) > (expirationInMilliseconds - now) / 1000.0; + } + + public boolean isExpired() { + long now = System.currentTimeMillis(); + return now >= expirationInMilliseconds - refreshIntervalInMilliseconds; + } + + public boolean shouldRefresh() { + long now = System.currentTimeMillis(); + if (now - lastFailedRefreshTime > refreshIntervalInMilliseconds) { + return true; + } else { + return false; + } + } + + public void setLastFailedRefreshTime() { + lastFailedRefreshTime = System.currentTimeMillis(); + } + + private final long expirationInMilliseconds; + private long refreshIntervalInMilliseconds = 10000; + private long lastFailedRefreshTime = 0; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsFetcher.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsFetcher.java new file mode 100644 index 0000000..5afcd84 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsFetcher.java @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.HttpResponse; +import com.google.gson.Gson; +import com.google.gson.annotations.SerializedName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.MalformedURLException; +import java.net.URL; + +public class InstanceProfileCredentialsFetcher extends HttpCredentialsFetcher { + + private Logger logger = LoggerFactory.getLogger(InstanceProfileCredentialsFetcher.class); + + public InstanceProfileCredentialsFetcher() { + } + + public void setRoleName(String roleName) { + if (null == roleName || roleName.isEmpty()) { + throw new IllegalArgumentException("You must specifiy a valid role name."); + } + this.roleName = roleName; + } + + public InstanceProfileCredentialsFetcher withRoleName(String roleName) { + setRoleName(roleName); + return this; + } + + @Override + public URL buildUrl() throws ClientException { + try { + return new URL("http://" + metadataServiceHost + URL_IN_ECS_METADATA + roleName); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(e.toString()); + } + } + + private static class MetadataResponse { + @SerializedName("Code") + String code; + + @SerializedName("AccessKeyId") + String accessKeyId; + + @SerializedName("AccessKeySecret") + String accessKeySecret; + + @SerializedName("SecurityToken") + String securityToken; + + @SerializedName("Expiration") + String expiration; + } + + @Override + public ServiceCredentials parse(HttpResponse response) throws ClientException { + String jsonContent = new String(response.getHttpContent()); + + try { + MetadataResponse res = new Gson().fromJson(jsonContent, MetadataResponse.class); + if (res == null) { + logger.error("Invalid response form ECS Metadata service: {}.", jsonContent); + throw new ClientException("Invalid json got from ECS Metadata service."); + } + + if (!(res.code != null && res.accessKeyId != null && res.accessKeySecret != null + && res.securityToken != null && res.expiration != null)) { + logger.error("Invalid response form ECS Metadata service: {}.", jsonContent); + throw new ClientException("Invalid json got from ECS Metadata service."); + } + + if (!"Success".equalsIgnoreCase(res.code)) { + logger.error("Failed to get RAM session credentials from ECS Metadata service: {}.", jsonContent); + throw new ClientException("Failed to get RAM session credentials from ECS metadata service."); + } + + return new InstanceProfileCredentials(res.accessKeyId, res.accessKeySecret, res.securityToken, res.expiration); + } catch (Exception e) { + throw new ClientException("InstanceProfileCredentialsFetcher.parse [" + jsonContent + "] exception:", e); + } + } + + private static final String URL_IN_ECS_METADATA = "/latest/meta-data/ram/security-credentials/"; + private static final String metadataServiceHost = "100.100.100.200"; + + private String roleName; + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsProvider.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsProvider.java new file mode 100644 index 0000000..859adca --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InstanceProfileCredentialsProvider.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Credentials provider implementation that loads credentials from the Ali Cloud + * ECS Instance Metadata Service. + */ +public class InstanceProfileCredentialsProvider implements CredentialsProvider { + + private static Logger logger = LoggerFactory.getLogger(InstanceProfileCredentialsProvider.class); + + public InstanceProfileCredentialsProvider(String roleName) { + if (null == roleName) { + throw new NullPointerException("You must specify a valid role name."); + } + this.roleName = roleName; + this.fetcher = new InstanceProfileCredentialsFetcher(); + this.fetcher.setRoleName(this.roleName); + } + + public InstanceProfileCredentialsProvider withCredentialsFetcher(InstanceProfileCredentialsFetcher fetcher) { + this.fetcher = fetcher; + return this; + } + + @Override + public void setCredentials(ServiceCredentials creds) { + + } + + public boolean isCredentialsInvalid() { + return credentials == null || credentials.isExpired(); + } + + public boolean shouldRefreshCredentials() { + return credentials.willSoonExpire() && credentials.shouldRefresh(); + } + + @Override + public InstanceProfileCredentials getCredentials() { + if (isCredentialsInvalid() || shouldRefreshCredentials()) { + synchronized (this) { + if (isCredentialsInvalid()) { + try { + credentials = (InstanceProfileCredentials) fetcher.fetch(maxRetryTimes); + } catch (ClientException e) { + logger.error("EcsInstanceCredentialsFetcher.fetch Exception:", e); + return null; + } + } else if (shouldRefreshCredentials()) { + try { + credentials = (InstanceProfileCredentials) fetcher.fetch(); + } catch (ClientException e) { + // Use the current expiring session token and wait for next round + credentials.setLastFailedRefreshTime(); + logger.error("EcsInstanceCredentialsFetcher.fetch Exception:", e); + } + } + } + } + + return credentials; + } + + private final String roleName; + private volatile InstanceProfileCredentials credentials; + private InstanceProfileCredentialsFetcher fetcher; + + private int maxRetryTimes = AuthUtils.MAX_ECS_METADATA_FETCH_RETRY_TIMES; + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/InvalidCredentialsException.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InvalidCredentialsException.java new file mode 100644 index 0000000..a6413ab --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/InvalidCredentialsException.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +public class InvalidCredentialsException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public InvalidCredentialsException() { + super(); + } + + public InvalidCredentialsException(String message) { + super(message); + } + + public InvalidCredentialsException(Throwable cause) { + super(cause); + } + + public InvalidCredentialsException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSigner.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSigner.java new file mode 100755 index 0000000..f9b4a97 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSigner.java @@ -0,0 +1,77 @@ +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.http.RequestMessage; +import com.alicloud.openservices.tablestore.core.utils.Bytes; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import org.apache.http.Header; + +import java.io.UnsupportedEncodingException; +import java.util.Map; +import java.util.TreeMap; + +public class RequestSigner implements RequestSignerInterface { + + private ServiceCredentials credentials; + private byte[] accessKey; + private byte[] instanceName; + + public RequestSigner(String instanceName, ServiceCredentials credentials) { + Preconditions.checkNotNull(instanceName); + Preconditions.checkNotNull(credentials); + + this.credentials = credentials; + this.accessKey = Bytes.toBytes(credentials.getAccessKeySecret()); + try { + this.instanceName = instanceName.getBytes(Constants.HTTP_HEADER_ENCODING); + } catch (UnsupportedEncodingException e) { + throw new ClientException("Unsupport encoding: " + Constants.HTTP_HEADER_ENCODING); + } + } + + @Override + public void sign(RequestMessage request) throws ClientException { + request.addHeader(Constants.OTS_HEADER_ACCESS_KEY_ID, credentials.getAccessKeyId()); + if ((credentials.getSecurityToken() != null) && !credentials.getSecurityToken().isEmpty()) { + request.addHeader(Constants.OTS_HEADER_STS_TOKEN, credentials.getSecurityToken()); + } + try { + String signature = getSignature( + request.getActionUri().getAction(), + request.getRequest().getMethod(), + request.getRequest().getAllHeaders()); + request.addHeader(Constants.OTS_HEADER_SIGNATURE, signature); + } catch (UnsupportedEncodingException e) { + throw new ClientException("无法计算签名:" + e.getMessage()); + } + } + + private String getSignature(String action, String method, Header[] headers) + throws UnsupportedEncodingException + { + StringBuilder canonicalizedOtsHeader = new StringBuilder(1000); + Map headerMap = new TreeMap(); + for (Header header : headers) { + headerMap.put(header.getName(), header.getValue()); + } + for(Map.Entry entry : headerMap.entrySet()) { + String key = entry.getKey(); + String val = entry.getValue().trim(); + if (key.startsWith(Constants.OTS_HEADER_PREFIX)) { + canonicalizedOtsHeader.append(key).append(":").append(val).append("\n"); + } + } + + StringBuilder sb = new StringBuilder(1000); + sb.append("/").append(action).append("\n").append(method).append("\n"). + append("\n"). + append(canonicalizedOtsHeader.toString()); + + ServiceSignature signer = new HmacSHA1Signature(accessKey); + + signer.updateUTF8String(sb.toString()); + + return signer.computeSignature(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSignerInterface.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSignerInterface.java new file mode 100755 index 0000000..ee0e58c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/RequestSignerInterface.java @@ -0,0 +1,10 @@ +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.http.RequestMessage; + +public interface RequestSignerInterface { + + public void sign(RequestMessage request) + throws ClientException; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceCredentials.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceCredentials.java new file mode 100644 index 0000000..3c7183a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceCredentials.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +/** + * Provides access to credentials used for accessing TableStore, these credentials are + * used to securely sign requests to TableStore. + */ +public interface ServiceCredentials { + /** + * Returns the access key ID for this credentials. + */ + public String getAccessKeyId(); + + /** + * Returns the secret access key for this credentials. + */ + public String getAccessKeySecret(); + + /** + * Returns the security token for this credentials. + */ + public String getSecurityToken(); +} \ No newline at end of file diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceSignature.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceSignature.java new file mode 100755 index 0000000..4be3a2f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/ServiceSignature.java @@ -0,0 +1,17 @@ +package com.alicloud.openservices.tablestore.core.auth; + +/** + * 表示用于计算访问签名的接口。 + */ +public interface ServiceSignature { + + public String getAlgorithm(); + + public void updateUTF8String(String data); + + public void update(byte[] data); + + public void update(byte data); + + public String computeSignature(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/auth/SystemPropertiesCredentialsProvider.java b/src/main/java/com/alicloud/openservices/tablestore/core/auth/SystemPropertiesCredentialsProvider.java new file mode 100644 index 0000000..b4c60e0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/auth/SystemPropertiesCredentialsProvider.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.core.utils.StringUtils; + +/** + * {@link SystemPropertiesCredentialsProvider} implementation that provides + * credentials by looking at the oss.accessKeyId and + * oss.accessKeySecret Java system properties. + */ +public class SystemPropertiesCredentialsProvider implements CredentialsProvider { + + @Override + public void setCredentials(ServiceCredentials creds) { + + } + + @Override + public ServiceCredentials getCredentials() { + String accessKeyId = StringUtils.trim(System.getProperty(AuthUtils.ACCESS_KEY_SYSTEM_PROPERTY)); + String secretAccessKey = StringUtils.trim(System.getProperty(AuthUtils.SECRET_KEY_SYSTEM_PROPERTY)); + String sessionToken = StringUtils.trim(System.getProperty(AuthUtils.SESSION_TOKEN_SYSTEM_PROPERTY)); + + if (accessKeyId == null || accessKeyId.equals("")) { + throw new InvalidCredentialsException("Access key id should not be null or empty."); + } + if (secretAccessKey == null || secretAccessKey.equals("")) { + throw new InvalidCredentialsException("Access key secret should not be null or empty."); + } + + return new DefaultCredentials(accessKeyId, secretAccessKey, sessionToken); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/AbortTransactionResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/AbortTransactionResponseConsumer.java new file mode 100644 index 0000000..d2f5d95 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/AbortTransactionResponseConsumer.java @@ -0,0 +1,30 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.AbortTransactionResponse; +import com.alicloud.openservices.tablestore.model.CreateTableResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class AbortTransactionResponseConsumer + extends ResponseConsumer { + + public AbortTransactionResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, AbortTransactionResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected AbortTransactionResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.AbortTransactionResponse internalResponse = + (OtsInternalApi.AbortTransactionResponse) responseContent.getMessage(); + AbortTransactionResponse response = ResponseFactory.createAbortTransactionResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/AsyncServiceClient.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/AsyncServiceClient.java old mode 100755 new mode 100644 similarity index 54% rename from src/main/java/com/aliyun/openservices/ots/comm/AsyncServiceClient.java rename to src/main/java/com/alicloud/openservices/tablestore/core/http/AsyncServiceClient.java index 3eff427..6337c68 --- a/src/main/java/com/aliyun/openservices/ots/comm/AsyncServiceClient.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/AsyncServiceClient.java @@ -1,141 +1,186 @@ -package com.aliyun.openservices.ots.comm; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.internal.OTSAsyncResponseConsumer; -import com.aliyun.openservices.ots.internal.OTSTraceLogger; -import com.aliyun.openservices.ots.log.LogUtil; -import org.apache.http.HttpHost; -import org.apache.http.HttpRequest; -import org.apache.http.concurrent.FutureCallback; -import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; -import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager; -import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor; -import org.apache.http.impl.nio.reactor.IOReactorConfig; -import org.apache.http.nio.conn.NHttpClientConnectionManager; -import org.apache.http.nio.protocol.BasicAsyncRequestProducer; -import org.apache.http.nio.reactor.ConnectingIOReactor; -import org.apache.http.nio.reactor.IOReactorException; -import org.apache.http.protocol.HttpContext; - -import java.io.IOException; -import java.util.concurrent.TimeUnit; - -import static com.aliyun.openservices.ots.internal.OTSLoggerConstant.*; - -public class AsyncServiceClient extends ServiceClient { - private CloseableHttpAsyncClient httpClient; - private IdleConnectionEvictor connEvictor; - - public AsyncServiceClient(ClientConfiguration config) { - super(config); - try { - IOReactorConfig ioReactorConfig = IOReactorConfig.custom() - .setIoThreadCount(config.getIoThreadCount()).build(); - ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor( - ioReactorConfig); - PoolingNHttpClientConnectionManager cm = new PoolingNHttpClientConnectionManager( - ioReactor); - cm.setMaxTotal(config.getMaxConnections()); - cm.setDefaultMaxPerRoute(config.getMaxConnections()); - httpClient = new HttpFactory().createHttpAsyncClient(config, cm); - - /* - * socketTimeout的值限制了closeIdleConnections执行的周期。 - * 如果周期相对socketTimeout的值过长,有可能一个请求分配到一个即将socketTimeout的连接, - * 在请求发送之前即抛出SocketTimeoutException。 - * 现在让closeIdleConnections的执行周期为socketTimeout / 2.5。 - */ - long closePeriod = 5000; - if (config.getSocketTimeoutInMillisecond() > 0) { - closePeriod = (long) (config.getSocketTimeoutInMillisecond() / 2.5); - } - closePeriod = closePeriod < 5000 ? closePeriod : 5000; - connEvictor = new IdleConnectionEvictor(cm, closePeriod); - httpClient.start(); - connEvictor.start(); - } catch (IOReactorException ex) { - throw new ClientException(String.format("IOReactorError: %s", - ex.getMessage()), ex); - } - } - - public static class IdleConnectionEvictor extends Thread { - private final NHttpClientConnectionManager connMgr; - private volatile boolean shutdown; - private long closePeriod; - - public IdleConnectionEvictor(NHttpClientConnectionManager connMgr, - long closePeriod) { - this.connMgr = connMgr; - this.closePeriod = closePeriod; - } - - @Override - public void run() { - try { - while (!shutdown) { - synchronized (this) { - wait(closePeriod); - connMgr.closeExpiredConnections(); - connMgr.closeIdleConnections(closePeriod, - TimeUnit.MILLISECONDS); - } - } - } catch (InterruptedException ex) { - // terminate - } - } - - public void shutdown() { - shutdown = true; - synchronized (this) { - notifyAll(); - } - } - } - - static class OTSRequestProducer extends BasicAsyncRequestProducer { - private OTSTraceLogger traceLogger; - public OTSRequestProducer(final HttpHost target, - final HttpRequest request, OTSTraceLogger traceLogger) { - super(target, request); - this.traceLogger = traceLogger; - } - - public void requestCompleted(final HttpContext context) { - super.requestCompleted(context); - if (LogUtil.LOG.isDebugEnabled()) { - LogUtil.LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + DELIMITER + REQUEST_SENT); - } - traceLogger.addEventTime(REQUEST_SENT, System.currentTimeMillis()); - } - } - - @Override - protected void asyncSendRequestCore(RequestMessage request, - ExecutionContext context, OTSAsyncResponseConsumer consumer, - FutureCallback callback, OTSTraceLogger traceLogger) { - final HttpHost target = request.getActionUri().getHost(); - if (LogUtil.LOG.isDebugEnabled()) { - LogUtil.LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + DELIMITER + INTO_HTTP_ASYNC_CLIENT); - } - traceLogger.addEventTime(INTO_HTTP_ASYNC_CLIENT, System.currentTimeMillis()); - httpClient.execute(new OTSRequestProducer(target, request.getRequest(), traceLogger), - consumer, callback); - } - - @Override - public void shutdown() { - try { - this.connEvictor.shutdown(); - this.connEvictor.join(); - this.httpClient.close(); - } catch (IOException e) { - throw new ClientException(rm.getFormattedString("IOError", - e.getMessage()), e); - } catch (InterruptedException e) { - - } - } -} +package com.alicloud.openservices.tablestore.core.http; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.apache.http.HttpHost; +import org.apache.http.HttpRequest; +import org.apache.http.concurrent.FutureCallback; +import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; +import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager; +import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor; +import org.apache.http.impl.nio.reactor.IOReactorConfig; +import org.apache.http.nio.conn.NHttpClientConnectionManager; +import org.apache.http.nio.protocol.BasicAsyncRequestProducer; +import org.apache.http.nio.reactor.ConnectingIOReactor; +import org.apache.http.nio.reactor.IOReactorException; +import org.apache.http.protocol.HttpContext; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import static com.alicloud.openservices.tablestore.core.utils.LogUtil.*; + +public class AsyncServiceClient { + private CloseableHttpAsyncClient httpClient; + private IdleConnectionEvictor connEvictor; + private Map extraHeaders; + + public AsyncServiceClient(ClientConfiguration config) { + try { + IOReactorConfig ioReactorConfig = IOReactorConfig.custom() + .setIoThreadCount(config.getIoThreadCount()).build(); + ConnectingIOReactor ioReactor = new DefaultConnectingIOReactor( + ioReactorConfig); + PoolingNHttpClientConnectionManager cm = + new PoolingNHttpClientConnectionManager(ioReactor); + cm.setMaxTotal(config.getMaxConnections()); + cm.setDefaultMaxPerRoute(config.getMaxConnections()); + httpClient = HttpFactory.createHttpAsyncClient(config, cm); + + /* + * socketTimeout的值限制了closeIdleConnections执行的周期。 + * 如果周期相对socketTimeout的值过长,有可能一个请求分配到一个即将socketTimeout的连接, + * 在请求发送之前即抛出SocketTimeoutException。 + * 现在让closeIdleConnections的执行周期为socketTimeout / 2.5。 + */ + long closePeriod = 5000; + if (config.getSocketTimeoutInMillisecond() > 0) { + closePeriod = (long) (config.getSocketTimeoutInMillisecond() / 2.5); + } + closePeriod = closePeriod < 5000 ? closePeriod : 5000; + connEvictor = new IdleConnectionEvictor(cm, closePeriod); + httpClient.start(); + connEvictor.start(); + } catch (IOReactorException ex) { + throw new ClientException(String.format("IOReactorError: %s", + ex.getMessage()), ex); + } + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public void setExtraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + } + + static class IdleConnectionEvictor extends Thread { + private final NHttpClientConnectionManager connMgr; + private volatile boolean shutdown; + private long closePeriod; + + public IdleConnectionEvictor( + NHttpClientConnectionManager connMgr, + long closePeriod) + { + this.connMgr = connMgr; + this.closePeriod = closePeriod; + } + + @Override + public void run() { + try { + while (!shutdown) { + synchronized (this) { + wait(closePeriod); + connMgr.closeExpiredConnections(); + connMgr.closeIdleConnections( + closePeriod, TimeUnit.MILLISECONDS); + } + } + } catch (InterruptedException ex) { + // terminate + } + } + + public void shutdown() { + shutdown = true; + synchronized (this) { + notifyAll(); + } + } + } + + static class OTSRequestProducer extends BasicAsyncRequestProducer { + private TraceLogger traceLogger; + + public OTSRequestProducer( + final HttpHost target, + final HttpRequest request, + TraceLogger traceLogger) + { + super(target, request); + this.traceLogger = traceLogger; + } + + public void requestCompleted(final HttpContext context) { + super.requestCompleted(context); + if (LOG.isDebugEnabled()) { + LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + DELIMITER + REQUEST_SENT); + } + traceLogger.addEventTime(REQUEST_SENT, System.currentTimeMillis()); + } + } + + public void asyncSendRequest( + RequestMessage request, + ExecutionContext context, + ResponseConsumer consumer, + FutureCallback callback, + TraceLogger traceLogger) + { + Preconditions.checkNotNull(request); + Preconditions.checkNotNull(context); + + addExtraHeaders(request); + + context.getSigner().sign(request); + handleRequest(request, context.getResquestHandlers()); + consumer.setContext(context); + final HttpHost target = request.getActionUri().getHost(); + if (LOG.isDebugEnabled()) { + LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + DELIMITER + INTO_HTTP_ASYNC_CLIENT); + } + traceLogger.addEventTime(INTO_HTTP_ASYNC_CLIENT, System.currentTimeMillis()); + httpClient.execute( + new OTSRequestProducer(target, request.getRequest(), traceLogger), + consumer, callback); + } + + private void addExtraHeaders(RequestMessage request) + { + if (extraHeaders == null) { + return; + } + for (Map.Entry entry : extraHeaders.entrySet()) { + request.addHeader(entry.getKey(), entry.getValue()); + } + } + + private void handleRequest( + RequestMessage message, + List requestHandlers) + throws ClientException + { + for (RequestHandler h : requestHandlers) { + h.handle(message); + } + } + + public void shutdown() { + try { + this.connEvictor.shutdown(); + this.connEvictor.join(); + this.httpClient.close(); + } catch (IOException e) { + throw new ClientException("Failed to shutdown http client.", e); + } catch (InterruptedException e) { + // ignore exception + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/BatchGetRowResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/BatchGetRowResponseConsumer.java new file mode 100644 index 0000000..3bb9b8f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/BatchGetRowResponseConsumer.java @@ -0,0 +1,90 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.PartialResultFailedException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse; +import com.alicloud.openservices.tablestore.model.Response; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; + +import java.util.List; +import java.util.Map; + +public class BatchGetRowResponseConsumer extends ResponseConsumer { + + public BatchGetRowResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, BatchGetRowResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + /** + * 1.不是private方法,方便做ut. + * 2.假设getTableToRowsStatus()返回的结果中index有序 + */ + BatchGetRowResponse mergeResult(BatchGetRowResponse lastResult, BatchGetRowResponse result) { + + Response meta = new Response(result.getRequestId()); + meta.setTraceId(this.traceLogger.getTraceId()); + BatchGetRowResponse mergedResult = new BatchGetRowResponse(meta); + + Map> lastRowResultMap = lastResult.getTableToRowsResult(); + Map> rowResultMap = result.getTableToRowsResult(); + + for (String tableName : lastRowResultMap.keySet()) { + List lastRowResultList = lastRowResultMap.get(tableName); + List rowResultList = rowResultMap.get(tableName); + int idx = 0; + for (BatchGetRowResponse.RowResult lastRowResult : lastRowResultList) { + if (lastRowResult.isSucceed()) { + mergedResult.addResult(lastRowResult); + } else { + BatchGetRowResponse.RowResult rowResult = rowResultList.get(idx++); + if (rowResult.isSucceed()) { + mergedResult.addResult(new BatchGetRowResponse.RowResult(tableName, rowResult.getRow(), + rowResult.getConsumedCapacity(), lastRowResult.getIndex())); + } else { + mergedResult.addResult(new BatchGetRowResponse.RowResult(tableName, rowResult.getError(), + lastRowResult.getIndex())); + } + } + } + } + return mergedResult; + } + + @Override + protected BatchGetRowResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.BatchGetRowResponse BatchGetRowResponse = + (OtsInternalApi.BatchGetRowResponse) responseContent.getMessage(); + BatchGetRowResponse result = ResponseFactory.createBatchGetRowResponse( + responseContent, BatchGetRowResponse); + + if (lastResult != null) { + result = mergeResult(lastResult, result); + } + List failedRows = result.getFailedRows(); + if (failedRows.isEmpty()) { + return result; + } else { + PartialResultFailedException partialEx = new PartialResultFailedException(null, result.getRequestId(), result); + /** + * 部分失败时记录log信息 + */ + for (BatchGetRowResponse.RowResult rowResult : failedRows) { + TableStoreException ex = new TableStoreException(rowResult.getError().getMessage(), null, rowResult.getError().getCode(), + result.getRequestId(), 0); + partialEx.addError(ex); + LogUtil.logOnFailed(traceLogger, retry, ex, result.getRequestId()); + } + throw partialEx; + } + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/BatchWriteRowResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/BatchWriteRowResponseConsumer.java new file mode 100644 index 0000000..27df3f6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/BatchWriteRowResponseConsumer.java @@ -0,0 +1,93 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.PartialResultFailedException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.Response; +import com.alicloud.openservices.tablestore.model.BatchWriteRowResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; + +import java.util.List; +import java.util.Map; + +public class BatchWriteRowResponseConsumer extends ResponseConsumer { + + public BatchWriteRowResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, BatchWriteRowResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + /** + * 1.不是private方法,方便做ut. + * 2.假设getRowStatus返回的结果中index有序. + */ + BatchWriteRowResponse mergeResult(BatchWriteRowResponse lastResult, BatchWriteRowResponse result) { + + Response meta = new Response(result.getRequestId()); + meta.setTraceId(this.traceLogger.getTraceId()); + BatchWriteRowResponse mergedResult = new BatchWriteRowResponse(meta); + + Map> lastRowResultMap = lastResult.getRowStatus(); + Map> rowResultMap = result.getRowStatus(); + + for (String tableName : lastRowResultMap.keySet()) { + List lastRowResultList = lastRowResultMap.get(tableName); + List rowResultList = rowResultMap.get(tableName); + int idx = 0; + for (BatchWriteRowResponse.RowResult lastRowResult : lastRowResultList) { + if (lastRowResult.isSucceed()) { + mergedResult.addRowResult(lastRowResult); + } else { + BatchWriteRowResponse.RowResult rowResult = rowResultList.get(idx); + idx++; + if (rowResult.isSucceed()) { + mergedResult.addRowResult(new BatchWriteRowResponse.RowResult(tableName, + rowResult.getRow(), rowResult.getConsumedCapacity(), lastRowResult.getIndex())); + } else { + mergedResult.addRowResult(new BatchWriteRowResponse.RowResult(tableName, + rowResult.getRow(), rowResult.getError(), lastRowResult.getIndex())); + } + } + } + } + + return mergedResult; + } + + @Override + protected BatchWriteRowResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.BatchWriteRowResponse BatchWriteRowResponse = + (OtsInternalApi.BatchWriteRowResponse) responseContent.getMessage(); + BatchWriteRowResponse result = ResponseFactory.createBatchWriteRowResponse( + responseContent, BatchWriteRowResponse); + + if (lastResult != null) { + result = mergeResult(lastResult, result); + } + List failedRows = result.getFailedRows(); + if (failedRows.isEmpty()) { + return result; + } else { + PartialResultFailedException partialEx = new PartialResultFailedException(null, result.getRequestId(), result); + /** + * 部分失败时记录log信息 + */ + for (BatchWriteRowResponse.RowResult rowResult : failedRows) { + TableStoreException ex = new TableStoreException(rowResult.getError().getMessage(), null, rowResult.getError().getCode(), + result.getRequestId(), 0); + partialEx.addError(ex); + LogUtil.logOnFailed(traceLogger, retry, ex, result.getRequestId()); + } + + throw partialEx; + } + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/CheckpointResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/CheckpointResponseConsumer.java new file mode 100644 index 0000000..419d0f9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/CheckpointResponseConsumer.java @@ -0,0 +1,27 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; + +public class CheckpointResponseConsumer + extends ResponseConsumer { + public CheckpointResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, CheckpointResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected CheckpointResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.CheckpointResponse tunnelResponse = + (TunnelServiceApi.CheckpointResponse)responseContent.getMessage(); + CheckpointResponse response = ResponseFactory.createCheckpointResponse(responseContent, tunnelResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/CommitTransactionResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/CommitTransactionResponseConsumer.java new file mode 100644 index 0000000..7e4180b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/CommitTransactionResponseConsumer.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.AbortTransactionResponse; +import com.alicloud.openservices.tablestore.model.CommitTransactionResponse; +import com.alicloud.openservices.tablestore.model.CreateTableResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class CommitTransactionResponseConsumer + extends ResponseConsumer { + + public CommitTransactionResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, CommitTransactionResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected CommitTransactionResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.CommitTransactionResponse internalResponse = + (OtsInternalApi.CommitTransactionResponse) responseContent.getMessage(); + CommitTransactionResponse response = ResponseFactory.createCommitTransactionResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ComputeSplitsBySizeResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ComputeSplitsBySizeResponseConsumer.java new file mode 100644 index 0000000..e8c5cf4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ComputeSplitsBySizeResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse; +import com.alicloud.openservices.tablestore.model.ComputeSplitsBySizeResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class ComputeSplitsBySizeResponseConsumer extends ResponseConsumer { + + public ComputeSplitsBySizeResponseConsumer(ResultParser resultParser, TraceLogger traceLogger, RetryStrategy retry, + ComputeSplitsBySizeResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ComputeSplitsBySizeResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.ComputeSplitPointsBySizeResponse ComputeSplitPointsBySizeResponse = + (OtsInternalApi.ComputeSplitPointsBySizeResponse) responseContent.getMessage(); + ComputeSplitsBySizeResponse result = ResponseFactory.createComputeSplitsBySizeResponse( + responseContent, ComputeSplitPointsBySizeResponse); + return result; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ConnectTunnelResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ConnectTunnelResponseConsumer.java new file mode 100644 index 0000000..9f259c5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ConnectTunnelResponseConsumer.java @@ -0,0 +1,27 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; + +public class ConnectTunnelResponseConsumer + extends ResponseConsumer { + public ConnectTunnelResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, ConnectTunnelResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ConnectTunnelResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.ConnectResponse tunnelResponse = + (TunnelServiceApi.ConnectResponse)responseContent.getMessage(); + ConnectTunnelResponse response = ResponseFactory.createConnectTunnelResponse(responseContent, tunnelResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ContentMD5ResponseHandler.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ContentMD5ResponseHandler.java new file mode 100755 index 0000000..0715cb7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ContentMD5ResponseHandler.java @@ -0,0 +1,55 @@ +package com.alicloud.openservices.tablestore.core.http; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +import org.apache.http.entity.ByteArrayEntity; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.utils.Base64; +import com.alicloud.openservices.tablestore.core.utils.BinaryUtil; +import com.alicloud.openservices.tablestore.core.utils.IOUtils; + +public class ContentMD5ResponseHandler implements ResponseHandler { + public void handle(ResponseMessage responseData) throws ClientException { + Map headers = responseData.getHeadersMap(); + + // 验证头信息完整性 + String contentMd5 = headers.get(Constants.OTS_HEADER_OTS_CONTENT_MD5); + if (contentMd5 == null) { + throw new ClientException("Required header is not found: " + Constants.OTS_HEADER_OTS_CONTENT_MD5); + } + + // 验证返回值MD5值是否正确 + byte[] content = null; + String md5 = null; + + InputStream dataStream = null; + + try { + dataStream = responseData.getContent(); + } catch (IOException e) { + throw new ClientException("Can not read response from server.", e); + } + + if (dataStream == null){ + throw new ClientException("The server returns an unknown error."); + } + + try { + content = IOUtils.readStreamAsBytesArray(dataStream); + md5 = Base64.toBase64String(BinaryUtil.calculateMd5(content)); + } catch (Exception e) { + throw new ClientException("The server returns an unknown error."); + } + if (!md5.equals(contentMd5)) { + throw new ClientException("The MD5 value of response content is not equal with the value in header."); + } + + // 检查通过 + IOUtils.safeClose(dataStream); + responseData.getResponse().setEntity(new ByteArrayEntity(content)); // reset output stream + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateIndexResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateIndexResponseConsumer.java new file mode 100755 index 0000000..c28c381 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateIndexResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.CreateIndexResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class CreateIndexResponseConsumer + extends ResponseConsumer { + + public CreateIndexResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, CreateIndexResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected CreateIndexResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.CreateIndexResponse internalResponse = + (OtsInternalApi.CreateIndexResponse) responseContent.getMessage(); + CreateIndexResponse response = ResponseFactory.createCreteIndexResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateSearchIndexResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateSearchIndexResponseConsumer.java new file mode 100644 index 0000000..44263ad --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateSearchIndexResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.protocol.Search; +import com.alicloud.openservices.tablestore.model.search.CreateSearchIndexResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class CreateSearchIndexResponseConsumer + extends ResponseConsumer { + + public CreateSearchIndexResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, CreateSearchIndexResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected CreateSearchIndexResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + Search.CreateSearchIndexResponse internalResponse = + (Search.CreateSearchIndexResponse) responseContent.getMessage(); + CreateSearchIndexResponse response = ResponseFactory.createCreateSearchIndexResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTableResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTableResponseConsumer.java new file mode 100755 index 0000000..908faf1 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTableResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.CreateTableResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class CreateTableResponseConsumer + extends ResponseConsumer { + + public CreateTableResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, CreateTableResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected CreateTableResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.CreateTableResponse internalResponse = + (OtsInternalApi.CreateTableResponse) responseContent.getMessage(); + CreateTableResponse response = ResponseFactory.createCreateTableResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTunnelResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTunnelResponseConsumer.java new file mode 100644 index 0000000..0822858 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/CreateTunnelResponseConsumer.java @@ -0,0 +1,27 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class CreateTunnelResponseConsumer + extends ResponseConsumer { + public CreateTunnelResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, CreateTunnelResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected CreateTunnelResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.CreateTunnelResponse tunnelResponse = + (TunnelServiceApi.CreateTunnelResponse) responseContent.getMessage(); + CreateTunnelResponse response = ResponseFactory.createCreateTunnelResponse(responseContent, tunnelResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteIndexResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteIndexResponseConsumer.java new file mode 100755 index 0000000..b8f3297 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteIndexResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.DeleteIndexResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class DeleteIndexResponseConsumer + extends ResponseConsumer { + + public DeleteIndexResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DeleteIndexResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DeleteIndexResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.DropIndexResponse internalResponse = + (OtsInternalApi.DropIndexResponse) responseContent.getMessage(); + DeleteIndexResponse response = ResponseFactory.createDeleteIndexResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteRowResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteRowResponseConsumer.java new file mode 100644 index 0000000..d96fb46 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteRowResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.DeleteRowResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class DeleteRowResponseConsumer extends ResponseConsumer { + + public DeleteRowResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DeleteRowResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DeleteRowResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.DeleteRowResponse DeleteRowResponse = + (OtsInternalApi.DeleteRowResponse) responseContent.getMessage(); + DeleteRowResponse result = ResponseFactory.createDeleteRowResponse( + responseContent, DeleteRowResponse); + return result; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteSearchIndexResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteSearchIndexResponseConsumer.java new file mode 100644 index 0000000..b222d1e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteSearchIndexResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.protocol.Search; +import com.alicloud.openservices.tablestore.model.search.DeleteSearchIndexResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class DeleteSearchIndexResponseConsumer + extends ResponseConsumer { + + public DeleteSearchIndexResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DeleteSearchIndexResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DeleteSearchIndexResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + Search.DeleteSearchIndexResponse internalResponse = + (Search.DeleteSearchIndexResponse) responseContent.getMessage(); + DeleteSearchIndexResponse response = ResponseFactory.createDeleteSearchIndexResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTableResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTableResponseConsumer.java new file mode 100755 index 0000000..4cc9624 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTableResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.DeleteTableResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class DeleteTableResponseConsumer + extends ResponseConsumer { + + public DeleteTableResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DeleteTableResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DeleteTableResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.DeleteTableResponse internalResponse = + (OtsInternalApi.DeleteTableResponse) responseContent.getMessage(); + DeleteTableResponse response = ResponseFactory.createDeleteTableResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTunnelResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTunnelResponseConsumer.java new file mode 100644 index 0000000..7dbd1bb --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DeleteTunnelResponseConsumer.java @@ -0,0 +1,27 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class DeleteTunnelResponseConsumer + extends ResponseConsumer { + public DeleteTunnelResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DeleteTunnelResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DeleteTunnelResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.DeleteTunnelResponse tunnelResponse = + (TunnelServiceApi.DeleteTunnelResponse)responseContent.getMessage(); + DeleteTunnelResponse response = ResponseFactory.createDeleteTunnelResponse(responseContent, tunnelResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeSearchIndexResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeSearchIndexResponseConsumer.java new file mode 100644 index 0000000..8bd77f6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeSearchIndexResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.protocol.Search; +import com.alicloud.openservices.tablestore.model.search.DescribeSearchIndexResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class DescribeSearchIndexResponseConsumer + extends ResponseConsumer { + + public DescribeSearchIndexResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DescribeSearchIndexResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DescribeSearchIndexResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + Search.DescribeSearchIndexResponse internalResponse = + (Search.DescribeSearchIndexResponse) responseContent.getMessage(); + DescribeSearchIndexResponse response = ResponseFactory.createDescribeSearchIndexResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeStreamResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeStreamResponseConsumer.java new file mode 100644 index 0000000..d90e2ce --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeStreamResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.model.DescribeStreamResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class DescribeStreamResponseConsumer + extends ResponseConsumer { + + public DescribeStreamResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DescribeStreamResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DescribeStreamResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.DescribeStreamResponse internalResponse = + (OtsInternalApi.DescribeStreamResponse) responseContent.getMessage(); + DescribeStreamResponse response = ResponseFactory.createDescribeStreamResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTableResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTableResponseConsumer.java new file mode 100755 index 0000000..11f2c83 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTableResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.DescribeTableResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class DescribeTableResponseConsumer + extends ResponseConsumer { + + public DescribeTableResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DescribeTableResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DescribeTableResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.DescribeTableResponse internalResponse = + (OtsInternalApi.DescribeTableResponse) responseContent.getMessage(); + DescribeTableResponse response = ResponseFactory.createDescribeTableResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTunnelResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTunnelResponseConsumer.java new file mode 100644 index 0000000..e1eee2b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/DescribeTunnelResponseConsumer.java @@ -0,0 +1,27 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class DescribeTunnelResponseConsumer + extends ResponseConsumer { + public DescribeTunnelResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, DescribeTunnelResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected DescribeTunnelResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.DescribeTunnelResponse tunnelResponse = + (TunnelServiceApi.DescribeTunnelResponse) responseContent.getMessage(); + DescribeTunnelResponse response = ResponseFactory.createDescribeTunnelResponse(responseContent, tunnelResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ErrorResponseHandler.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ErrorResponseHandler.java new file mode 100755 index 0000000..2dd3270 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ErrorResponseHandler.java @@ -0,0 +1,61 @@ +package com.alicloud.openservices.tablestore.core.http; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +/** + * 检查返回结果是否有错误。 + * 如果返回状态码不为200,则抛出OTSException异常。 + */ +public class ErrorResponseHandler implements ResponseHandler { + public void handle(ResponseMessage responseData) throws TableStoreException, ClientException { + Preconditions.checkNotNull(responseData); + if (responseData.isSuccessful()){ + return; + } + + Map headers = responseData.getHeadersMap(); + int httpStatus = responseData.getStatusCode(); + + if (httpStatus == Constants.OTS_HTTP_MOVED_PERMANENTLY) { + if (!headers.containsKey(Constants.OTS_MOVED_PERMANENTLY_LOCATION)){ + throw new ClientException("The required header is missing: " + Constants.OTS_MOVED_PERMANENTLY_LOCATION); + } + String location = headers.get(Constants.OTS_MOVED_PERMANENTLY_LOCATION); + throw new ClientException("The endpoint of service has moved to:" + location); + } + + InputStream errorStream = null; + try { + errorStream = responseData.getContent(); + } catch (IOException e) { + throw new ClientException("Failed to read response from server.", e); + } + + if (errorStream == null){ + throw new ClientException("Network error."); + } + + String requestId = headers.get(Constants.OTS_HEADER_REQUEST_ID); + if (requestId == null){ + // SDK接到OTS服务器返回的异常,但是该异常中未包含协议定义的必选header。 + // 此种情况发生在请求被OTS的HTTP服务器直接拦截,未到OTS Server端被处理。 + throw new ClientException( + "TableStore returns a response with status code: " + responseData.getStatusCode() + "."); + } + + try { + OtsInternalApi.Error errMsg = OtsInternalApi.Error.parseFrom(errorStream); + throw new TableStoreException(errMsg.getMessage(), null, errMsg.getCode(), requestId, httpStatus); + } catch (IOException e) { + throw new ClientException("Network error.", e); + } + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/ExecutionContext.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ExecutionContext.java similarity index 69% rename from src/main/java/com/aliyun/openservices/ots/comm/ExecutionContext.java rename to src/main/java/com/alicloud/openservices/tablestore/core/http/ExecutionContext.java index b414ac2..f4d52e5 100755 --- a/src/main/java/com/aliyun/openservices/ots/comm/ExecutionContext.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ExecutionContext.java @@ -1,43 +1,20 @@ -package com.aliyun.openservices.ots.comm; +package com.alicloud.openservices.tablestore.core.http; import java.util.LinkedList; import java.util.List; -import com.aliyun.openservices.ots.auth.RequestSigner; -import com.aliyun.openservices.ots.utils.ServiceConstants; +import com.alicloud.openservices.tablestore.core.auth.RequestSigner; public class ExecutionContext { - private String charset = ServiceConstants.DEFAULT_ENCODING; private RequestSigner signer; // The request handlers that handle request content in as a pipeline private List requestHandlers = new LinkedList(); // The response handlers that handle response message in as a pipeline. private List responseHandlers = new LinkedList(); - /** - * Constructor. - */ public ExecutionContext() { } - /** - * Returns the default encoding (charset). Default: "UTF-8" - * - * @return 编码类型 - */ - public String getCharset() { - return charset; - } - - /** - * Sets the default encoding (charset). Default: "UTF-8" - * - * @param defaultEncoding 编码类型 - */ - public void setCharset(String defaultEncoding) { - this.charset = defaultEncoding; - } - /** * @return the signer */ diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/GetCheckpointResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetCheckpointResponseConsumer.java new file mode 100644 index 0000000..e337488 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetCheckpointResponseConsumer.java @@ -0,0 +1,26 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; + +public class GetCheckpointResponseConsumer + extends ResponseConsumer { + public GetCheckpointResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, GetCheckpointResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected GetCheckpointResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.GetCheckpointResponse tunnelResponse = + (TunnelServiceApi.GetCheckpointResponse)responseContent.getMessage(); + return ResponseFactory.createGetCheckpointResponse(responseContent, tunnelResponse); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/GetRangeResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetRangeResponseConsumer.java new file mode 100644 index 0000000..e3ecd66 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetRangeResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.GetRangeResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class GetRangeResponseConsumer extends ResponseConsumer { + + public GetRangeResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, GetRangeResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected GetRangeResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.GetRangeResponse GetRangeResponse = + (OtsInternalApi.GetRangeResponse) responseContent.getMessage(); + GetRangeResponse result = ResponseFactory.createGetRangeResponse( + responseContent, GetRangeResponse); + return result; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/GetRowResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetRowResponseConsumer.java new file mode 100644 index 0000000..ae1eda4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetRowResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.GetRowResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class GetRowResponseConsumer extends ResponseConsumer { + + public GetRowResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, GetRowResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected GetRowResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.GetRowResponse GetRowResponse = + (OtsInternalApi.GetRowResponse) responseContent.getMessage(); + GetRowResponse result = ResponseFactory.createGetRowResponse( + responseContent, GetRowResponse); + return result; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/GetShardIteratorResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetShardIteratorResponseConsumer.java new file mode 100644 index 0000000..358f8ca --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetShardIteratorResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.model.GetShardIteratorResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class GetShardIteratorResponseConsumer + extends ResponseConsumer { + + public GetShardIteratorResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, GetShardIteratorResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected GetShardIteratorResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.GetShardIteratorResponse internalResponse = + (OtsInternalApi.GetShardIteratorResponse) responseContent.getMessage(); + GetShardIteratorResponse response = ResponseFactory.createGetShardIteratorResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/GetStreamRecordResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetStreamRecordResponseConsumer.java new file mode 100644 index 0000000..abb8d63 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/GetStreamRecordResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.model.GetStreamRecordResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class GetStreamRecordResponseConsumer + extends ResponseConsumer { + + public GetStreamRecordResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, GetStreamRecordResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected GetStreamRecordResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.GetStreamRecordResponse internalResponse = + (OtsInternalApi.GetStreamRecordResponse) responseContent.getMessage(); + GetStreamRecordResponse response = ResponseFactory.createGetStreamRecordResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/HeartbeatResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/HeartbeatResponseConsumer.java new file mode 100644 index 0000000..8c56a6b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/HeartbeatResponseConsumer.java @@ -0,0 +1,26 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; + +public class HeartbeatResponseConsumer + extends ResponseConsumer { + public HeartbeatResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, HeartbeatResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected HeartbeatResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.HeartbeatResponse tunnelResponse = + (TunnelServiceApi.HeartbeatResponse)responseContent.getMessage(); + return ResponseFactory.createHeartbeatResponse(responseContent, tunnelResponse); + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/HttpFactory.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/HttpFactory.java similarity index 77% rename from src/main/java/com/aliyun/openservices/ots/comm/HttpFactory.java rename to src/main/java/com/alicloud/openservices/tablestore/core/http/HttpFactory.java index e4fa81c..49f9cda 100755 --- a/src/main/java/com/aliyun/openservices/ots/comm/HttpFactory.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/HttpFactory.java @@ -1,22 +1,22 @@ -package com.aliyun.openservices.ots.comm; +package com.alicloud.openservices.tablestore.core.http; import org.apache.http.HttpHost; +import org.apache.http.client.CredentialsProvider; +import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.auth.AuthScope; import org.apache.http.auth.NTCredentials; -import org.apache.http.client.CredentialsProvider; import org.apache.http.client.config.RequestConfig; -import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; import org.apache.http.impl.nio.client.HttpAsyncClients; import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager; -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.ClientException; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.ClientException; class HttpFactory { - - public CloseableHttpAsyncClient createHttpAsyncClient( + public static CloseableHttpAsyncClient createHttpAsyncClient( ClientConfiguration config, PoolingNHttpClientConnectionManager cm) { HttpAsyncClientBuilder httpClientBuilder = HttpAsyncClients.custom(); httpClientBuilder.setConnectionManager(cm); @@ -24,8 +24,9 @@ public CloseableHttpAsyncClient createHttpAsyncClient( .setConnectTimeout(config.getConnectionTimeoutInMillisecond()) .setSocketTimeout(config.getSocketTimeoutInMillisecond()).build(); httpClientBuilder.setDefaultRequestConfig(requestConfig); - httpClientBuilder.setUserAgent(config.getUserAgent()); + httpClientBuilder.setUserAgent(Constants.USER_AGENT); httpClientBuilder.disableCookieManagement(); + String proxyHost = config.getProxyHost(); int proxyPort = config.getProxyPort(); if (proxyHost != null) { @@ -41,13 +42,13 @@ public CloseableHttpAsyncClient createHttpAsyncClient( String proxyWorkstation = config.getProxyWorkstation(); CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( - new AuthScope(proxyHost, proxyPort), new NTCredentials( - proxyUsername, proxyPassword, proxyWorkstation, - proxyDomain)); + new AuthScope(proxyHost, proxyPort), + new NTCredentials( + proxyUsername, proxyPassword, proxyWorkstation, proxyDomain)); httpClientBuilder.setDefaultCredentialsProvider(credsProvider); } } + return httpClientBuilder.build(); } - } diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ListSearchIndexResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListSearchIndexResponseConsumer.java new file mode 100644 index 0000000..28d2e90 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListSearchIndexResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.protocol.Search; +import com.alicloud.openservices.tablestore.model.search.ListSearchIndexResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class ListSearchIndexResponseConsumer + extends ResponseConsumer { + + public ListSearchIndexResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, ListSearchIndexResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ListSearchIndexResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + Search.ListSearchIndexResponse internalResponse = + (Search.ListSearchIndexResponse) responseContent.getMessage(); + ListSearchIndexResponse response = ResponseFactory.createListSearchIndexResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ListStreamResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListStreamResponseConsumer.java new file mode 100644 index 0000000..b8d0442 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListStreamResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.ListStreamResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class ListStreamResponseConsumer + extends ResponseConsumer { + + public ListStreamResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, ListStreamResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ListStreamResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.ListStreamResponse internalResponse = + (OtsInternalApi.ListStreamResponse) responseContent.getMessage(); + ListStreamResponse response = ResponseFactory.createListStreamResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ListTableResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListTableResponseConsumer.java new file mode 100755 index 0000000..e3c7c9e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListTableResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.ListTableResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class ListTableResponseConsumer + extends ResponseConsumer { + + public ListTableResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, ListTableResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ListTableResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.ListTableResponse internalResponse = + (OtsInternalApi.ListTableResponse) responseContent.getMessage(); + ListTableResponse response = ResponseFactory.createListTableResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ListTunnelResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListTunnelResponseConsumer.java new file mode 100644 index 0000000..7bd338e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ListTunnelResponseConsumer.java @@ -0,0 +1,27 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; + +public class ListTunnelResponseConsumer + extends ResponseConsumer { + public ListTunnelResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, ListTunnelResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ListTunnelResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.ListTunnelResponse tunnelResponse = + (TunnelServiceApi.ListTunnelResponse)responseContent.getMessage(); + ListTunnelResponse response = ResponseFactory.createListTunnelResponse(responseContent, tunnelResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSDeflateResponseHandler.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSDeflateResponseHandler.java new file mode 100755 index 0000000..8a72511 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSDeflateResponseHandler.java @@ -0,0 +1,59 @@ +package com.alicloud.openservices.tablestore.core.http; + +import java.io.InputStream; +import java.util.Map; +import java.util.zip.Inflater; + +import org.apache.http.entity.ByteArrayEntity; + +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.utils.CompressUtil; + +/** + * 检查从OTS服务返回的响应数据是否经过压缩, 若是则进行解压 + */ +public class OTSDeflateResponseHandler implements ResponseHandler { + private final static String OTS_COMPRESS_TYPE = "deflate"; + + @Override + public void handle(ResponseMessage responseData) + throws TableStoreException, ClientException + { + Map header = responseData.getHeadersMap(); + String compressType = header.get(Constants.OTS_HEADER_RESPONSE_COMPRESS_TYPE); + if(compressType != null) { + try{ + if(!OTS_COMPRESS_TYPE.equalsIgnoreCase(compressType.trim())){ + throw new ClientException("Unsupported compress type: " + compressType); + } + String strRawDataSize = header.get(Constants.OTS_HEADER_RESPONSE_COMPRESS_SIZE); + if(strRawDataSize == null){ + throw new ClientException("Required header is not found: " + Constants.OTS_HEADER_RESPONSE_COMPRESS_SIZE); + } + int rawDataSize = 0; + try { + rawDataSize = Integer.valueOf(strRawDataSize); + if(rawDataSize <= 0){ + throw new ClientException("The compress size is invalid: " + rawDataSize); + } + } catch(NumberFormatException e) { + throw new ClientException("The compress size is invalid: " + rawDataSize); + } + InputStream oldInput = responseData.getContent(); + Inflater decompresser = new Inflater(); + byte[] content = CompressUtil.decompress(oldInput, rawDataSize, decompresser); + responseData.getResponse().setEntity(new ByteArrayEntity(content)); + oldInput.close(); + } catch(Exception e) { + throw new ClientException("Decompress response failed.", e); + } + } + else { + // no need decompress, do nothing + } + } + + +} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/OTSUri.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSUri.java similarity index 95% rename from src/main/java/com/aliyun/openservices/ots/comm/OTSUri.java rename to src/main/java/com/alicloud/openservices/tablestore/core/http/OTSUri.java index 9c3b02f..eac7c38 100644 --- a/src/main/java/com/aliyun/openservices/ots/comm/OTSUri.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSUri.java @@ -1,11 +1,11 @@ -package com.aliyun.openservices.ots.comm; - -import org.apache.http.HttpHost; -import org.apache.http.client.utils.URIUtils; +package com.alicloud.openservices.tablestore.core.http; import java.net.URI; import java.net.URISyntaxException; +import org.apache.http.HttpHost; +import org.apache.http.client.utils.URIUtils; + public class OTSUri { private URI uri; private HttpHost host; diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSValidationResponseHandler.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSValidationResponseHandler.java new file mode 100755 index 0000000..bd259c9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/OTSValidationResponseHandler.java @@ -0,0 +1,88 @@ +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.core.http; + +import java.util.Map; +import java.util.TreeMap; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Bytes; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.auth.HmacSHA1Signature; + +import static com.alicloud.openservices.tablestore.core.Constants.*; + +/** + * 验证返回结果。 + * + */ +public class OTSValidationResponseHandler implements ResponseHandler{ + + private ServiceCredentials credentials; + private OTSUri uri; + + public OTSValidationResponseHandler(ServiceCredentials credentials, OTSUri uri){ + Preconditions.checkNotNull(credentials); + Preconditions.checkNotNull(uri); + this.credentials = credentials; + this.uri = uri; + } + + public void handle(ResponseMessage responseData) throws ClientException { + Map headers = responseData.getHeadersMap(); + + // 验证头信息完整性 + if (!headers.containsKey(OTS_HEADER_OTS_CONTENT_MD5)) { + throw new ClientException("MissingHeader: " + OTS_HEADER_OTS_CONTENT_MD5); + } + if (!headers.containsKey(OTS_HEADER_OTS_CONTENT_TYPE)) { + throw new ClientException("MissingHeader: " + OTS_HEADER_OTS_CONTENT_TYPE); + } + if (!headers.containsKey(OTS_HEADER_AUTHORIZATION)) { + throw new ClientException("MissingHeader: " + OTS_HEADER_AUTHORIZATION); + } + + // 验证授权信息 + StringBuilder strToSign = new StringBuilder(1000); + Map sortedMap = new TreeMap(); + sortedMap.putAll(headers); + for(Map.Entry entry : sortedMap.entrySet()) { + String key = entry.getKey(); + String val = entry.getValue(); + if (key.startsWith(OTS_HEADER_PREFIX)){ + strToSign.append(key); + strToSign.append(':'); + strToSign.append(val); + strToSign.append('\n'); + } + } + strToSign.append('/'); + strToSign.append(uri.getAction()); + + HmacSHA1Signature signer = new HmacSHA1Signature(Bytes.toBytes(credentials.getAccessKeySecret())); + signer.updateUTF8String(strToSign.toString()); + String actualSign = signer.computeSignature(); + + String authHeader = headers.get(OTS_HEADER_AUTHORIZATION); + + int posSign = authHeader.indexOf(actualSign); + if (posSign < 0) { + // cannot find signature + throw new ClientException("返回结果授权信息验证失败。"); + } + if (posSign == 0 || authHeader.charAt(posSign - 1) != ':') { + // cannot find separator ':' + throw new ClientException("返回结果授权信息验证失败。"); + } + if (posSign + actualSign.length() != authHeader.length()) { + // signature is not the last part of authHeader + throw new ClientException("返回结果授权信息验证失败。"); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/PutRowResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/PutRowResponseConsumer.java new file mode 100644 index 0000000..9ef1289 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/PutRowResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.PutRowResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class PutRowResponseConsumer extends ResponseConsumer { + + public PutRowResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, PutRowResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected PutRowResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.PutRowResponse putRowResponse = + (OtsInternalApi.PutRowResponse) responseContent.getMessage(); + PutRowResponse result = ResponseFactory.createPutRowResponse( + responseContent, putRowResponse); + return result; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ReadRecordsResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ReadRecordsResponseConsumer.java new file mode 100644 index 0000000..aceeaf9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ReadRecordsResponseConsumer.java @@ -0,0 +1,26 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; + +public class ReadRecordsResponseConsumer + extends ResponseConsumer { + public ReadRecordsResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, ReadRecordsResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ReadRecordsResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.ReadRecordsResponse tunnelResponse = + (TunnelServiceApi.ReadRecordsResponse)responseContent.getMessage(); + return ResponseFactory.createReadRecordsResponse(responseContent, tunnelResponse); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/RequestHandler.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/RequestHandler.java new file mode 100755 index 0000000..4fb30a3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/RequestHandler.java @@ -0,0 +1,12 @@ +package com.alicloud.openservices.tablestore.core.http; + +/** + * 对即将发送的请求数据进行预处理 + */ +public interface RequestHandler { + + /** + * 预处理需要发送的请求数据 + */ + public void handle(RequestMessage message); +} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/RequestMessage.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/RequestMessage.java old mode 100755 new mode 100644 similarity index 57% rename from src/main/java/com/aliyun/openservices/ots/comm/RequestMessage.java rename to src/main/java/com/alicloud/openservices/tablestore/core/http/RequestMessage.java index 6e62fe6..d0fc070 --- a/src/main/java/com/aliyun/openservices/ots/comm/RequestMessage.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/RequestMessage.java @@ -1,54 +1,47 @@ -package com.aliyun.openservices.ots.comm; - -import org.apache.http.client.methods.HttpRequestBase; - -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertStringNotNullOrEmpty; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -public class RequestMessage { - - private HttpRequestBase request; - private Map queryParameters; - private OTSUri actionUri; - private int contentLength = 0; - - public RequestMessage(HttpRequestBase request) { - this.request = request; - } - - public OTSUri getActionUri() { - return actionUri; - } - - public void setActionUri(OTSUri actionUri) { - this.actionUri = actionUri; - } - - public HttpRequestBase getRequest() { - return request; - } - - public void addHeader(String name, String value) { - this.request.addHeader(name, value); - } - - public int getContentLength() { - return contentLength; - } - - public void setContentLength(int contentLength) { - this.contentLength = contentLength; - } - - public Map getQueryParameters() { - return queryParameters; - } - - public void setQueryParameters(Map queryParameters) { - this.queryParameters = queryParameters; - } -} +package com.alicloud.openservices.tablestore.core.http; + +import org.apache.http.client.methods.HttpRequestBase; + +public class RequestMessage { + + private HttpRequestBase request; + private OTSUri actionUri; + private String contentMd5; + private int contentLength = 0; + + public RequestMessage(HttpRequestBase request) { + this.request = request; + } + + public OTSUri getActionUri() { + return actionUri; + } + + public void setActionUri(OTSUri actionUri) { + this.actionUri = actionUri; + } + + public HttpRequestBase getRequest() { + return request; + } + + public void addHeader(String name, String value) { + this.request.addHeader(name, value); + } + + public void setContentMd5(String contentMd5) { + this.contentMd5 = contentMd5; + } + + public String getContentMd5() { + return contentMd5; + } + + public int getContentLength() { + return contentLength; + } + + public void setContentLength(int contentLength) { + this.contentLength = contentLength; + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseConsumer.java similarity index 57% rename from src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncResponseConsumer.java rename to src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseConsumer.java index 14841be..e9ef78c 100755 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncResponseConsumer.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseConsumer.java @@ -1,18 +1,9 @@ -package com.aliyun.openservices.ots.internal; +package com.alicloud.openservices.tablestore.core.http; + +import java.io.IOException; +import java.util.List; -import com.aliyun.openservices.ots.ClientErrorCode; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.comm.ExecutionContext; -import com.aliyun.openservices.ots.comm.ResponseHandler; -import com.aliyun.openservices.ots.comm.ResponseMessage; -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.log.LogUtil; -import com.aliyun.openservices.ots.parser.ResultParseException; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.utils.ResourceManager; -import com.aliyun.openservices.ots.utils.ServiceConstants; import org.apache.http.ContentTooLongException; -import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.entity.ContentType; @@ -23,29 +14,41 @@ import org.apache.http.nio.util.HeapByteBufferAllocator; import org.apache.http.nio.util.SimpleInputBuffer; import org.apache.http.protocol.HttpContext; -import org.apache.http.util.Asserts; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static com.aliyun.openservices.ots.internal.OTSLoggerConstant.*; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.LogUtil; +import com.alicloud.openservices.tablestore.core.http.ResponseMessage; +import com.alicloud.openservices.tablestore.core.http.ExecutionContext; +import com.alicloud.openservices.tablestore.core.http.ResponseHandler; +import com.alicloud.openservices.tablestore.core.protocol.ResultParseException; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.model.RetryStrategy; -public abstract class OTSAsyncResponseConsumer extends - AbstractAsyncResponseConsumer { +public abstract class ResponseConsumer + extends AbstractAsyncResponseConsumer { protected static final int BUFFER_SIZE = 4096; protected volatile HttpResponse httpResponse; protected volatile SimpleInputBuffer buf; protected ResultParser resultParser; protected ExecutionContext context; - protected OTSTraceLogger traceLogger; - protected static ResourceManager rm = ResourceManager - .getInstance(ServiceConstants.RESOURCE_NAME_COMMON); + protected TraceLogger traceLogger; + protected RetryStrategy retry; + protected Res lastResult; - public OTSAsyncResponseConsumer(ResultParser resultParser, OTSTraceLogger traceLogger) { + public ResponseConsumer( + ResultParser resultParser, + TraceLogger traceLogger, + RetryStrategy retry, + Res lastResult) + { this.resultParser = resultParser; this.traceLogger = traceLogger; + this.retry = retry; + this.lastResult = lastResult; } // 创建context和uri在创建Consumer之后,所以要单独set @@ -64,10 +67,10 @@ protected void onResponseReceived(final HttpResponse response) @Override protected Res buildResult(final HttpContext context) throws Exception { if (LogUtil.LOG.isDebugEnabled()) { - LogUtil.LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() - + DELIMITER + RESPONSE_RECEIVED); + LogUtil.LOG.debug(LogUtil.TRACE_ID_WITH_COLON + traceLogger.getTraceId() + + LogUtil.DELIMITER + LogUtil.RESPONSE_RECEIVED); } - traceLogger.addEventTime(RESPONSE_RECEIVED, System.currentTimeMillis()); + traceLogger.addEventTime(LogUtil.RESPONSE_RECEIVED, System.currentTimeMillis()); Res result = parseResult(); return result; } @@ -75,22 +78,29 @@ protected Res buildResult(final HttpContext context) throws Exception { protected ResponseContentWithMeta getResponseContentWithMeta() throws Exception { ResponseMessage response = new ResponseMessage(httpResponse); + String traceInfo = response.getHeader(Constants.OTS_HEADER_TRACE_INFO); + if (traceInfo != null) { + if (LogUtil.LOG.isInfoEnabled()) { + LogUtil.LOG.info( + LogUtil.TRACE_ID_WITH_COLON + traceLogger.getTraceId() + + LogUtil.DELIMITER + LogUtil.SERVER_TRACE_INFO_WITH_COLON + + traceInfo); + } + } ResponseContentWithMeta responseContent; try { - List responseHandlers = this.context - .getResponseHandlers(); + List responseHandlers = + this.context.getResponseHandlers(); for (ResponseHandler h : responseHandlers) { h.handle(response); } responseContent = (ResponseContentWithMeta) resultParser - .getObject(response); + .getObject(response); closeResponseSilently(response); return responseContent; } catch (ResultParseException e) { closeResponseSilently(response); - ClientException ex = new ClientException( - ClientErrorCode.INVALID_RESPONSE, - rm.getFormattedString("FailedToParseResponse"), e); + ClientException ex = new ClientException("Failed to parse response as protocol buffer message.", e); throw ex; } catch (Exception ex) { closeResponseSilently(response); @@ -117,7 +127,7 @@ protected void onEntityEnclosed(final HttpEntity entity, @Override protected void onContentReceived(final ContentDecoder decoder, final IOControl ioctrl) throws IOException { - Asserts.notNull(this.buf, "Content buffer"); + Preconditions.checkNotNull(this.buf, "Content buffer should not be null."); this.buf.consumeContent(decoder); } @@ -135,4 +145,4 @@ private void closeResponseSilently(ResponseMessage response) { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseHandler.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseHandler.java new file mode 100755 index 0000000..5c99188 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseHandler.java @@ -0,0 +1,14 @@ +package com.alicloud.openservices.tablestore.core.http; + +/** + * 对返回结果进行处理。 + */ +public interface ResponseHandler { + + /** + * 处理返回的结果 + * + * @param responseData 返回结果 + */ + public void handle(ResponseMessage responseData); +} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/ResponseMessage.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseMessage.java old mode 100755 new mode 100644 similarity index 91% rename from src/main/java/com/aliyun/openservices/ots/comm/ResponseMessage.java rename to src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseMessage.java index 644553f..83a585d --- a/src/main/java/com/aliyun/openservices/ots/comm/ResponseMessage.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ResponseMessage.java @@ -1,68 +1,64 @@ -package com.aliyun.openservices.ots.comm; - -import org.apache.http.Header; -import org.apache.http.HttpResponse; - -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -/** - * 表示返回结果的信息。 - * - */ -public class ResponseMessage { - private HttpResponse response; - private Map headers; - - private static final int HTTP_SUCCESS_STATUS_CODE = 200; - - public ResponseMessage(HttpResponse response) { - this.response = response; - } - - public int getStatusCode() { - return response.getStatusLine().getStatusCode(); - } - - public String getHeader(String header) { - initHeaderMap(); - - return headers.get(header); - } - - public Map getHeadersMap() { - initHeaderMap(); - return headers; - } - - public HttpResponse getResponse() { - return response; - } - - private void initHeaderMap() { - if (headers == null) { - headers = new HashMap(response.getAllHeaders().length); - for (Header header : response.getAllHeaders()) { - headers.put(header.getName(), header.getValue()); - } - } - } - - /** - * 若返回状态码为2XX,则代表成功。 - * @return 若返回状态码为2XX,则返回true,否则返回false - */ - public boolean isSuccessful(){ - return (getStatusCode() / 100) == (HTTP_SUCCESS_STATUS_CODE / 100); - } - - public InputStream getContent() throws IOException { - return response.getEntity().getContent(); - } - - public void close() throws IOException { - response.getEntity().getContent().close(); - } -} \ No newline at end of file +package com.alicloud.openservices.tablestore.core.http; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.apache.http.Header; +import org.apache.http.HttpResponse; + +public class ResponseMessage { + private HttpResponse response; + private Map headers; + + private static final int HTTP_SUCCESS_STATUS_CODE = 200; + + public ResponseMessage(HttpResponse response) { + this.response = response; + } + + public int getStatusCode() { + return response.getStatusLine().getStatusCode(); + } + + public String getHeader(String header) { + initHeaderMap(); + + return headers.get(header); + } + + public Map getHeadersMap() { + initHeaderMap(); + return headers; + } + + public HttpResponse getResponse() { + return response; + } + + private void initHeaderMap() { + if (headers == null) { + headers = new HashMap(response.getAllHeaders().length); + for (Header header : response.getAllHeaders()) { + headers.put(header.getName(), header.getValue()); + } + } + } + + /** + * 若返回状态码为2XX,则代表成功。 + * @return 若返回状态码为2XX,则返回true,否则返回false + */ + public boolean isSuccessful(){ + return (getStatusCode() / 100) == (HTTP_SUCCESS_STATUS_CODE / 100); + } + + public InputStream getContent() throws IOException { + return response.getEntity().getContent(); + } + + public void close() throws IOException { + response.getEntity().getContent().close(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/SearchResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/SearchResponseConsumer.java new file mode 100644 index 0000000..21a6c07 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/SearchResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.protocol.Search; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.model.search.SearchResponse; + +public class SearchResponseConsumer + extends ResponseConsumer { + + public SearchResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, SearchResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected SearchResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + Search.SearchResponse internalResponse = + (Search.SearchResponse) responseContent.getMessage(); + SearchResponse response = ResponseFactory.createSearchResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/ShutdownTunnelResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/ShutdownTunnelResponseConsumer.java new file mode 100644 index 0000000..060e56c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/ShutdownTunnelResponseConsumer.java @@ -0,0 +1,26 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelResponse; + +public class ShutdownTunnelResponseConsumer + extends ResponseConsumer { + public ShutdownTunnelResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, ShutdownTunnelResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected ShutdownTunnelResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + TunnelServiceApi.ShutdownResponse tunnelResponse = + (TunnelServiceApi.ShutdownResponse)responseContent.getMessage(); + return ResponseFactory.createShutdownTunnelResponse(responseContent, tunnelResponse); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/StartLocalTransactionResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/StartLocalTransactionResponseConsumer.java new file mode 100644 index 0000000..5de21f1 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/StartLocalTransactionResponseConsumer.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.AbortTransactionResponse; +import com.alicloud.openservices.tablestore.model.CreateTableResponse; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; +import com.alicloud.openservices.tablestore.model.StartLocalTransactionResponse; + +public class StartLocalTransactionResponseConsumer + extends ResponseConsumer { + + public StartLocalTransactionResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, StartLocalTransactionResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected StartLocalTransactionResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.StartLocalTransactionResponse internalResponse = + (OtsInternalApi.StartLocalTransactionResponse) responseContent.getMessage(); + StartLocalTransactionResponse response = ResponseFactory.createStartLocalTransactionResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateRowResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateRowResponseConsumer.java new file mode 100644 index 0000000..5333ead --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateRowResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.UpdateRowResponse; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class UpdateRowResponseConsumer extends ResponseConsumer { + + public UpdateRowResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, UpdateRowResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected UpdateRowResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.UpdateRowResponse UpdateRowResponse = + (OtsInternalApi.UpdateRowResponse) responseContent.getMessage(); + UpdateRowResponse result = ResponseFactory.createUpdateRowResponse( + responseContent, UpdateRowResponse); + return result; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateTableResponseConsumer.java b/src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateTableResponseConsumer.java new file mode 100644 index 0000000..e140681 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/http/UpdateTableResponseConsumer.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.core.http; + +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import com.alicloud.openservices.tablestore.model.UpdateTableResponse; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.protocol.ResponseFactory; + +public class UpdateTableResponseConsumer + extends ResponseConsumer { + + public UpdateTableResponseConsumer( + ResultParser resultParser, TraceLogger traceLogger, + RetryStrategy retry, UpdateTableResponse lastResult) { + super(resultParser, traceLogger, retry, lastResult); + } + + @Override + protected UpdateTableResponse parseResult() throws Exception { + ResponseContentWithMeta responseContent = getResponseContentWithMeta(); + OtsInternalApi.UpdateTableResponse internalResponse = + (OtsInternalApi.UpdateTableResponse) responseContent.getMessage(); + UpdateTableResponse response = ResponseFactory.createUpdateTableResponse( + responseContent, internalResponse); + return response; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolBuilder.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolBuilder.java new file mode 100644 index 0000000..3b99d32 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolBuilder.java @@ -0,0 +1,812 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import java.io.IOException; +import java.util.*; +import java.util.Map.Entry; + +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; +import com.alicloud.openservices.tablestore.model.condition.ColumnConditionType; +import com.alicloud.openservices.tablestore.model.filter.*; +import com.google.protobuf.ByteString; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.*; +import com.google.protobuf.Message; + +public class OTSProtocolBuilder { + + public static OtsInternalApi.PrimaryKeyType toPBPrimaryKeyType(PrimaryKeyType type) { + switch(type) { + case INTEGER: + return OtsInternalApi.PrimaryKeyType.INTEGER; + case STRING: + return OtsInternalApi.PrimaryKeyType.STRING; + case BINARY: + return OtsInternalApi.PrimaryKeyType.BINARY; + default: + throw new IllegalArgumentException("Unknown primary key type: " + type); + } + } + + public static OtsInternalApi.PrimaryKeyOption toPBPrimaryKeyOption(PrimaryKeyOption option) { + switch(option) { + case AUTO_INCREMENT: + return OtsInternalApi.PrimaryKeyOption.AUTO_INCREMENT; + default: + throw new IllegalArgumentException("Unknown primary key option: " + option); + } + } + + public static OtsInternalApi.DefinedColumnType toPBDefinedColumnType(DefinedColumnType type) { + switch (type) { + case INTEGER: + return OtsInternalApi.DefinedColumnType.DCT_INTEGER; + case DOUBLE: + return OtsInternalApi.DefinedColumnType.DCT_DOUBLE; + case BOOLEAN: + return OtsInternalApi.DefinedColumnType.DCT_BOOLEAN; + case STRING: + return OtsInternalApi.DefinedColumnType.DCT_STRING; + case BINARY: + return OtsInternalApi.DefinedColumnType.DCT_BLOB; + default: + throw new IllegalArgumentException("Unknown defined column type: " + type); + } + } + + public static OtsInternalApi.IndexType toPBIndexType(IndexType indexType) { + switch (indexType) { + case IT_GLOBAL_INDEX:GLOBAL_INDEX: + return OtsInternalApi.IndexType.IT_GLOBAL_INDEX; + default: + throw new IllegalArgumentException("Unknown index type:" + indexType); + } + } + + public static OtsInternalApi.IndexUpdateMode toPBIndexUpdateMode(IndexUpdateMode indexUpdateMode) { + switch (indexUpdateMode) { + case IUM_ASYNC_INDEX: + return OtsInternalApi.IndexUpdateMode.IUM_ASYNC_INDEX; + default: + throw new IllegalArgumentException("Unknown index update mode" + indexUpdateMode); + } + } + + public static OtsInternalApi.DefinedColumnSchema buildDefinedColumnSchema(DefinedColumnSchema definedColun) { + OtsInternalApi.DefinedColumnSchema.Builder builder = OtsInternalApi.DefinedColumnSchema.newBuilder(); + builder.setName(definedColun.getName()); + builder.setType(toPBDefinedColumnType(definedColun.getType())); + return builder.build(); + } + + public static OtsInternalApi.IndexMeta buildIndexMeta(IndexMeta indexMeta) { + OtsInternalApi.IndexMeta.Builder builder = OtsInternalApi.IndexMeta.newBuilder(); + builder.setName(indexMeta.getIndexName()); + for (String pk : indexMeta.getPrimaryKeyList()) { + builder.addPrimaryKey(pk); + } + for (String definedCol : indexMeta.getDefinedColumnsList()) { + builder.addDefinedColumn(definedCol); + } + builder.setIndexType(toPBIndexType(indexMeta.getIndexType())); + builder.setIndexUpdateMode(toPBIndexUpdateMode(indexMeta.getIndexUpdateMode())); + return builder.build(); + } + + public static OtsInternalApi.TableMeta buildTableMeta(TableMeta tableMeta) { + OtsInternalApi.TableMeta.Builder builder = OtsInternalApi.TableMeta.newBuilder(); + builder.setTableName(tableMeta.getTableName()); + for (PrimaryKeySchema pk : tableMeta.getPrimaryKeyList()) { + builder.addPrimaryKey(buildPrimaryKeySchema(pk)); + } + for (DefinedColumnSchema defCol : tableMeta.getDefinedColumnsList()) { + builder.addDefinedColumn(buildDefinedColumnSchema(defCol)); + } + + return builder.build(); + } + + private static OtsInternalApi.PrimaryKeySchema buildPrimaryKeySchema(PrimaryKeySchema pk) { + OtsInternalApi.PrimaryKeySchema.Builder builder = OtsInternalApi.PrimaryKeySchema.newBuilder(); + builder.setName(pk.getName()); + builder.setType(toPBPrimaryKeyType(pk.getType())); + if (pk.hasOption()) { + builder.setOption(toPBPrimaryKeyOption(pk.getOption())); + } + return builder.build(); + } + + public static OtsInternalApi.GetRowRequest buildGetRowRequest(GetRowRequest request) { + SingleRowQueryCriteria criteria = request.getRowQueryCriteria(); + + OtsInternalApi.GetRowRequest.Builder builder = OtsInternalApi.GetRowRequest.newBuilder(); + + // required string table_name = 1; + builder.setTableName(criteria.getTableName()); + + // required bytes primary_key = 2; + try { + builder.setPrimaryKey(ByteString.copyFrom(PlainBufferBuilder.buildPrimaryKeyWithHeader(criteria.getPrimaryKey()))); + } catch (IOException e) { + throw new ClientException("Bug: serialize primary key failed.", e); + } + + // repeated string columns_to_get = 3; + for (String column : criteria.getColumnsToGet()) { + builder.addColumnsToGet(column); + } + + // optional TimeRange time_range = 4; + boolean onlyOneVersionInTimeRange = false; + if (criteria.hasSetTimeRange()) { + builder.setTimeRange(buildTimeRange(criteria.getTimeRange())); + onlyOneVersionInTimeRange = criteria.getTimeRange().containsOnlyOneVersion(); + } + + // optional int32 max_versions = 5; + if (criteria.hasSetMaxVersions() && !onlyOneVersionInTimeRange) { + builder.setMaxVersions(criteria.getMaxVersions()); + } + + // optional bytes filter = 7; + if (criteria.hasSetFilter()) { + builder.setFilter(buildFilter(criteria.getFilter())); + } + + // optional string start_column = 8; + if (criteria.hasSetStartColumn()) { + builder.setStartColumn(criteria.getStartColumn()); + } + + // optional string end_column = 9; + if (criteria.hasSetEndColumn()) { + builder.setEndColumn(criteria.getEndColumn()); + } + + // optional bytes token = 10; + if (criteria.hasSetToken()) { + builder.setToken(ByteString.copyFrom(criteria.getToken())); + } + + // optional bytes transaction_id = 11; + if (request.hasSetTransactionId()) { + builder.setTransactionId(request.getTransactionId()); + } + return builder.build(); + } + + private static OtsInternalApi.TimeRange buildTimeRange(TimeRange timeRange) { + OtsInternalApi.TimeRange.Builder builder = OtsInternalApi.TimeRange.newBuilder(); + if (timeRange.containsOnlyOneVersion()) { + builder.setSpecificTime(timeRange.getStart()); + } else { + builder.setStartTime(timeRange.getStart()); + builder.setEndTime(timeRange.getEnd()); + } + return builder.build(); + } + + public static OtsInternalApi.CreateTableRequest buildCreateTableRequest(CreateTableRequest createTableRequest) { + OtsInternalApi.CreateTableRequest.Builder builder = OtsInternalApi.CreateTableRequest.newBuilder(); + + // required TableMeta table_meta = 1; + builder.setTableMeta(buildTableMeta(createTableRequest.getTableMeta())); + + // required ReservedThroughput reserved_throughput = 2; + builder.setReservedThroughput(buildReservedThroughput(createTableRequest.getReservedThroughput())); + + // optional TableOptions table_options = 3; + TableOptions tableOptions = createTableRequest.getTableOptions(); + if (!tableOptions.hasSetMaxVersions() || !tableOptions.hasSetTimeToLive()) { + throw new IllegalArgumentException("The maxVersions and timeToLive must be set while creating table."); + } + builder.setTableOptions(buildTableOptions(tableOptions)); + + StreamSpecification streamSpec = createTableRequest.getStreamSpecification(); + if (streamSpec != null) { + builder.setStreamSpec(buildStreamSpecification(streamSpec)); + } + + List indexMeta = createTableRequest.getIndexMetaList(); + for (IndexMeta index : indexMeta) { + builder.addIndexMetas(buildIndexMeta(index)); + } + + return builder.build(); + } + + private static OtsInternalApi.TableOptions buildTableOptions(TableOptions x) { + OtsInternalApi.TableOptions.Builder builder = OtsInternalApi.TableOptions.newBuilder(); + + if (x.hasSetMaxVersions()) { + builder.setMaxVersions(x.getMaxVersions()); + } + + if (x.hasSetTimeToLive()) { + builder.setTimeToLive(x.getTimeToLive()); + } + + if (x.hasSetMaxTimeDeviation()) { + builder.setDeviationCellVersionInSec(x.getMaxTimeDeviation()); + } + + return builder.build(); + } + + private static OtsInternalApi.ReservedThroughput buildReservedThroughput(ReservedThroughput reservedThroughput) { + OtsInternalApi.ReservedThroughput.Builder rtBuilder = OtsInternalApi.ReservedThroughput.newBuilder(); + + CapacityUnit capacityUnit = reservedThroughput.getCapacityUnit(); + OtsInternalApi.CapacityUnit.Builder builder = OtsInternalApi.CapacityUnit.newBuilder(); + + if (capacityUnit.hasSetReadCapacityUnit()) { + builder.setRead(capacityUnit.getReadCapacityUnit()); + } + + if (capacityUnit.hasSetWriteCapacityUnit()) { + builder.setWrite(capacityUnit.getWriteCapacityUnit()); + } + + rtBuilder.setCapacityUnit(builder.build()); + return rtBuilder.build(); + } + + public static OtsInternalApi.DeleteTableRequest buildDeleteTableRequest(DeleteTableRequest req) { + OtsInternalApi.DeleteTableRequest.Builder builder = OtsInternalApi.DeleteTableRequest.newBuilder(); + + // required string table_name = 1; + builder.setTableName(req.getTableName()); + return builder.build(); + } + + public static OtsInternalApi.CreateIndexRequest buildCreateIndexRequest(CreateIndexRequest req) { + OtsInternalApi.CreateIndexRequest.Builder builder = OtsInternalApi.CreateIndexRequest.newBuilder(); + + builder.setMainTableName(req.getMainTableName()); + builder.setIndexMeta(buildIndexMeta(req.getIndexMeta())); + builder.setIncludeBaseData(req.getIncludeBaseData()); + return builder.build(); + } + public static OtsInternalApi.DropIndexRequest buildDeleteIndexRequest(DeleteIndexRequest req) { + OtsInternalApi.DropIndexRequest.Builder builder = OtsInternalApi.DropIndexRequest.newBuilder(); + + builder.setMainTableName(req.getMainTableName()); + builder.setIndexName(req.getIndexName()); + return builder.build(); + } + + public static OtsInternalApi.RowExistenceExpectation toPBRowExistenceExpectation( + RowExistenceExpectation rowExistenceExpectation) { + switch(rowExistenceExpectation) { + case EXPECT_EXIST: + return OtsInternalApi.RowExistenceExpectation.EXPECT_EXIST; + case EXPECT_NOT_EXIST: + return OtsInternalApi.RowExistenceExpectation.EXPECT_NOT_EXIST; + case IGNORE: + return OtsInternalApi.RowExistenceExpectation.IGNORE; + default: + throw new IllegalArgumentException("Invalid row existence expectation: " + rowExistenceExpectation); + } + } + + public static OtsInternalApi.Condition buildCondition(Condition cond) + { + OtsInternalApi.Condition.Builder builder = OtsInternalApi.Condition.newBuilder(); + builder.setRowExistence(toPBRowExistenceExpectation(cond.getRowExistenceExpectation())); + if (cond.getColumnCondition() != null) { + builder.setColumnCondition(buildFilter(cond.getColumnCondition())); + } + + return builder.build(); + } + + public static OtsInternalApi.ReturnContent buildReturnContent(ReturnType returnType, Set returnColumnNames) + { + OtsInternalApi.ReturnContent.Builder builder = OtsInternalApi.ReturnContent.newBuilder(); + builder.setReturnType(toPBReturnType(returnType)); + + for (String column : returnColumnNames) { + builder.addReturnColumnNames(column); + } + + return builder.build(); + } + + private static OtsInternalApi.ReturnType toPBReturnType(ReturnType returnType) + { + switch(returnType) { + case RT_NONE: + return OtsInternalApi.ReturnType.RT_NONE; + case RT_PK: + return OtsInternalApi.ReturnType.RT_PK; + case RT_AFTER_MODIFY: + return OtsInternalApi.ReturnType.RT_AFTER_MODIFY; + default: + throw new IllegalArgumentException("Invalid return type: " + returnType); + } + } + + public static OtsInternalApi.DeleteRowRequest buildDeleteRowRequest(DeleteRowRequest request) { + OtsInternalApi.DeleteRowRequest.Builder builder = OtsInternalApi.DeleteRowRequest.newBuilder(); + + RowDeleteChange rowChange = request.getRowChange(); + // required string table_name = 1; + builder.setTableName(rowChange.getTableName()); + try { + // required bytes primary_key = 2; + builder.setPrimaryKey(ByteString.copyFrom(PlainBufferBuilder.buildRowDeleteChangeWithHeader(rowChange))); + // required Condition condition = 3; + builder.setCondition(buildCondition(rowChange.getCondition())); + // option ReturnType = 4; + builder.setReturnContent(buildReturnContent(rowChange.getReturnType(), rowChange.getReturnColumnNames())); + } catch (IOException e) { + throw new ClientException("Bug: serialize row delete change failed.", e); + } + + // optional bytes transaction_id = 5; + if (request.hasSetTransactionId()) { + builder.setTransactionId(request.getTransactionId()); + } + return builder.build(); + } + + public static OtsInternalApi.PutRowRequest buildPutRowRequest(PutRowRequest request) { + OtsInternalApi.PutRowRequest.Builder builder = OtsInternalApi.PutRowRequest.newBuilder(); + RowPutChange rowChange = request.getRowChange(); + // required string table_name = 1; + builder.setTableName(rowChange.getTableName()); + try { + // required bytes row = 2; + builder.setRow(ByteString.copyFrom(PlainBufferBuilder.buildRowPutChangeWithHeader(rowChange))); + // required Condition condition = 3; + builder.setCondition(buildCondition(rowChange.getCondition())); + // option ReturnType = 4; + builder.setReturnContent(buildReturnContent(rowChange.getReturnType(), rowChange.getReturnColumnNames())); + } catch (IOException e) { + throw new ClientException("Bug: serialize row put change failed.", e); + } + + // optional bytes transaction_id = 5; + if (request.hasSetTransactionId()) { + builder.setTransactionId(request.getTransactionId()); + } + + return builder.build(); + } + + public static OtsInternalApi.ListTableRequest buildListTableRequest() { + OtsInternalApi.ListTableRequest.Builder builder = OtsInternalApi.ListTableRequest.newBuilder(); + return builder.build(); + } + + public static OtsInternalApi.DescribeTableRequest buildDescribeTableRequest(DescribeTableRequest req) { + OtsInternalApi.DescribeTableRequest.Builder builder = OtsInternalApi.DescribeTableRequest.newBuilder(); + + // required string table_name = 1; + builder.setTableName(req.getTableName()); + + return builder.build(); + } + + public static OtsInternalApi.UpdateRowRequest buildUpdateRowRequest(UpdateRowRequest request) { + OtsInternalApi.UpdateRowRequest.Builder builder = OtsInternalApi.UpdateRowRequest.newBuilder(); + RowUpdateChange rowChange = request.getRowChange(); + + // required string table_name = 1; + builder.setTableName(rowChange.getTableName()); + try { + // required bytes row_change = 2; + builder.setRowChange(ByteString.copyFrom(PlainBufferBuilder.buildRowUpdateChangeWithHeader(rowChange))); + // required Condition condition = 3; + builder.setCondition(buildCondition(rowChange.getCondition())); + // option ReturnType = 4; + builder.setReturnContent(buildReturnContent(rowChange.getReturnType(), rowChange.getReturnColumnNames())); + } catch (IOException e) { + throw new ClientException("Bug: serialize row update change failed.", e); + } + + // optional bytes transaction_id = 5; + if (request.hasSetTransactionId()) { + builder.setTransactionId(request.getTransactionId()); + } + + return builder.build(); + } + + public static OtsInternalApi.Direction toPBDirection(Direction direction) { + switch (direction) { + case BACKWARD: + return OtsInternalApi.Direction.BACKWARD; + case FORWARD: + return OtsInternalApi.Direction.FORWARD; + default: + throw new IllegalArgumentException("Invalid direction type: " + direction); + } + } + + public static OtsInternalApi.ComputeSplitPointsBySizeRequest buildComputeSplitsBySizeRequest(ComputeSplitsBySizeRequest req) { + OtsInternalApi.ComputeSplitPointsBySizeRequest.Builder builder = OtsInternalApi.ComputeSplitPointsBySizeRequest.newBuilder(); + + // required string table_name = 1; + builder.setTableName(req.getTableName()); + builder.setSplitSize(req.getSplitUnitCount()); + builder.setSplitSizeUnitInByte(req.getSplitUnitSizeInByte()); + return builder.build(); + } + + public static OtsInternalApi.GetRangeRequest buildGetRangeRequest(GetRangeRequest request) { + RangeRowQueryCriteria criteria = request.getRangeRowQueryCriteria(); + OtsInternalApi.GetRangeRequest.Builder builder = OtsInternalApi.GetRangeRequest.newBuilder(); + // required string table_name = 1; + builder.setTableName(criteria.getTableName()); + + // required Direction direction = 2; + builder.setDirection(toPBDirection(criteria.getDirection())); + + // repeated string columns_to_get = 3; + for (String column : criteria.getColumnsToGet()) { + builder.addColumnsToGet(column); + } + + // optional TimeRange time_range = 4; + boolean onlyOneVersionInTimeRange = false; + if (criteria.hasSetTimeRange()) { + builder.setTimeRange(buildTimeRange(criteria.getTimeRange())); + onlyOneVersionInTimeRange = criteria.getTimeRange().containsOnlyOneVersion(); + } + + // optional int32 max_versions = 5; + if (criteria.hasSetMaxVersions() && !onlyOneVersionInTimeRange) { + builder.setMaxVersions(criteria.getMaxVersions()); + } + + // optional int32 limit = 6; + if (criteria.getLimit() > 0) { + builder.setLimit(criteria.getLimit()); + } + + try { + // required bytes inclusive_start_primary_key = 7; + builder.setInclusiveStartPrimaryKey(ByteString.copyFrom(PlainBufferBuilder.buildPrimaryKeyWithHeader(criteria.getInclusiveStartPrimaryKey()))); + // required bytes exclusive_end_primary_key = 8; + builder.setExclusiveEndPrimaryKey(ByteString.copyFrom(PlainBufferBuilder.buildPrimaryKeyWithHeader(criteria.getExclusiveEndPrimaryKey()))); + } catch (IOException e) { + throw new ClientException("Bug: serialize primary key failed.", e); + } + + // optional bytes filter = 10; + if (criteria.hasSetFilter()) { + builder.setFilter(buildFilter(criteria.getFilter())); + } + + // optional string start_column = 11; + if (criteria.hasSetStartColumn()) { + builder.setStartColumn(criteria.getStartColumn()); + } + + // optional string end_column = 12; + if (criteria.hasSetEndColumn()) { + builder.setEndColumn(criteria.getEndColumn()); + } + + // optional bytes token = 13; + if (criteria.hasSetToken()) { + builder.setToken(ByteString.copyFrom(criteria.getToken())); + } + + // optional bytes transaction_id = 14; + if (request.hasSetTransactionId()) { + builder.setTransactionId(request.getTransactionId()); + } + + return builder.build(); + } + + public static OtsInternalApi.BatchGetRowRequest buildBatchGetRowRequest( + Map criteriasGroupByTable) { + OtsInternalApi.BatchGetRowRequest.Builder builder = OtsInternalApi.BatchGetRowRequest.newBuilder(); + // repeated TableInBatchGetRowResponse tables = 1; + for (Entry entry : criteriasGroupByTable.entrySet()) { + String tableName = entry.getKey(); + MultiRowQueryCriteria criteria = entry.getValue(); + + OtsInternalApi.TableInBatchGetRowRequest.Builder tableBuilder = OtsInternalApi.TableInBatchGetRowRequest.newBuilder(); + // required string table_name = 1; + tableBuilder.setTableName(tableName); + + if (criteria.getRowKeys().size() != criteria.getTokens().size()) { + throw new ClientException("The number of primaryKeys and tokens must be the same."); + } + + // repeated bytes primary_key = 2; + // repeated bytes tokens = 3; + for (int i = 0; i < criteria.getRowKeys().size(); i++) { + try { + tableBuilder.addPrimaryKey(ByteString.copyFrom(PlainBufferBuilder.buildPrimaryKeyWithHeader(criteria.get(i)))); + tableBuilder.addToken(ByteString.copyFrom(criteria.getTokens().get(i))); + } catch (IOException e) { + throw new ClientException("Bug: serialize primary key failed.", e); + } + } + + // repeated string columns_to_get = 4; + for (String column : criteria.getColumnsToGet()) { + tableBuilder.addColumnsToGet(column); + } + + // optional TimeRange time_range = 5; + boolean onlyOneVersionInTimeRange = false; + if (criteria.hasSetTimeRange()) { + tableBuilder.setTimeRange(buildTimeRange(criteria.getTimeRange())); + onlyOneVersionInTimeRange = criteria.getTimeRange().containsOnlyOneVersion(); + } + + // optional int32 max_versions = 6; + if (criteria.hasSetMaxVersions() && !onlyOneVersionInTimeRange) { + tableBuilder.setMaxVersions(criteria.getMaxVersions()); + } + + // optional bytes filter = 8; + if (criteria.hasSetFilter()) { + tableBuilder.setFilter(buildFilter(criteria.getFilter())); + } + + // optional string startColumn = 9; + if (criteria.hasSetStartColumn()) { + tableBuilder.setStartColumn(criteria.getStartColumn()); + } + + // optional string endColumn = 10; + if (criteria.hasSetEndColumn()) { + tableBuilder.setEndColumn(criteria.getEndColumn()); + } + + builder.addTables(tableBuilder.build()); + } + return builder.build(); + } + + public static OtsInternalApi.BatchWriteRowRequest buildBatchWriteRowRequest(BatchWriteRowRequest request) { + OtsInternalApi.BatchWriteRowRequest.Builder builder = OtsInternalApi.BatchWriteRowRequest.newBuilder(); + + for (String tableName : request.getRowChange().keySet()) { + OtsInternalApi.TableInBatchWriteRowRequest.Builder tableBuilder = OtsInternalApi.TableInBatchWriteRowRequest.newBuilder(); + + tableBuilder.setTableName(tableName); + + List rowChanges = request.getRowChange().get(tableName); + if (rowChanges != null && !rowChanges.isEmpty()) { + for (RowChange rowChange : rowChanges) { + try { + OtsInternalApi.RowInBatchWriteRowRequest.Builder rowBuilder = OtsInternalApi.RowInBatchWriteRowRequest.newBuilder(); + if (rowChange instanceof RowPutChange) { + rowBuilder.setType(OtsInternalApi.OperationType.PUT); + rowBuilder.setRowChange(ByteString.copyFrom(PlainBufferBuilder.buildRowPutChangeWithHeader((RowPutChange) rowChange))); + } else if (rowChange instanceof RowUpdateChange) { + rowBuilder.setType(OtsInternalApi.OperationType.UPDATE); + rowBuilder.setRowChange(ByteString.copyFrom(PlainBufferBuilder.buildRowUpdateChangeWithHeader((RowUpdateChange) rowChange))); + } else if (rowChange instanceof RowDeleteChange) { + rowBuilder.setType(OtsInternalApi.OperationType.DELETE); + rowBuilder.setRowChange(ByteString.copyFrom(PlainBufferBuilder.buildRowDeleteChangeWithHeader((RowDeleteChange) rowChange))); + } else { + throw new ClientException("Unknown type of rowChange."); + } + rowBuilder.setCondition(buildCondition(rowChange.getCondition())); + rowBuilder.setReturnContent(buildReturnContent(rowChange.getReturnType(), rowChange.getReturnColumnNames())); + tableBuilder.addRows(rowBuilder.build()); + } catch (IOException e) { + throw new ClientException("Bug: serialize row put change failed.", e); + } + } + } + + builder.addTables(tableBuilder.build()); + } + + // optional bytes transaction_id = 2; + if (request.hasSetTransactionId()) { + builder.setTransactionId(request.getTransactionId()); + } + + return builder.build(); + } + + public static OtsInternalApi.UpdateTableRequest buildUpdateTableRequest(UpdateTableRequest updateTableRequest) { + OtsInternalApi.UpdateTableRequest.Builder builder = OtsInternalApi.UpdateTableRequest.newBuilder(); + // required string table_name = 1; + builder.setTableName(updateTableRequest.getTableName()); + // optional ReservedThroughput reserved_throughput = 2; + if (updateTableRequest.getReservedThroughputForUpdate() != null) { + builder.setReservedThroughput(buildReservedThroughput(updateTableRequest.getReservedThroughputForUpdate())); + } + // optional TableOptionsEx table_options = 3; + if (updateTableRequest.getTableOptionsForUpdate() != null) { + builder.setTableOptions(buildTableOptions(updateTableRequest.getTableOptionsForUpdate())); + } + + if (updateTableRequest.getStreamSpecification() != null) { + builder.setStreamSpec(buildStreamSpecification(updateTableRequest.getStreamSpecification())); + } + + return builder.build(); + } + + private static OtsInternalApi.StreamSpecification buildStreamSpecification(StreamSpecification streamSpecification) { + OtsInternalApi.StreamSpecification.Builder builder = OtsInternalApi.StreamSpecification.newBuilder(); + builder.setEnableStream(streamSpecification.isEnableStream()); + if (streamSpecification.getExpirationTime() > 0) { + builder.setExpirationTime(streamSpecification.getExpirationTime()); + } + return builder.build(); + } + + public static OtsFilter.LogicalOperator toLogicalOperator(CompositeColumnValueFilter.LogicOperator type) { + switch (type) { + case NOT: + return OtsFilter.LogicalOperator.LO_NOT; + case AND: + return OtsFilter.LogicalOperator.LO_AND; + case OR: + return OtsFilter.LogicalOperator.LO_OR; + default: + throw new IllegalArgumentException("Unknown logic operation type: " + type); + } + } + + public static OtsFilter.Filter toFilter(ColumnCondition f) { + OtsFilter.Filter.Builder builder = OtsFilter.Filter.newBuilder(); + builder.setType(toFilterType(f.getConditionType())); + builder.setFilter(f.serialize()); + return builder.build(); + } + + public static OtsFilter.Filter toFilter(Filter f) { + OtsFilter.Filter.Builder builder = OtsFilter.Filter.newBuilder(); + builder.setType(toFilterType(f.getFilterType())); + builder.setFilter(f.serialize()); + return builder.build(); + } + + public static OtsFilter.FilterType toFilterType(ColumnConditionType type) { + switch (type) { + case COMPOSITE_COLUMN_VALUE_CONDITION: + return OtsFilter.FilterType.FT_COMPOSITE_COLUMN_VALUE; + case SINGLE_COLUMN_VALUE_CONDITION: + return OtsFilter.FilterType.FT_SINGLE_COLUMN_VALUE; + default: + throw new IllegalArgumentException("Unknown filter type: " + type); + } + } + + public static OtsFilter.FilterType toFilterType(FilterType type) { + switch (type) { + case COMPOSITE_COLUMN_VALUE_FILTER: + return OtsFilter.FilterType.FT_COMPOSITE_COLUMN_VALUE; + case SINGLE_COLUMN_VALUE_FILTER: + return OtsFilter.FilterType.FT_SINGLE_COLUMN_VALUE; + case COLUMN_PAGINATION_FILTER: + return OtsFilter.FilterType.FT_COLUMN_PAGINATION; + default: + throw new IllegalArgumentException("Unknown filter type: " + type); + } + } + + public static ByteString buildFilter(ColumnCondition filter) { + return toFilter(filter).toByteString(); + } + + public static ByteString buildFilter(Filter filter) { + return toFilter(filter).toByteString(); + } + + public static ByteString buildCompositeColumnValueFilter(CompositeColumnValueFilter filter) { + OtsFilter.CompositeColumnValueFilter.Builder builder = OtsFilter.CompositeColumnValueFilter.newBuilder(); + builder.setCombinator(toLogicalOperator(filter.getOperationType())); + + for (Filter f : filter.getSubFilters()) { + builder.addSubFilters(toFilter(f)); + } + + return builder.build().toByteString(); + } + + public static ByteString buildSingleColumnValueFilter(SingleColumnValueFilter filter) { + OtsFilter.SingleColumnValueFilter.Builder builder = OtsFilter.SingleColumnValueFilter.newBuilder(); + builder.setColumnName(filter.getColumnName()); + builder.setComparator(toComparatorType(filter.getOperator())); + try { + builder.setColumnValue(ByteString.copyFrom(PlainBufferBuilder.buildColumnValueWithoutLengthPrefix(filter.getColumnValue()))); + } catch (IOException e) { + throw new ClientException("Bug: serialize column value failed.", e); + } + builder.setFilterIfMissing(!filter.isPassIfMissing()); + builder.setLatestVersionOnly(filter.isLatestVersionsOnly()); + + return builder.build().toByteString(); + } + + private static OtsFilter.ComparatorType toComparatorType(SingleColumnValueFilter.CompareOperator operator) { + switch (operator) { + case EQUAL: + return OtsFilter.ComparatorType.CT_EQUAL; + case NOT_EQUAL: + return OtsFilter.ComparatorType.CT_NOT_EQUAL; + case GREATER_THAN: + return OtsFilter.ComparatorType.CT_GREATER_THAN; + case GREATER_EQUAL: + return OtsFilter.ComparatorType.CT_GREATER_EQUAL; + case LESS_THAN: + return OtsFilter.ComparatorType.CT_LESS_THAN; + case LESS_EQUAL: + return OtsFilter.ComparatorType.CT_LESS_EQUAL; + default: + throw new IllegalArgumentException("Unknown compare operator: " + operator); + } + } + + public static ByteString buildColumnPaginationFilter(ColumnPaginationFilter filter) { + OtsFilter.ColumnPaginationFilter.Builder builder = OtsFilter.ColumnPaginationFilter.newBuilder(); + builder.setLimit(filter.getLimit()); + builder.setOffset(filter.getOffset()); + return builder.build().toByteString(); + } + + public static Message buildListStreamRequest(ListStreamRequest request) { + OtsInternalApi.ListStreamRequest.Builder builder = OtsInternalApi.ListStreamRequest.newBuilder(); + if (request.getTableName() != null) { + builder.setTableName(request.getTableName()); + } + return builder.build(); + } + + public static OtsInternalApi.DescribeStreamRequest buildDescribeStreamRequest(DescribeStreamRequest request) { + OtsInternalApi.DescribeStreamRequest.Builder builder = OtsInternalApi.DescribeStreamRequest.newBuilder(); + builder.setStreamId(request.getStreamId()); + if (request.getInclusiveStartShardId() != null) { + builder.setInclusiveStartShardId(request.getInclusiveStartShardId()); + } + if (request.getShardLimit() > 0) { + builder.setShardLimit(request.getShardLimit()); + } + return builder.build(); + } + + public static OtsInternalApi.GetShardIteratorRequest buildGetShardIteratorRequest(GetShardIteratorRequest request) { + OtsInternalApi.GetShardIteratorRequest.Builder builder = OtsInternalApi.GetShardIteratorRequest.newBuilder(); + builder.setStreamId(request.getStreamId()); + builder.setShardId(request.getShardId()); + return builder.build(); + } + + public static OtsInternalApi.GetStreamRecordRequest buildGetStreamRecordRequest(GetStreamRecordRequest request) { + OtsInternalApi.GetStreamRecordRequest.Builder builder = OtsInternalApi.GetStreamRecordRequest.newBuilder(); + builder.setShardIterator(request.getShardIterator()); + if (request.getLimit() > 0) { + builder.setLimit(request.getLimit()); + } + return builder.build(); + } + + public static OtsInternalApi.AbortTransactionRequest buildAbortTransactionRequest(AbortTransactionRequest request) { + OtsInternalApi.AbortTransactionRequest.Builder builder = OtsInternalApi.AbortTransactionRequest.newBuilder(); + builder.setTransactionId(request.getTransactionID()); + return builder.build(); + } + + public static OtsInternalApi.StartLocalTransactionRequest buildStartLocalTransactionRequest(StartLocalTransactionRequest request) { + OtsInternalApi.StartLocalTransactionRequest.Builder builder = OtsInternalApi.StartLocalTransactionRequest.newBuilder(); + builder.setTableName(request.getTableName()); + try { + builder.setKey(ByteString.copyFrom(PlainBufferBuilder.buildPrimaryKeyWithHeader(request.getPrimaryKey()))); + } catch (IOException e) { + throw new ClientException("Bug: serialize StartLocalTransactionRequest failed.", e); + } + return builder.build(); + } + + public static OtsInternalApi.CommitTransactionRequest buildCommitTransactionRequest(CommitTransactionRequest request) { + OtsInternalApi.CommitTransactionRequest.Builder builder = OtsInternalApi.CommitTransactionRequest.newBuilder(); + builder.setTransactionId(request.getTransactionID()); + return builder.build(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolParser.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolParser.java new file mode 100644 index 0000000..11001a3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OTSProtocolParser.java @@ -0,0 +1,230 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.*; + +import java.io.IOException; +import java.util.List; + +public class OTSProtocolParser { + public static PrimaryKeyType toPrimaryKeyType(OtsInternalApi.PrimaryKeyType type) { + switch (type) { + case INTEGER: + return PrimaryKeyType.INTEGER; + case STRING: + return PrimaryKeyType.STRING; + case BINARY: + return PrimaryKeyType.BINARY; + default: + throw new IllegalArgumentException("Unknown primary key type: " + type); + } + } + + public static DefinedColumnType toDefinedColumnType(OtsInternalApi.DefinedColumnType type) { + switch (type) { + case DCT_INTEGER: + return DefinedColumnType.INTEGER; + case DCT_DOUBLE: + return DefinedColumnType.DOUBLE; + case DCT_BOOLEAN: + return DefinedColumnType.BOOLEAN; + case DCT_STRING: + return DefinedColumnType.STRING; + case DCT_BLOB: + return DefinedColumnType.BINARY; + default: + throw new IllegalArgumentException("Unknown defined column type: " + type); + } + } + + public static PrimaryKeyOption toPrimaryKeyOption(OtsInternalApi.PrimaryKeyOption option) { + switch (option) { + case AUTO_INCREMENT: + return PrimaryKeyOption.AUTO_INCREMENT; + default: + throw new IllegalArgumentException("Unknown primary key option: " + option); + } + } + + public static TableMeta parseTableMeta(OtsInternalApi.TableMeta tableMeta) { + TableMeta result = new TableMeta(tableMeta.getTableName()); + for (OtsInternalApi.PrimaryKeySchema pk : tableMeta.getPrimaryKeyList()) { + if (pk.hasOption()) { + result.addPrimaryKeyColumn(pk.getName(), toPrimaryKeyType(pk.getType()), toPrimaryKeyOption(pk.getOption())); + } else { + result.addPrimaryKeyColumn(pk.getName(), toPrimaryKeyType(pk.getType())); + } + } + for (OtsInternalApi.DefinedColumnSchema defCol : tableMeta.getDefinedColumnList()) { + DefinedColumnSchema defSchema = new DefinedColumnSchema(defCol.getName(), toDefinedColumnType(defCol.getType())); + result.addDefinedColumn(defSchema); + } + return result; + } + + public static IndexType parseIndexType(OtsInternalApi.IndexType indexType) { + switch (indexType) { + case IT_GLOBAL_INDEX: + return IndexType.IT_GLOBAL_INDEX; + default: + throw new IllegalArgumentException("Unknown index type: " + indexType); + } + } + + public static IndexUpdateMode parseIndexUpdateMode(OtsInternalApi.IndexUpdateMode indexUpdateMode) { + switch (indexUpdateMode) { + case IUM_ASYNC_INDEX: + return IndexUpdateMode.IUM_ASYNC_INDEX; + default: + throw new IllegalArgumentException("Unknown index update mode: " + indexUpdateMode); + } + } + + public static IndexMeta parseIndexMeta(OtsInternalApi.IndexMeta indexMeta) { + IndexMeta result = new IndexMeta(indexMeta.getName()); + for (String pk : indexMeta.getPrimaryKeyList()) { + result.addPrimaryKeyColumn(pk); + } + for (String definedCol : indexMeta.getDefinedColumnList()) { + result.addDefinedColumn(definedCol); + } + result.setIndexType(parseIndexType(indexMeta.getIndexType())); + result.setIndexUpdateMode(parseIndexUpdateMode(indexMeta.getIndexUpdateMode())); + + return result; + } + + public static ReservedThroughputDetails parseReservedThroughputDetails( + OtsInternalApi.ReservedThroughputDetails reservedThroughputDetails) { + return new ReservedThroughputDetails( + parseCapacityUnit(reservedThroughputDetails.getCapacityUnit()), + reservedThroughputDetails.getLastIncreaseTime(), + reservedThroughputDetails.getLastDecreaseTime()); + } + + public static CapacityUnit parseCapacityUnit(OtsInternalApi.CapacityUnit capacityUnit) { + CapacityUnit result = new CapacityUnit(); + if (capacityUnit.hasRead()) { + result.setReadCapacityUnit(capacityUnit.getRead()); + } + + if (capacityUnit.hasWrite()) { + result.setWriteCapacityUnit(capacityUnit.getWrite()); + } + return result; + } + + public static TableOptions parseTableOptions(OtsInternalApi.TableOptions tableOptions) { + TableOptions result = new TableOptions(); + + if (tableOptions.hasDeviationCellVersionInSec()) { + result.setMaxTimeDeviation(tableOptions.getDeviationCellVersionInSec()); + } + + if (tableOptions.hasMaxVersions()) { + result.setMaxVersions(tableOptions.getMaxVersions()); + } + + if (tableOptions.hasTimeToLive()) { + result.setTimeToLive(tableOptions.getTimeToLive()); + } + + return result; + } + + public static BatchGetRowResponse.RowResult parseBatchGetRowStatus(String tableName, OtsInternalApi.RowInBatchGetRowResponse status, int index) { + if (status.getIsOk()) { + Row row = null; + if (!status.getRow().isEmpty()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream(new PlainBufferInputStream(status.getRow().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + row = PlainBufferConversion.toRow(rows.get(0)); + } catch (Exception e) { + throw new ClientException("Failed to parse row data.", e); + } + } + ConsumedCapacity consumedCapacity = new ConsumedCapacity(parseCapacityUnit(status.getConsumed().getCapacityUnit())); + if (status.hasNextToken()) { + return new BatchGetRowResponse.RowResult(tableName, row, consumedCapacity, index, status.getNextToken().toByteArray()); + } else { + return new BatchGetRowResponse.RowResult(tableName, row, consumedCapacity, index); + } + } else { + com.alicloud.openservices.tablestore.model.Error error = new com.alicloud.openservices.tablestore.model.Error(status.getError().getCode(), status.getError().getMessage()); + return new BatchGetRowResponse.RowResult(tableName, error, index); + } + } + + public static BatchWriteRowResponse.RowResult parseBatchWriteRowStatus(String tableName, OtsInternalApi.RowInBatchWriteRowResponse status, int index) { + Row row = null; + if (status.getIsOk()) { + ConsumedCapacity consumedCapacity = new ConsumedCapacity(parseCapacityUnit(status.getConsumed().getCapacityUnit())); + + if (status.hasRow() && !status.getRow().isEmpty()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream(new PlainBufferInputStream(status.getRow().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + row = PlainBufferConversion.toRow(rows.get(0)); + } catch (Exception e) { + throw new ClientException("Failed to parse row data.", e); + } + } + return new BatchWriteRowResponse.RowResult(tableName, row, consumedCapacity, index); + } else { + com.alicloud.openservices.tablestore.model.Error error = new com.alicloud.openservices.tablestore.model.Error(status.getError().getCode(), status.getError().getMessage()); + return new BatchWriteRowResponse.RowResult(tableName, row, error, index); + } + } + + public static StreamDetails parseStreamDetails(OtsInternalApi.StreamDetails streamDetails) { + StreamDetails result = new StreamDetails(); + result.setEnableStream(streamDetails.getEnableStream()); + if (streamDetails.hasStreamId()) { + result.setStreamId(streamDetails.getStreamId()); + } + if (streamDetails.hasExpirationTime()) { + result.setExpirationTime(streamDetails.getExpirationTime()); + } + if (streamDetails.hasLastEnableTime()) { + result.setLastEnableTime(streamDetails.getLastEnableTime()); + } + return result; + } + + public static Stream parseStream(OtsInternalApi.Stream stream) { + Stream result = new Stream(); + result.setStreamId(stream.getStreamId()); + result.setTableName(stream.getTableName()); + result.setCreationTime(stream.getCreationTime()); + return result; + } + + public static StreamShard parseStreamShard(OtsInternalApi.StreamShard streamShard) { + StreamShard result = new StreamShard(streamShard.getShardId()); + if (streamShard.hasParentId()) { + result.setParentId(streamShard.getParentId()); + } + if (streamShard.hasParentSiblingId()) { + result.setParentSiblingId(streamShard.getParentSiblingId()); + } + return result; + } + + public static StreamStatus parseStreamStatus(OtsInternalApi.StreamStatus status) { + switch (status) { + case STREAM_ENABLING: + return StreamStatus.ENABLING; + case STREAM_ACTIVE: + return StreamStatus.ACTIVE; + default: + throw new ClientException("Unknown stream status:" + status); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsFilter.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsFilter.java new file mode 100644 index 0000000..7839d7b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsFilter.java @@ -0,0 +1,2466 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ots_filter.proto + +package com.alicloud.openservices.tablestore.core.protocol; + +public final class OtsFilter { + private OtsFilter() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public enum FilterType + implements com.google.protobuf.ProtocolMessageEnum { + FT_SINGLE_COLUMN_VALUE(0, 1), + FT_COMPOSITE_COLUMN_VALUE(1, 2), + FT_COLUMN_PAGINATION(2, 3), + ; + + public static final int FT_SINGLE_COLUMN_VALUE_VALUE = 1; + public static final int FT_COMPOSITE_COLUMN_VALUE_VALUE = 2; + public static final int FT_COLUMN_PAGINATION_VALUE = 3; + + + public final int getNumber() { return value; } + + public static FilterType valueOf(int value) { + switch (value) { + case 1: return FT_SINGLE_COLUMN_VALUE; + case 2: return FT_COMPOSITE_COLUMN_VALUE; + case 3: return FT_COLUMN_PAGINATION; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public FilterType findValueByNumber(int number) { + return FilterType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.getDescriptor().getEnumTypes().get(0); + } + + private static final FilterType[] VALUES = { + FT_SINGLE_COLUMN_VALUE, FT_COMPOSITE_COLUMN_VALUE, FT_COLUMN_PAGINATION, + }; + + public static FilterType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private FilterType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.FilterType) + } + + public enum ComparatorType + implements com.google.protobuf.ProtocolMessageEnum { + CT_EQUAL(0, 1), + CT_NOT_EQUAL(1, 2), + CT_GREATER_THAN(2, 3), + CT_GREATER_EQUAL(3, 4), + CT_LESS_THAN(4, 5), + CT_LESS_EQUAL(5, 6), + ; + + public static final int CT_EQUAL_VALUE = 1; + public static final int CT_NOT_EQUAL_VALUE = 2; + public static final int CT_GREATER_THAN_VALUE = 3; + public static final int CT_GREATER_EQUAL_VALUE = 4; + public static final int CT_LESS_THAN_VALUE = 5; + public static final int CT_LESS_EQUAL_VALUE = 6; + + + public final int getNumber() { return value; } + + public static ComparatorType valueOf(int value) { + switch (value) { + case 1: return CT_EQUAL; + case 2: return CT_NOT_EQUAL; + case 3: return CT_GREATER_THAN; + case 4: return CT_GREATER_EQUAL; + case 5: return CT_LESS_THAN; + case 6: return CT_LESS_EQUAL; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ComparatorType findValueByNumber(int number) { + return ComparatorType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.getDescriptor().getEnumTypes().get(1); + } + + private static final ComparatorType[] VALUES = { + CT_EQUAL, CT_NOT_EQUAL, CT_GREATER_THAN, CT_GREATER_EQUAL, CT_LESS_THAN, CT_LESS_EQUAL, + }; + + public static ComparatorType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private ComparatorType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ComparatorType) + } + + public enum LogicalOperator + implements com.google.protobuf.ProtocolMessageEnum { + LO_NOT(0, 1), + LO_AND(1, 2), + LO_OR(2, 3), + ; + + public static final int LO_NOT_VALUE = 1; + public static final int LO_AND_VALUE = 2; + public static final int LO_OR_VALUE = 3; + + + public final int getNumber() { return value; } + + public static LogicalOperator valueOf(int value) { + switch (value) { + case 1: return LO_NOT; + case 2: return LO_AND; + case 3: return LO_OR; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public LogicalOperator findValueByNumber(int number) { + return LogicalOperator.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.getDescriptor().getEnumTypes().get(2); + } + + private static final LogicalOperator[] VALUES = { + LO_NOT, LO_AND, LO_OR, + }; + + public static LogicalOperator valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private LogicalOperator(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.LogicalOperator) + } + + public interface SingleColumnValueFilterOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ComparatorType comparator = 1; + boolean hasComparator(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType getComparator(); + + // required string column_name = 2; + boolean hasColumnName(); + String getColumnName(); + + // required bytes column_value = 3; + boolean hasColumnValue(); + com.google.protobuf.ByteString getColumnValue(); + + // required bool filter_if_missing = 4; + boolean hasFilterIfMissing(); + boolean getFilterIfMissing(); + + // required bool latest_version_only = 5; + boolean hasLatestVersionOnly(); + boolean getLatestVersionOnly(); + } + public static final class SingleColumnValueFilter extends + com.google.protobuf.GeneratedMessage + implements SingleColumnValueFilterOrBuilder { + // Use SingleColumnValueFilter.newBuilder() to construct. + private SingleColumnValueFilter(Builder builder) { + super(builder); + } + private SingleColumnValueFilter(boolean noInit) {} + + private static final SingleColumnValueFilter defaultInstance; + public static SingleColumnValueFilter getDefaultInstance() { + return defaultInstance; + } + + public SingleColumnValueFilter getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ComparatorType comparator = 1; + public static final int COMPARATOR_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType comparator_; + public boolean hasComparator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType getComparator() { + return comparator_; + } + + // required string column_name = 2; + public static final int COLUMN_NAME_FIELD_NUMBER = 2; + private java.lang.Object columnName_; + public boolean hasColumnName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getColumnName() { + java.lang.Object ref = columnName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + columnName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getColumnNameBytes() { + java.lang.Object ref = columnName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + columnName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required bytes column_value = 3; + public static final int COLUMN_VALUE_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString columnValue_; + public boolean hasColumnValue() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getColumnValue() { + return columnValue_; + } + + // required bool filter_if_missing = 4; + public static final int FILTER_IF_MISSING_FIELD_NUMBER = 4; + private boolean filterIfMissing_; + public boolean hasFilterIfMissing() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public boolean getFilterIfMissing() { + return filterIfMissing_; + } + + // required bool latest_version_only = 5; + public static final int LATEST_VERSION_ONLY_FIELD_NUMBER = 5; + private boolean latestVersionOnly_; + public boolean hasLatestVersionOnly() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getLatestVersionOnly() { + return latestVersionOnly_; + } + + private void initFields() { + comparator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType.CT_EQUAL; + columnName_ = ""; + columnValue_ = com.google.protobuf.ByteString.EMPTY; + filterIfMissing_ = false; + latestVersionOnly_ = false; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasComparator()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasColumnName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasColumnValue()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasFilterIfMissing()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLatestVersionOnly()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, comparator_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getColumnNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, columnValue_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBool(4, filterIfMissing_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBool(5, latestVersionOnly_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, comparator_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getColumnNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, columnValue_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, filterIfMissing_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, latestVersionOnly_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + comparator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType.CT_EQUAL; + bitField0_ = (bitField0_ & ~0x00000001); + columnName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + columnValue_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + filterIfMissing_ = false; + bitField0_ = (bitField0_ & ~0x00000008); + latestVersionOnly_ = false; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter build() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter result = new com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.comparator_ = comparator_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.columnName_ = columnName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.columnValue_ = columnValue_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.filterIfMissing_ = filterIfMissing_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.latestVersionOnly_ = latestVersionOnly_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter.getDefaultInstance()) return this; + if (other.hasComparator()) { + setComparator(other.getComparator()); + } + if (other.hasColumnName()) { + setColumnName(other.getColumnName()); + } + if (other.hasColumnValue()) { + setColumnValue(other.getColumnValue()); + } + if (other.hasFilterIfMissing()) { + setFilterIfMissing(other.getFilterIfMissing()); + } + if (other.hasLatestVersionOnly()) { + setLatestVersionOnly(other.getLatestVersionOnly()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasComparator()) { + + return false; + } + if (!hasColumnName()) { + + return false; + } + if (!hasColumnValue()) { + + return false; + } + if (!hasFilterIfMissing()) { + + return false; + } + if (!hasLatestVersionOnly()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType value = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + comparator_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + columnName_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + columnValue_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + filterIfMissing_ = input.readBool(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + latestVersionOnly_ = input.readBool(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ComparatorType comparator = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType comparator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType.CT_EQUAL; + public boolean hasComparator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType getComparator() { + return comparator_; + } + public Builder setComparator(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + comparator_ = value; + onChanged(); + return this; + } + public Builder clearComparator() { + bitField0_ = (bitField0_ & ~0x00000001); + comparator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ComparatorType.CT_EQUAL; + onChanged(); + return this; + } + + // required string column_name = 2; + private java.lang.Object columnName_ = ""; + public boolean hasColumnName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getColumnName() { + java.lang.Object ref = columnName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + columnName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setColumnName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + columnName_ = value; + onChanged(); + return this; + } + public Builder clearColumnName() { + bitField0_ = (bitField0_ & ~0x00000002); + columnName_ = getDefaultInstance().getColumnName(); + onChanged(); + return this; + } + void setColumnName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + columnName_ = value; + onChanged(); + } + + // required bytes column_value = 3; + private com.google.protobuf.ByteString columnValue_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasColumnValue() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getColumnValue() { + return columnValue_; + } + public Builder setColumnValue(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + columnValue_ = value; + onChanged(); + return this; + } + public Builder clearColumnValue() { + bitField0_ = (bitField0_ & ~0x00000004); + columnValue_ = getDefaultInstance().getColumnValue(); + onChanged(); + return this; + } + + // required bool filter_if_missing = 4; + private boolean filterIfMissing_ ; + public boolean hasFilterIfMissing() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public boolean getFilterIfMissing() { + return filterIfMissing_; + } + public Builder setFilterIfMissing(boolean value) { + bitField0_ |= 0x00000008; + filterIfMissing_ = value; + onChanged(); + return this; + } + public Builder clearFilterIfMissing() { + bitField0_ = (bitField0_ & ~0x00000008); + filterIfMissing_ = false; + onChanged(); + return this; + } + + // required bool latest_version_only = 5; + private boolean latestVersionOnly_ ; + public boolean hasLatestVersionOnly() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getLatestVersionOnly() { + return latestVersionOnly_; + } + public Builder setLatestVersionOnly(boolean value) { + bitField0_ |= 0x00000010; + latestVersionOnly_ = value; + onChanged(); + return this; + } + public Builder clearLatestVersionOnly() { + bitField0_ = (bitField0_ & ~0x00000010); + latestVersionOnly_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.SingleColumnValueFilter) + } + + static { + defaultInstance = new SingleColumnValueFilter(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.SingleColumnValueFilter) + } + + public interface CompositeColumnValueFilterOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.LogicalOperator combinator = 1; + boolean hasCombinator(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator getCombinator(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Filter sub_filters = 2; + java.util.List + getSubFiltersList(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter getSubFilters(int index); + int getSubFiltersCount(); + java.util.List + getSubFiltersOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterOrBuilder getSubFiltersOrBuilder( + int index); + } + public static final class CompositeColumnValueFilter extends + com.google.protobuf.GeneratedMessage + implements CompositeColumnValueFilterOrBuilder { + // Use CompositeColumnValueFilter.newBuilder() to construct. + private CompositeColumnValueFilter(Builder builder) { + super(builder); + } + private CompositeColumnValueFilter(boolean noInit) {} + + private static final CompositeColumnValueFilter defaultInstance; + public static CompositeColumnValueFilter getDefaultInstance() { + return defaultInstance; + } + + public CompositeColumnValueFilter getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.LogicalOperator combinator = 1; + public static final int COMBINATOR_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator combinator_; + public boolean hasCombinator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator getCombinator() { + return combinator_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Filter sub_filters = 2; + public static final int SUB_FILTERS_FIELD_NUMBER = 2; + private java.util.List subFilters_; + public java.util.List getSubFiltersList() { + return subFilters_; + } + public java.util.List + getSubFiltersOrBuilderList() { + return subFilters_; + } + public int getSubFiltersCount() { + return subFilters_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter getSubFilters(int index) { + return subFilters_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterOrBuilder getSubFiltersOrBuilder( + int index) { + return subFilters_.get(index); + } + + private void initFields() { + combinator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator.LO_NOT; + subFilters_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasCombinator()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getSubFiltersCount(); i++) { + if (!getSubFilters(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, combinator_.getNumber()); + } + for (int i = 0; i < subFilters_.size(); i++) { + output.writeMessage(2, subFilters_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, combinator_.getNumber()); + } + for (int i = 0; i < subFilters_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, subFilters_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getSubFiltersFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + combinator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator.LO_NOT; + bitField0_ = (bitField0_ & ~0x00000001); + if (subFiltersBuilder_ == null) { + subFilters_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + subFiltersBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter build() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter result = new com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.combinator_ = combinator_; + if (subFiltersBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + subFilters_ = java.util.Collections.unmodifiableList(subFilters_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.subFilters_ = subFilters_; + } else { + result.subFilters_ = subFiltersBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter.getDefaultInstance()) return this; + if (other.hasCombinator()) { + setCombinator(other.getCombinator()); + } + if (subFiltersBuilder_ == null) { + if (!other.subFilters_.isEmpty()) { + if (subFilters_.isEmpty()) { + subFilters_ = other.subFilters_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureSubFiltersIsMutable(); + subFilters_.addAll(other.subFilters_); + } + onChanged(); + } + } else { + if (!other.subFilters_.isEmpty()) { + if (subFiltersBuilder_.isEmpty()) { + subFiltersBuilder_.dispose(); + subFiltersBuilder_ = null; + subFilters_ = other.subFilters_; + bitField0_ = (bitField0_ & ~0x00000002); + subFiltersBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getSubFiltersFieldBuilder() : null; + } else { + subFiltersBuilder_.addAllMessages(other.subFilters_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasCombinator()) { + + return false; + } + for (int i = 0; i < getSubFiltersCount(); i++) { + if (!getSubFilters(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator value = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + combinator_ = value; + } + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addSubFilters(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.LogicalOperator combinator = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator combinator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator.LO_NOT; + public boolean hasCombinator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator getCombinator() { + return combinator_; + } + public Builder setCombinator(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + combinator_ = value; + onChanged(); + return this; + } + public Builder clearCombinator() { + bitField0_ = (bitField0_ & ~0x00000001); + combinator_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.LogicalOperator.LO_NOT; + onChanged(); + return this; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Filter sub_filters = 2; + private java.util.List subFilters_ = + java.util.Collections.emptyList(); + private void ensureSubFiltersIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + subFilters_ = new java.util.ArrayList(subFilters_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterOrBuilder> subFiltersBuilder_; + + public java.util.List getSubFiltersList() { + if (subFiltersBuilder_ == null) { + return java.util.Collections.unmodifiableList(subFilters_); + } else { + return subFiltersBuilder_.getMessageList(); + } + } + public int getSubFiltersCount() { + if (subFiltersBuilder_ == null) { + return subFilters_.size(); + } else { + return subFiltersBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter getSubFilters(int index) { + if (subFiltersBuilder_ == null) { + return subFilters_.get(index); + } else { + return subFiltersBuilder_.getMessage(index); + } + } + public Builder setSubFilters( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter value) { + if (subFiltersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSubFiltersIsMutable(); + subFilters_.set(index, value); + onChanged(); + } else { + subFiltersBuilder_.setMessage(index, value); + } + return this; + } + public Builder setSubFilters( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder builderForValue) { + if (subFiltersBuilder_ == null) { + ensureSubFiltersIsMutable(); + subFilters_.set(index, builderForValue.build()); + onChanged(); + } else { + subFiltersBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addSubFilters(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter value) { + if (subFiltersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSubFiltersIsMutable(); + subFilters_.add(value); + onChanged(); + } else { + subFiltersBuilder_.addMessage(value); + } + return this; + } + public Builder addSubFilters( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter value) { + if (subFiltersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSubFiltersIsMutable(); + subFilters_.add(index, value); + onChanged(); + } else { + subFiltersBuilder_.addMessage(index, value); + } + return this; + } + public Builder addSubFilters( + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder builderForValue) { + if (subFiltersBuilder_ == null) { + ensureSubFiltersIsMutable(); + subFilters_.add(builderForValue.build()); + onChanged(); + } else { + subFiltersBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addSubFilters( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder builderForValue) { + if (subFiltersBuilder_ == null) { + ensureSubFiltersIsMutable(); + subFilters_.add(index, builderForValue.build()); + onChanged(); + } else { + subFiltersBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllSubFilters( + java.lang.Iterable values) { + if (subFiltersBuilder_ == null) { + ensureSubFiltersIsMutable(); + super.addAll(values, subFilters_); + onChanged(); + } else { + subFiltersBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearSubFilters() { + if (subFiltersBuilder_ == null) { + subFilters_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + subFiltersBuilder_.clear(); + } + return this; + } + public Builder removeSubFilters(int index) { + if (subFiltersBuilder_ == null) { + ensureSubFiltersIsMutable(); + subFilters_.remove(index); + onChanged(); + } else { + subFiltersBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder getSubFiltersBuilder( + int index) { + return getSubFiltersFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterOrBuilder getSubFiltersOrBuilder( + int index) { + if (subFiltersBuilder_ == null) { + return subFilters_.get(index); } else { + return subFiltersBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getSubFiltersOrBuilderList() { + if (subFiltersBuilder_ != null) { + return subFiltersBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(subFilters_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder addSubFiltersBuilder() { + return getSubFiltersFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder addSubFiltersBuilder( + int index) { + return getSubFiltersFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.getDefaultInstance()); + } + public java.util.List + getSubFiltersBuilderList() { + return getSubFiltersFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterOrBuilder> + getSubFiltersFieldBuilder() { + if (subFiltersBuilder_ == null) { + subFiltersBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterOrBuilder>( + subFilters_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + subFilters_ = null; + } + return subFiltersBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CompositeColumnValueFilter) + } + + static { + defaultInstance = new CompositeColumnValueFilter(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CompositeColumnValueFilter) + } + + public interface ColumnPaginationFilterOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required int32 offset = 1; + boolean hasOffset(); + int getOffset(); + + // required int32 limit = 2; + boolean hasLimit(); + int getLimit(); + } + public static final class ColumnPaginationFilter extends + com.google.protobuf.GeneratedMessage + implements ColumnPaginationFilterOrBuilder { + // Use ColumnPaginationFilter.newBuilder() to construct. + private ColumnPaginationFilter(Builder builder) { + super(builder); + } + private ColumnPaginationFilter(boolean noInit) {} + + private static final ColumnPaginationFilter defaultInstance; + public static ColumnPaginationFilter getDefaultInstance() { + return defaultInstance; + } + + public ColumnPaginationFilter getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_fieldAccessorTable; + } + + private int bitField0_; + // required int32 offset = 1; + public static final int OFFSET_FIELD_NUMBER = 1; + private int offset_; + public boolean hasOffset() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getOffset() { + return offset_; + } + + // required int32 limit = 2; + public static final int LIMIT_FIELD_NUMBER = 2; + private int limit_; + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getLimit() { + return limit_; + } + + private void initFields() { + offset_ = 0; + limit_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasOffset()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLimit()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(1, offset_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(2, limit_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, offset_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, limit_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + offset_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + limit_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter build() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter result = new com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.limit_ = limit_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter.getDefaultInstance()) return this; + if (other.hasOffset()) { + setOffset(other.getOffset()); + } + if (other.hasLimit()) { + setLimit(other.getLimit()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasOffset()) { + + return false; + } + if (!hasLimit()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + offset_ = input.readInt32(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + limit_ = input.readInt32(); + break; + } + } + } + } + + private int bitField0_; + + // required int32 offset = 1; + private int offset_ ; + public boolean hasOffset() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getOffset() { + return offset_; + } + public Builder setOffset(int value) { + bitField0_ |= 0x00000001; + offset_ = value; + onChanged(); + return this; + } + public Builder clearOffset() { + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0; + onChanged(); + return this; + } + + // required int32 limit = 2; + private int limit_ ; + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getLimit() { + return limit_; + } + public Builder setLimit(int value) { + bitField0_ |= 0x00000002; + limit_ = value; + onChanged(); + return this; + } + public Builder clearLimit() { + bitField0_ = (bitField0_ & ~0x00000002); + limit_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ColumnPaginationFilter) + } + + static { + defaultInstance = new ColumnPaginationFilter(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ColumnPaginationFilter) + } + + public interface FilterOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.FilterType type = 1; + boolean hasType(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType getType(); + + // required bytes filter = 2; + boolean hasFilter(); + com.google.protobuf.ByteString getFilter(); + } + public static final class Filter extends + com.google.protobuf.GeneratedMessage + implements FilterOrBuilder { + // Use Filter.newBuilder() to construct. + private Filter(Builder builder) { + super(builder); + } + private Filter(boolean noInit) {} + + private static final Filter defaultInstance; + public static Filter getDefaultInstance() { + return defaultInstance; + } + + public Filter getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.FilterType type = 1; + public static final int TYPE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType type_; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType getType() { + return type_; + } + + // required bytes filter = 2; + public static final int FILTER_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString filter_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + + private void initFields() { + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType.FT_SINGLE_COLUMN_VALUE; + filter_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasFilter()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, filter_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, filter_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType.FT_SINGLE_COLUMN_VALUE; + bitField0_ = (bitField0_ & ~0x00000001); + filter_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter build() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter result = new com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.filter_ = filter_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.getDefaultInstance()) return this; + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasFilter()) { + setFilter(other.getFilter()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasType()) { + + return false; + } + if (!hasFilter()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType value = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + type_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + filter_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.FilterType type = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType type_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType.FT_SINGLE_COLUMN_VALUE; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType getType() { + return type_; + } + public Builder setType(com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + type_ = value; + onChanged(); + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000001); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsFilter.FilterType.FT_SINGLE_COLUMN_VALUE; + onChanged(); + return this; + } + + // required bytes filter = 2; + private com.google.protobuf.ByteString filter_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasFilter() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + public Builder setFilter(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + filter_ = value; + onChanged(); + return this; + } + public Builder clearFilter() { + bitField0_ = (bitField0_ & ~0x00000002); + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Filter) + } + + static { + defaultInstance = new Filter(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Filter) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\020ots_filter.proto\0222com.alicloud.openser" + + "vices.tablestore.core.protocol\"\324\001\n\027Singl" + + "eColumnValueFilter\022V\n\ncomparator\030\001 \002(\0162B" + + ".com.alicloud.openservices.tablestore.co" + + "re.protocol.ComparatorType\022\023\n\013column_nam" + + "e\030\002 \002(\t\022\024\n\014column_value\030\003 \002(\014\022\031\n\021filter_" + + "if_missing\030\004 \002(\010\022\033\n\023latest_version_only\030" + + "\005 \002(\010\"\306\001\n\032CompositeColumnValueFilter\022W\n\n" + + "combinator\030\001 \002(\0162C.com.alicloud.openserv" + + "ices.tablestore.core.protocol.LogicalOpe", + "rator\022O\n\013sub_filters\030\002 \003(\0132:.com.aliclou" + + "d.openservices.tablestore.core.protocol." + + "Filter\"7\n\026ColumnPaginationFilter\022\016\n\006offs" + + "et\030\001 \002(\005\022\r\n\005limit\030\002 \002(\005\"f\n\006Filter\022L\n\004typ" + + "e\030\001 \002(\0162>.com.alicloud.openservices.tabl" + + "estore.core.protocol.FilterType\022\016\n\006filte" + + "r\030\002 \002(\014*a\n\nFilterType\022\032\n\026FT_SINGLE_COLUM" + + "N_VALUE\020\001\022\035\n\031FT_COMPOSITE_COLUMN_VALUE\020\002" + + "\022\030\n\024FT_COLUMN_PAGINATION\020\003*\200\001\n\016Comparato" + + "rType\022\014\n\010CT_EQUAL\020\001\022\020\n\014CT_NOT_EQUAL\020\002\022\023\n", + "\017CT_GREATER_THAN\020\003\022\024\n\020CT_GREATER_EQUAL\020\004" + + "\022\020\n\014CT_LESS_THAN\020\005\022\021\n\rCT_LESS_EQUAL\020\006*4\n" + + "\017LogicalOperator\022\n\n\006LO_NOT\020\001\022\n\n\006LO_AND\020\002" + + "\022\t\n\005LO_OR\020\003" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_SingleColumnValueFilter_descriptor, + new java.lang.String[] { "Comparator", "ColumnName", "ColumnValue", "FilterIfMissing", "LatestVersionOnly", }, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter.class, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.SingleColumnValueFilter.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CompositeColumnValueFilter_descriptor, + new java.lang.String[] { "Combinator", "SubFilters", }, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter.class, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.CompositeColumnValueFilter.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnPaginationFilter_descriptor, + new java.lang.String[] { "Offset", "Limit", }, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter.class, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.ColumnPaginationFilter.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Filter_descriptor, + new java.lang.String[] { "Type", "Filter", }, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.class, + com.alicloud.openservices.tablestore.core.protocol.OtsFilter.Filter.Builder.class); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsInternalApi.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsInternalApi.java new file mode 100644 index 0000000..b3d2ae8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/OtsInternalApi.java @@ -0,0 +1,44516 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ots_internal_api.proto + +package com.alicloud.openservices.tablestore.core.protocol; + +public final class OtsInternalApi { + private OtsInternalApi() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public enum PrimaryKeyType + implements com.google.protobuf.ProtocolMessageEnum { + INTEGER(0, 1), + STRING(1, 2), + BINARY(2, 3), + ; + + public static final int INTEGER_VALUE = 1; + public static final int STRING_VALUE = 2; + public static final int BINARY_VALUE = 3; + + + public final int getNumber() { return value; } + + public static PrimaryKeyType valueOf(int value) { + switch (value) { + case 1: return INTEGER; + case 2: return STRING; + case 3: return BINARY; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public PrimaryKeyType findValueByNumber(int number) { + return PrimaryKeyType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(0); + } + + private static final PrimaryKeyType[] VALUES = { + INTEGER, STRING, BINARY, + }; + + public static PrimaryKeyType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private PrimaryKeyType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyType) + } + + public enum DefinedColumnType + implements com.google.protobuf.ProtocolMessageEnum { + DCT_INTEGER(0, 1), + DCT_DOUBLE(1, 2), + DCT_BOOLEAN(2, 3), + DCT_STRING(3, 4), + DCT_BLOB(4, 7), + ; + + public static final int DCT_INTEGER_VALUE = 1; + public static final int DCT_DOUBLE_VALUE = 2; + public static final int DCT_BOOLEAN_VALUE = 3; + public static final int DCT_STRING_VALUE = 4; + public static final int DCT_BLOB_VALUE = 7; + + + public final int getNumber() { return value; } + + public static DefinedColumnType valueOf(int value) { + switch (value) { + case 1: return DCT_INTEGER; + case 2: return DCT_DOUBLE; + case 3: return DCT_BOOLEAN; + case 4: return DCT_STRING; + case 7: return DCT_BLOB; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public DefinedColumnType findValueByNumber(int number) { + return DefinedColumnType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(1); + } + + private static final DefinedColumnType[] VALUES = { + DCT_INTEGER, DCT_DOUBLE, DCT_BOOLEAN, DCT_STRING, DCT_BLOB, + }; + + public static DefinedColumnType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private DefinedColumnType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.DefinedColumnType) + } + + public enum PrimaryKeyOption + implements com.google.protobuf.ProtocolMessageEnum { + AUTO_INCREMENT(0, 1), + ; + + public static final int AUTO_INCREMENT_VALUE = 1; + + + public final int getNumber() { return value; } + + public static PrimaryKeyOption valueOf(int value) { + switch (value) { + case 1: return AUTO_INCREMENT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public PrimaryKeyOption findValueByNumber(int number) { + return PrimaryKeyOption.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(2); + } + + private static final PrimaryKeyOption[] VALUES = { + AUTO_INCREMENT, + }; + + public static PrimaryKeyOption valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private PrimaryKeyOption(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyOption) + } + + public enum IndexUpdateMode + implements com.google.protobuf.ProtocolMessageEnum { + IUM_ASYNC_INDEX(0, 0), + IUM_SYNC_INDEX(1, 1), + ; + + public static final int IUM_ASYNC_INDEX_VALUE = 0; + public static final int IUM_SYNC_INDEX_VALUE = 1; + + + public final int getNumber() { return value; } + + public static IndexUpdateMode valueOf(int value) { + switch (value) { + case 0: return IUM_ASYNC_INDEX; + case 1: return IUM_SYNC_INDEX; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public IndexUpdateMode findValueByNumber(int number) { + return IndexUpdateMode.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(3); + } + + private static final IndexUpdateMode[] VALUES = { + IUM_ASYNC_INDEX, IUM_SYNC_INDEX, + }; + + public static IndexUpdateMode valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private IndexUpdateMode(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.IndexUpdateMode) + } + + public enum IndexType + implements com.google.protobuf.ProtocolMessageEnum { + IT_GLOBAL_INDEX(0, 0), + IT_LOCAL_INDEX(1, 1), + ; + + public static final int IT_GLOBAL_INDEX_VALUE = 0; + public static final int IT_LOCAL_INDEX_VALUE = 1; + + + public final int getNumber() { return value; } + + public static IndexType valueOf(int value) { + switch (value) { + case 0: return IT_GLOBAL_INDEX; + case 1: return IT_LOCAL_INDEX; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public IndexType findValueByNumber(int number) { + return IndexType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(4); + } + + private static final IndexType[] VALUES = { + IT_GLOBAL_INDEX, IT_LOCAL_INDEX, + }; + + public static IndexType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private IndexType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.IndexType) + } + + public enum RowExistenceExpectation + implements com.google.protobuf.ProtocolMessageEnum { + IGNORE(0, 0), + EXPECT_EXIST(1, 1), + EXPECT_NOT_EXIST(2, 2), + ; + + public static final int IGNORE_VALUE = 0; + public static final int EXPECT_EXIST_VALUE = 1; + public static final int EXPECT_NOT_EXIST_VALUE = 2; + + + public final int getNumber() { return value; } + + public static RowExistenceExpectation valueOf(int value) { + switch (value) { + case 0: return IGNORE; + case 1: return EXPECT_EXIST; + case 2: return EXPECT_NOT_EXIST; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public RowExistenceExpectation findValueByNumber(int number) { + return RowExistenceExpectation.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(5); + } + + private static final RowExistenceExpectation[] VALUES = { + IGNORE, EXPECT_EXIST, EXPECT_NOT_EXIST, + }; + + public static RowExistenceExpectation valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private RowExistenceExpectation(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.RowExistenceExpectation) + } + + public enum ReturnType + implements com.google.protobuf.ProtocolMessageEnum { + RT_NONE(0, 0), + RT_PK(1, 1), + RT_AFTER_MODIFY(2, 2), + ; + + public static final int RT_NONE_VALUE = 0; + public static final int RT_PK_VALUE = 1; + public static final int RT_AFTER_MODIFY_VALUE = 2; + + + public final int getNumber() { return value; } + + public static ReturnType valueOf(int value) { + switch (value) { + case 0: return RT_NONE; + case 1: return RT_PK; + case 2: return RT_AFTER_MODIFY; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ReturnType findValueByNumber(int number) { + return ReturnType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(6); + } + + private static final ReturnType[] VALUES = { + RT_NONE, RT_PK, RT_AFTER_MODIFY, + }; + + public static ReturnType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private ReturnType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ReturnType) + } + + public enum OperationType + implements com.google.protobuf.ProtocolMessageEnum { + PUT(0, 1), + UPDATE(1, 2), + DELETE(2, 3), + ; + + public static final int PUT_VALUE = 1; + public static final int UPDATE_VALUE = 2; + public static final int DELETE_VALUE = 3; + + + public final int getNumber() { return value; } + + public static OperationType valueOf(int value) { + switch (value) { + case 1: return PUT; + case 2: return UPDATE; + case 3: return DELETE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public OperationType findValueByNumber(int number) { + return OperationType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(7); + } + + private static final OperationType[] VALUES = { + PUT, UPDATE, DELETE, + }; + + public static OperationType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private OperationType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.OperationType) + } + + public enum Direction + implements com.google.protobuf.ProtocolMessageEnum { + FORWARD(0, 0), + BACKWARD(1, 1), + ; + + public static final int FORWARD_VALUE = 0; + public static final int BACKWARD_VALUE = 1; + + + public final int getNumber() { return value; } + + public static Direction valueOf(int value) { + switch (value) { + case 0: return FORWARD; + case 1: return BACKWARD; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Direction findValueByNumber(int number) { + return Direction.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(8); + } + + private static final Direction[] VALUES = { + FORWARD, BACKWARD, + }; + + public static Direction valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private Direction(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.Direction) + } + + public enum StreamStatus + implements com.google.protobuf.ProtocolMessageEnum { + STREAM_ENABLING(0, 1), + STREAM_ACTIVE(1, 2), + ; + + public static final int STREAM_ENABLING_VALUE = 1; + public static final int STREAM_ACTIVE_VALUE = 2; + + + public final int getNumber() { return value; } + + public static StreamStatus valueOf(int value) { + switch (value) { + case 1: return STREAM_ENABLING; + case 2: return STREAM_ACTIVE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public StreamStatus findValueByNumber(int number) { + return StreamStatus.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(9); + } + + private static final StreamStatus[] VALUES = { + STREAM_ENABLING, STREAM_ACTIVE, + }; + + public static StreamStatus valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private StreamStatus(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.StreamStatus) + } + + public enum ActionType + implements com.google.protobuf.ProtocolMessageEnum { + PUT_ROW(0, 1), + UPDATE_ROW(1, 2), + DELETE_ROW(2, 3), + ; + + public static final int PUT_ROW_VALUE = 1; + public static final int UPDATE_ROW_VALUE = 2; + public static final int DELETE_ROW_VALUE = 3; + + + public final int getNumber() { return value; } + + public static ActionType valueOf(int value) { + switch (value) { + case 1: return PUT_ROW; + case 2: return UPDATE_ROW; + case 3: return DELETE_ROW; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ActionType findValueByNumber(int number) { + return ActionType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.getDescriptor().getEnumTypes().get(10); + } + + private static final ActionType[] VALUES = { + PUT_ROW, UPDATE_ROW, DELETE_ROW, + }; + + public static ActionType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private ActionType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ActionType) + } + + public interface ErrorOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string code = 1; + boolean hasCode(); + String getCode(); + + // optional string message = 2; + boolean hasMessage(); + String getMessage(); + } + public static final class Error extends + com.google.protobuf.GeneratedMessage + implements ErrorOrBuilder { + // Use Error.newBuilder() to construct. + private Error(Builder builder) { + super(builder); + } + private Error(boolean noInit) {} + + private static final Error defaultInstance; + public static Error getDefaultInstance() { + return defaultInstance; + } + + public Error getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; + } + + private int bitField0_; + // required string code = 1; + public static final int CODE_FIELD_NUMBER = 1; + private java.lang.Object code_; + public boolean hasCode() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getCode() { + java.lang.Object ref = code_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + code_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getCodeBytes() { + java.lang.Object ref = code_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + code_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string message = 2; + public static final int MESSAGE_FIELD_NUMBER = 2; + private java.lang.Object message_; + public boolean hasMessage() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getMessage() { + java.lang.Object ref = message_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + message_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + code_ = ""; + message_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasCode()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getCodeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getMessageBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getCodeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getMessageBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + code_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + message_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.code_ = code_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.message_ = message_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance()) return this; + if (other.hasCode()) { + setCode(other.getCode()); + } + if (other.hasMessage()) { + setMessage(other.getMessage()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasCode()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + code_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + message_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string code = 1; + private java.lang.Object code_ = ""; + public boolean hasCode() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getCode() { + java.lang.Object ref = code_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + code_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setCode(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + code_ = value; + onChanged(); + return this; + } + public Builder clearCode() { + bitField0_ = (bitField0_ & ~0x00000001); + code_ = getDefaultInstance().getCode(); + onChanged(); + return this; + } + void setCode(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + code_ = value; + onChanged(); + } + + // optional string message = 2; + private java.lang.Object message_ = ""; + public boolean hasMessage() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getMessage() { + java.lang.Object ref = message_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + message_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setMessage(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + message_ = value; + onChanged(); + return this; + } + public Builder clearMessage() { + bitField0_ = (bitField0_ & ~0x00000002); + message_ = getDefaultInstance().getMessage(); + onChanged(); + return this; + } + void setMessage(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + message_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Error) + } + + static { + defaultInstance = new Error(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Error) + } + + public interface PrimaryKeySchemaOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string name = 1; + boolean hasName(); + String getName(); + + // required .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyType type = 2; + boolean hasType(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType getType(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyOption option = 3; + boolean hasOption(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption getOption(); + } + public static final class PrimaryKeySchema extends + com.google.protobuf.GeneratedMessage + implements PrimaryKeySchemaOrBuilder { + // Use PrimaryKeySchema.newBuilder() to construct. + private PrimaryKeySchema(Builder builder) { + super(builder); + } + private PrimaryKeySchema(boolean noInit) {} + + private static final PrimaryKeySchema defaultInstance; + public static PrimaryKeySchema getDefaultInstance() { + return defaultInstance; + } + + public PrimaryKeySchema getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_fieldAccessorTable; + } + + private int bitField0_; + // required string name = 1; + public static final int NAME_FIELD_NUMBER = 1; + private java.lang.Object name_; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + name_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyType type = 2; + public static final int TYPE_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType type_; + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType getType() { + return type_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyOption option = 3; + public static final int OPTION_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption option_; + public boolean hasOption() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption getOption() { + return option_; + } + + private void initFields() { + name_ = ""; + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType.INTEGER; + option_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption.AUTO_INCREMENT; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(2, type_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(3, option_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, type_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, option_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType.INTEGER; + bitField0_ = (bitField0_ & ~0x00000002); + option_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption.AUTO_INCREMENT; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.name_ = name_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.option_ = option_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.getDefaultInstance()) return this; + if (other.hasName()) { + setName(other.getName()); + } + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasOption()) { + setOption(other.getOption()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasName()) { + + return false; + } + if (!hasType()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + name_ = input.readBytes(); + break; + } + case 16: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + type_ = value; + } + break; + } + case 24: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(3, rawValue); + } else { + bitField0_ |= 0x00000004; + option_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // required string name = 1; + private java.lang.Object name_ = ""; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + name_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + name_ = value; + onChanged(); + return this; + } + public Builder clearName() { + bitField0_ = (bitField0_ & ~0x00000001); + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + void setName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + name_ = value; + onChanged(); + } + + // required .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyType type = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType.INTEGER; + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType getType() { + return type_; + } + public Builder setType(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + onChanged(); + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000002); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyType.INTEGER; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeyOption option = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption option_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption.AUTO_INCREMENT; + public boolean hasOption() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption getOption() { + return option_; + } + public Builder setOption(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + option_ = value; + onChanged(); + return this; + } + public Builder clearOption() { + bitField0_ = (bitField0_ & ~0x00000004); + option_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeyOption.AUTO_INCREMENT; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema) + } + + static { + defaultInstance = new PrimaryKeySchema(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema) + } + + public interface DefinedColumnSchemaOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string name = 1; + boolean hasName(); + String getName(); + + // required .com.alicloud.openservices.tablestore.core.protocol.DefinedColumnType type = 2; + boolean hasType(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType getType(); + } + public static final class DefinedColumnSchema extends + com.google.protobuf.GeneratedMessage + implements DefinedColumnSchemaOrBuilder { + // Use DefinedColumnSchema.newBuilder() to construct. + private DefinedColumnSchema(Builder builder) { + super(builder); + } + private DefinedColumnSchema(boolean noInit) {} + + private static final DefinedColumnSchema defaultInstance; + public static DefinedColumnSchema getDefaultInstance() { + return defaultInstance; + } + + public DefinedColumnSchema getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_fieldAccessorTable; + } + + private int bitField0_; + // required string name = 1; + public static final int NAME_FIELD_NUMBER = 1; + private java.lang.Object name_; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + name_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required .com.alicloud.openservices.tablestore.core.protocol.DefinedColumnType type = 2; + public static final int TYPE_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType type_; + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType getType() { + return type_; + } + + private void initFields() { + name_ = ""; + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType.DCT_INTEGER; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(2, type_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, type_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchemaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType.DCT_INTEGER; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.name_ = name_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.type_ = type_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.getDefaultInstance()) return this; + if (other.hasName()) { + setName(other.getName()); + } + if (other.hasType()) { + setType(other.getType()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasName()) { + + return false; + } + if (!hasType()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + name_ = input.readBytes(); + break; + } + case 16: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + type_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // required string name = 1; + private java.lang.Object name_ = ""; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + name_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + name_ = value; + onChanged(); + return this; + } + public Builder clearName() { + bitField0_ = (bitField0_ & ~0x00000001); + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + void setName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + name_ = value; + onChanged(); + } + + // required .com.alicloud.openservices.tablestore.core.protocol.DefinedColumnType type = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType.DCT_INTEGER; + public boolean hasType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType getType() { + return type_; + } + public Builder setType(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + type_ = value; + onChanged(); + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000002); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnType.DCT_INTEGER; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DefinedColumnSchema) + } + + static { + defaultInstance = new DefinedColumnSchema(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DefinedColumnSchema) + } + + public interface TableOptionsOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int32 time_to_live = 1; + boolean hasTimeToLive(); + int getTimeToLive(); + + // optional int32 max_versions = 2; + boolean hasMaxVersions(); + int getMaxVersions(); + + // optional int64 deviation_cell_version_in_sec = 5; + boolean hasDeviationCellVersionInSec(); + long getDeviationCellVersionInSec(); + } + public static final class TableOptions extends + com.google.protobuf.GeneratedMessage + implements TableOptionsOrBuilder { + // Use TableOptions.newBuilder() to construct. + private TableOptions(Builder builder) { + super(builder); + } + private TableOptions(boolean noInit) {} + + private static final TableOptions defaultInstance; + public static TableOptions getDefaultInstance() { + return defaultInstance; + } + + public TableOptions getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_fieldAccessorTable; + } + + private int bitField0_; + // optional int32 time_to_live = 1; + public static final int TIME_TO_LIVE_FIELD_NUMBER = 1; + private int timeToLive_; + public boolean hasTimeToLive() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getTimeToLive() { + return timeToLive_; + } + + // optional int32 max_versions = 2; + public static final int MAX_VERSIONS_FIELD_NUMBER = 2; + private int maxVersions_; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getMaxVersions() { + return maxVersions_; + } + + // optional int64 deviation_cell_version_in_sec = 5; + public static final int DEVIATION_CELL_VERSION_IN_SEC_FIELD_NUMBER = 5; + private long deviationCellVersionInSec_; + public boolean hasDeviationCellVersionInSec() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getDeviationCellVersionInSec() { + return deviationCellVersionInSec_; + } + + private void initFields() { + timeToLive_ = 0; + maxVersions_ = 0; + deviationCellVersionInSec_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(1, timeToLive_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(2, maxVersions_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(5, deviationCellVersionInSec_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, timeToLive_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, maxVersions_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(5, deviationCellVersionInSec_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + timeToLive_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + maxVersions_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + deviationCellVersionInSec_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.timeToLive_ = timeToLive_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.maxVersions_ = maxVersions_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.deviationCellVersionInSec_ = deviationCellVersionInSec_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance()) return this; + if (other.hasTimeToLive()) { + setTimeToLive(other.getTimeToLive()); + } + if (other.hasMaxVersions()) { + setMaxVersions(other.getMaxVersions()); + } + if (other.hasDeviationCellVersionInSec()) { + setDeviationCellVersionInSec(other.getDeviationCellVersionInSec()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + timeToLive_ = input.readInt32(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + maxVersions_ = input.readInt32(); + break; + } + case 40: { + bitField0_ |= 0x00000004; + deviationCellVersionInSec_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional int32 time_to_live = 1; + private int timeToLive_ ; + public boolean hasTimeToLive() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getTimeToLive() { + return timeToLive_; + } + public Builder setTimeToLive(int value) { + bitField0_ |= 0x00000001; + timeToLive_ = value; + onChanged(); + return this; + } + public Builder clearTimeToLive() { + bitField0_ = (bitField0_ & ~0x00000001); + timeToLive_ = 0; + onChanged(); + return this; + } + + // optional int32 max_versions = 2; + private int maxVersions_ ; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getMaxVersions() { + return maxVersions_; + } + public Builder setMaxVersions(int value) { + bitField0_ |= 0x00000002; + maxVersions_ = value; + onChanged(); + return this; + } + public Builder clearMaxVersions() { + bitField0_ = (bitField0_ & ~0x00000002); + maxVersions_ = 0; + onChanged(); + return this; + } + + // optional int64 deviation_cell_version_in_sec = 5; + private long deviationCellVersionInSec_ ; + public boolean hasDeviationCellVersionInSec() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getDeviationCellVersionInSec() { + return deviationCellVersionInSec_; + } + public Builder setDeviationCellVersionInSec(long value) { + bitField0_ |= 0x00000004; + deviationCellVersionInSec_ = value; + onChanged(); + return this; + } + public Builder clearDeviationCellVersionInSec() { + bitField0_ = (bitField0_ & ~0x00000004); + deviationCellVersionInSec_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TableOptions) + } + + static { + defaultInstance = new TableOptions(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TableOptions) + } + + public interface IndexMetaOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string name = 1; + boolean hasName(); + String getName(); + + // repeated string primary_key = 2; + java.util.List getPrimaryKeyList(); + int getPrimaryKeyCount(); + String getPrimaryKey(int index); + + // repeated string defined_column = 3; + java.util.List getDefinedColumnList(); + int getDefinedColumnCount(); + String getDefinedColumn(int index); + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexUpdateMode index_update_mode = 4; + boolean hasIndexUpdateMode(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode getIndexUpdateMode(); + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexType index_type = 5; + boolean hasIndexType(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType getIndexType(); + } + public static final class IndexMeta extends + com.google.protobuf.GeneratedMessage + implements IndexMetaOrBuilder { + // Use IndexMeta.newBuilder() to construct. + private IndexMeta(Builder builder) { + super(builder); + } + private IndexMeta(boolean noInit) {} + + private static final IndexMeta defaultInstance; + public static IndexMeta getDefaultInstance() { + return defaultInstance; + } + + public IndexMeta getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_fieldAccessorTable; + } + + private int bitField0_; + // required string name = 1; + public static final int NAME_FIELD_NUMBER = 1; + private java.lang.Object name_; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + name_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated string primary_key = 2; + public static final int PRIMARY_KEY_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList primaryKey_; + public java.util.List + getPrimaryKeyList() { + return primaryKey_; + } + public int getPrimaryKeyCount() { + return primaryKey_.size(); + } + public String getPrimaryKey(int index) { + return primaryKey_.get(index); + } + + // repeated string defined_column = 3; + public static final int DEFINED_COLUMN_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList definedColumn_; + public java.util.List + getDefinedColumnList() { + return definedColumn_; + } + public int getDefinedColumnCount() { + return definedColumn_.size(); + } + public String getDefinedColumn(int index) { + return definedColumn_.get(index); + } + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexUpdateMode index_update_mode = 4; + public static final int INDEX_UPDATE_MODE_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode indexUpdateMode_; + public boolean hasIndexUpdateMode() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode getIndexUpdateMode() { + return indexUpdateMode_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexType index_type = 5; + public static final int INDEX_TYPE_FIELD_NUMBER = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType indexType_; + public boolean hasIndexType() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType getIndexType() { + return indexType_; + } + + private void initFields() { + name_ = ""; + primaryKey_ = com.google.protobuf.LazyStringArrayList.EMPTY; + definedColumn_ = com.google.protobuf.LazyStringArrayList.EMPTY; + indexUpdateMode_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode.IUM_ASYNC_INDEX; + indexType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType.IT_GLOBAL_INDEX; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasIndexUpdateMode()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasIndexType()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getNameBytes()); + } + for (int i = 0; i < primaryKey_.size(); i++) { + output.writeBytes(2, primaryKey_.getByteString(i)); + } + for (int i = 0; i < definedColumn_.size(); i++) { + output.writeBytes(3, definedColumn_.getByteString(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(4, indexUpdateMode_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(5, indexType_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getNameBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < primaryKey_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(primaryKey_.getByteString(i)); + } + size += dataSize; + size += 1 * getPrimaryKeyList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < definedColumn_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(definedColumn_.getByteString(i)); + } + size += dataSize; + size += 1 * getDefinedColumnList().size(); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, indexUpdateMode_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(5, indexType_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + primaryKey_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + definedColumn_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + indexUpdateMode_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode.IUM_ASYNC_INDEX; + bitField0_ = (bitField0_ & ~0x00000008); + indexType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType.IT_GLOBAL_INDEX; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.name_ = name_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + primaryKey_ = new com.google.protobuf.UnmodifiableLazyStringList( + primaryKey_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.primaryKey_ = primaryKey_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + definedColumn_ = new com.google.protobuf.UnmodifiableLazyStringList( + definedColumn_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.definedColumn_ = definedColumn_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000002; + } + result.indexUpdateMode_ = indexUpdateMode_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000004; + } + result.indexType_ = indexType_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance()) return this; + if (other.hasName()) { + setName(other.getName()); + } + if (!other.primaryKey_.isEmpty()) { + if (primaryKey_.isEmpty()) { + primaryKey_ = other.primaryKey_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensurePrimaryKeyIsMutable(); + primaryKey_.addAll(other.primaryKey_); + } + onChanged(); + } + if (!other.definedColumn_.isEmpty()) { + if (definedColumn_.isEmpty()) { + definedColumn_ = other.definedColumn_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureDefinedColumnIsMutable(); + definedColumn_.addAll(other.definedColumn_); + } + onChanged(); + } + if (other.hasIndexUpdateMode()) { + setIndexUpdateMode(other.getIndexUpdateMode()); + } + if (other.hasIndexType()) { + setIndexType(other.getIndexType()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasName()) { + + return false; + } + if (!hasIndexUpdateMode()) { + + return false; + } + if (!hasIndexType()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + name_ = input.readBytes(); + break; + } + case 18: { + ensurePrimaryKeyIsMutable(); + primaryKey_.add(input.readBytes()); + break; + } + case 26: { + ensureDefinedColumnIsMutable(); + definedColumn_.add(input.readBytes()); + break; + } + case 32: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(4, rawValue); + } else { + bitField0_ |= 0x00000008; + indexUpdateMode_ = value; + } + break; + } + case 40: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(5, rawValue); + } else { + bitField0_ |= 0x00000010; + indexType_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // required string name = 1; + private java.lang.Object name_ = ""; + public boolean hasName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + name_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + name_ = value; + onChanged(); + return this; + } + public Builder clearName() { + bitField0_ = (bitField0_ & ~0x00000001); + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + void setName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + name_ = value; + onChanged(); + } + + // repeated string primary_key = 2; + private com.google.protobuf.LazyStringList primaryKey_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensurePrimaryKeyIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + primaryKey_ = new com.google.protobuf.LazyStringArrayList(primaryKey_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getPrimaryKeyList() { + return java.util.Collections.unmodifiableList(primaryKey_); + } + public int getPrimaryKeyCount() { + return primaryKey_.size(); + } + public String getPrimaryKey(int index) { + return primaryKey_.get(index); + } + public Builder setPrimaryKey( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePrimaryKeyIsMutable(); + primaryKey_.set(index, value); + onChanged(); + return this; + } + public Builder addPrimaryKey(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePrimaryKeyIsMutable(); + primaryKey_.add(value); + onChanged(); + return this; + } + public Builder addAllPrimaryKey( + java.lang.Iterable values) { + ensurePrimaryKeyIsMutable(); + super.addAll(values, primaryKey_); + onChanged(); + return this; + } + public Builder clearPrimaryKey() { + primaryKey_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + void addPrimaryKey(com.google.protobuf.ByteString value) { + ensurePrimaryKeyIsMutable(); + primaryKey_.add(value); + onChanged(); + } + + // repeated string defined_column = 3; + private com.google.protobuf.LazyStringList definedColumn_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureDefinedColumnIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + definedColumn_ = new com.google.protobuf.LazyStringArrayList(definedColumn_); + bitField0_ |= 0x00000004; + } + } + public java.util.List + getDefinedColumnList() { + return java.util.Collections.unmodifiableList(definedColumn_); + } + public int getDefinedColumnCount() { + return definedColumn_.size(); + } + public String getDefinedColumn(int index) { + return definedColumn_.get(index); + } + public Builder setDefinedColumn( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDefinedColumnIsMutable(); + definedColumn_.set(index, value); + onChanged(); + return this; + } + public Builder addDefinedColumn(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDefinedColumnIsMutable(); + definedColumn_.add(value); + onChanged(); + return this; + } + public Builder addAllDefinedColumn( + java.lang.Iterable values) { + ensureDefinedColumnIsMutable(); + super.addAll(values, definedColumn_); + onChanged(); + return this; + } + public Builder clearDefinedColumn() { + definedColumn_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + void addDefinedColumn(com.google.protobuf.ByteString value) { + ensureDefinedColumnIsMutable(); + definedColumn_.add(value); + onChanged(); + } + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexUpdateMode index_update_mode = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode indexUpdateMode_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode.IUM_ASYNC_INDEX; + public boolean hasIndexUpdateMode() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode getIndexUpdateMode() { + return indexUpdateMode_; + } + public Builder setIndexUpdateMode(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + indexUpdateMode_ = value; + onChanged(); + return this; + } + public Builder clearIndexUpdateMode() { + bitField0_ = (bitField0_ & ~0x00000008); + indexUpdateMode_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexUpdateMode.IUM_ASYNC_INDEX; + onChanged(); + return this; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexType index_type = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType indexType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType.IT_GLOBAL_INDEX; + public boolean hasIndexType() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType getIndexType() { + return indexType_; + } + public Builder setIndexType(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + indexType_ = value; + onChanged(); + return this; + } + public Builder clearIndexType() { + bitField0_ = (bitField0_ & ~0x00000010); + indexType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexType.IT_GLOBAL_INDEX; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.IndexMeta) + } + + static { + defaultInstance = new IndexMeta(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.IndexMeta) + } + + public interface TableMetaOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema primary_key = 2; + java.util.List + getPrimaryKeyList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema getPrimaryKey(int index); + int getPrimaryKeyCount(); + java.util.List + getPrimaryKeyOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder getPrimaryKeyOrBuilder( + int index); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.DefinedColumnSchema defined_column = 3; + java.util.List + getDefinedColumnList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema getDefinedColumn(int index); + int getDefinedColumnCount(); + java.util.List + getDefinedColumnOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchemaOrBuilder getDefinedColumnOrBuilder( + int index); + } + public static final class TableMeta extends + com.google.protobuf.GeneratedMessage + implements TableMetaOrBuilder { + // Use TableMeta.newBuilder() to construct. + private TableMeta(Builder builder) { + super(builder); + } + private TableMeta(boolean noInit) {} + + private static final TableMeta defaultInstance; + public static TableMeta getDefaultInstance() { + return defaultInstance; + } + + public TableMeta getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema primary_key = 2; + public static final int PRIMARY_KEY_FIELD_NUMBER = 2; + private java.util.List primaryKey_; + public java.util.List getPrimaryKeyList() { + return primaryKey_; + } + public java.util.List + getPrimaryKeyOrBuilderList() { + return primaryKey_; + } + public int getPrimaryKeyCount() { + return primaryKey_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema getPrimaryKey(int index) { + return primaryKey_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder getPrimaryKeyOrBuilder( + int index) { + return primaryKey_.get(index); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.DefinedColumnSchema defined_column = 3; + public static final int DEFINED_COLUMN_FIELD_NUMBER = 3; + private java.util.List definedColumn_; + public java.util.List getDefinedColumnList() { + return definedColumn_; + } + public java.util.List + getDefinedColumnOrBuilderList() { + return definedColumn_; + } + public int getDefinedColumnCount() { + return definedColumn_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema getDefinedColumn(int index) { + return definedColumn_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchemaOrBuilder getDefinedColumnOrBuilder( + int index) { + return definedColumn_.get(index); + } + + private void initFields() { + tableName_ = ""; + primaryKey_ = java.util.Collections.emptyList(); + definedColumn_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getPrimaryKeyCount(); i++) { + if (!getPrimaryKey(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getDefinedColumnCount(); i++) { + if (!getDefinedColumn(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + for (int i = 0; i < primaryKey_.size(); i++) { + output.writeMessage(2, primaryKey_.get(i)); + } + for (int i = 0; i < definedColumn_.size(); i++) { + output.writeMessage(3, definedColumn_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + for (int i = 0; i < primaryKey_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, primaryKey_.get(i)); + } + for (int i = 0; i < definedColumn_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, definedColumn_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getPrimaryKeyFieldBuilder(); + getDefinedColumnFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (primaryKeyBuilder_ == null) { + primaryKey_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + primaryKeyBuilder_.clear(); + } + if (definedColumnBuilder_ == null) { + definedColumn_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + } else { + definedColumnBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (primaryKeyBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.primaryKey_ = primaryKey_; + } else { + result.primaryKey_ = primaryKeyBuilder_.build(); + } + if (definedColumnBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { + definedColumn_ = java.util.Collections.unmodifiableList(definedColumn_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.definedColumn_ = definedColumn_; + } else { + result.definedColumn_ = definedColumnBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (primaryKeyBuilder_ == null) { + if (!other.primaryKey_.isEmpty()) { + if (primaryKey_.isEmpty()) { + primaryKey_ = other.primaryKey_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensurePrimaryKeyIsMutable(); + primaryKey_.addAll(other.primaryKey_); + } + onChanged(); + } + } else { + if (!other.primaryKey_.isEmpty()) { + if (primaryKeyBuilder_.isEmpty()) { + primaryKeyBuilder_.dispose(); + primaryKeyBuilder_ = null; + primaryKey_ = other.primaryKey_; + bitField0_ = (bitField0_ & ~0x00000002); + primaryKeyBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getPrimaryKeyFieldBuilder() : null; + } else { + primaryKeyBuilder_.addAllMessages(other.primaryKey_); + } + } + } + if (definedColumnBuilder_ == null) { + if (!other.definedColumn_.isEmpty()) { + if (definedColumn_.isEmpty()) { + definedColumn_ = other.definedColumn_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureDefinedColumnIsMutable(); + definedColumn_.addAll(other.definedColumn_); + } + onChanged(); + } + } else { + if (!other.definedColumn_.isEmpty()) { + if (definedColumnBuilder_.isEmpty()) { + definedColumnBuilder_.dispose(); + definedColumnBuilder_ = null; + definedColumn_ = other.definedColumn_; + bitField0_ = (bitField0_ & ~0x00000004); + definedColumnBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getDefinedColumnFieldBuilder() : null; + } else { + definedColumnBuilder_.addAllMessages(other.definedColumn_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + for (int i = 0; i < getPrimaryKeyCount(); i++) { + if (!getPrimaryKey(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getDefinedColumnCount(); i++) { + if (!getDefinedColumn(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addPrimaryKey(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addDefinedColumn(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema primary_key = 2; + private java.util.List primaryKey_ = + java.util.Collections.emptyList(); + private void ensurePrimaryKeyIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + primaryKey_ = new java.util.ArrayList(primaryKey_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder> primaryKeyBuilder_; + + public java.util.List getPrimaryKeyList() { + if (primaryKeyBuilder_ == null) { + return java.util.Collections.unmodifiableList(primaryKey_); + } else { + return primaryKeyBuilder_.getMessageList(); + } + } + public int getPrimaryKeyCount() { + if (primaryKeyBuilder_ == null) { + return primaryKey_.size(); + } else { + return primaryKeyBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema getPrimaryKey(int index) { + if (primaryKeyBuilder_ == null) { + return primaryKey_.get(index); + } else { + return primaryKeyBuilder_.getMessage(index); + } + } + public Builder setPrimaryKey( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema value) { + if (primaryKeyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePrimaryKeyIsMutable(); + primaryKey_.set(index, value); + onChanged(); + } else { + primaryKeyBuilder_.setMessage(index, value); + } + return this; + } + public Builder setPrimaryKey( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder builderForValue) { + if (primaryKeyBuilder_ == null) { + ensurePrimaryKeyIsMutable(); + primaryKey_.set(index, builderForValue.build()); + onChanged(); + } else { + primaryKeyBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addPrimaryKey(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema value) { + if (primaryKeyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePrimaryKeyIsMutable(); + primaryKey_.add(value); + onChanged(); + } else { + primaryKeyBuilder_.addMessage(value); + } + return this; + } + public Builder addPrimaryKey( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema value) { + if (primaryKeyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePrimaryKeyIsMutable(); + primaryKey_.add(index, value); + onChanged(); + } else { + primaryKeyBuilder_.addMessage(index, value); + } + return this; + } + public Builder addPrimaryKey( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder builderForValue) { + if (primaryKeyBuilder_ == null) { + ensurePrimaryKeyIsMutable(); + primaryKey_.add(builderForValue.build()); + onChanged(); + } else { + primaryKeyBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addPrimaryKey( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder builderForValue) { + if (primaryKeyBuilder_ == null) { + ensurePrimaryKeyIsMutable(); + primaryKey_.add(index, builderForValue.build()); + onChanged(); + } else { + primaryKeyBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllPrimaryKey( + java.lang.Iterable values) { + if (primaryKeyBuilder_ == null) { + ensurePrimaryKeyIsMutable(); + super.addAll(values, primaryKey_); + onChanged(); + } else { + primaryKeyBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearPrimaryKey() { + if (primaryKeyBuilder_ == null) { + primaryKey_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + primaryKeyBuilder_.clear(); + } + return this; + } + public Builder removePrimaryKey(int index) { + if (primaryKeyBuilder_ == null) { + ensurePrimaryKeyIsMutable(); + primaryKey_.remove(index); + onChanged(); + } else { + primaryKeyBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder getPrimaryKeyBuilder( + int index) { + return getPrimaryKeyFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder getPrimaryKeyOrBuilder( + int index) { + if (primaryKeyBuilder_ == null) { + return primaryKey_.get(index); } else { + return primaryKeyBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getPrimaryKeyOrBuilderList() { + if (primaryKeyBuilder_ != null) { + return primaryKeyBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(primaryKey_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder addPrimaryKeyBuilder() { + return getPrimaryKeyFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder addPrimaryKeyBuilder( + int index) { + return getPrimaryKeyFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.getDefaultInstance()); + } + public java.util.List + getPrimaryKeyBuilderList() { + return getPrimaryKeyFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder> + getPrimaryKeyFieldBuilder() { + if (primaryKeyBuilder_ == null) { + primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder>( + primaryKey_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + primaryKey_ = null; + } + return primaryKeyBuilder_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.DefinedColumnSchema defined_column = 3; + private java.util.List definedColumn_ = + java.util.Collections.emptyList(); + private void ensureDefinedColumnIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + definedColumn_ = new java.util.ArrayList(definedColumn_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchemaOrBuilder> definedColumnBuilder_; + + public java.util.List getDefinedColumnList() { + if (definedColumnBuilder_ == null) { + return java.util.Collections.unmodifiableList(definedColumn_); + } else { + return definedColumnBuilder_.getMessageList(); + } + } + public int getDefinedColumnCount() { + if (definedColumnBuilder_ == null) { + return definedColumn_.size(); + } else { + return definedColumnBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema getDefinedColumn(int index) { + if (definedColumnBuilder_ == null) { + return definedColumn_.get(index); + } else { + return definedColumnBuilder_.getMessage(index); + } + } + public Builder setDefinedColumn( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema value) { + if (definedColumnBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDefinedColumnIsMutable(); + definedColumn_.set(index, value); + onChanged(); + } else { + definedColumnBuilder_.setMessage(index, value); + } + return this; + } + public Builder setDefinedColumn( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder builderForValue) { + if (definedColumnBuilder_ == null) { + ensureDefinedColumnIsMutable(); + definedColumn_.set(index, builderForValue.build()); + onChanged(); + } else { + definedColumnBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addDefinedColumn(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema value) { + if (definedColumnBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDefinedColumnIsMutable(); + definedColumn_.add(value); + onChanged(); + } else { + definedColumnBuilder_.addMessage(value); + } + return this; + } + public Builder addDefinedColumn( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema value) { + if (definedColumnBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureDefinedColumnIsMutable(); + definedColumn_.add(index, value); + onChanged(); + } else { + definedColumnBuilder_.addMessage(index, value); + } + return this; + } + public Builder addDefinedColumn( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder builderForValue) { + if (definedColumnBuilder_ == null) { + ensureDefinedColumnIsMutable(); + definedColumn_.add(builderForValue.build()); + onChanged(); + } else { + definedColumnBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addDefinedColumn( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder builderForValue) { + if (definedColumnBuilder_ == null) { + ensureDefinedColumnIsMutable(); + definedColumn_.add(index, builderForValue.build()); + onChanged(); + } else { + definedColumnBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllDefinedColumn( + java.lang.Iterable values) { + if (definedColumnBuilder_ == null) { + ensureDefinedColumnIsMutable(); + super.addAll(values, definedColumn_); + onChanged(); + } else { + definedColumnBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearDefinedColumn() { + if (definedColumnBuilder_ == null) { + definedColumn_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + definedColumnBuilder_.clear(); + } + return this; + } + public Builder removeDefinedColumn(int index) { + if (definedColumnBuilder_ == null) { + ensureDefinedColumnIsMutable(); + definedColumn_.remove(index); + onChanged(); + } else { + definedColumnBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder getDefinedColumnBuilder( + int index) { + return getDefinedColumnFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchemaOrBuilder getDefinedColumnOrBuilder( + int index) { + if (definedColumnBuilder_ == null) { + return definedColumn_.get(index); } else { + return definedColumnBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getDefinedColumnOrBuilderList() { + if (definedColumnBuilder_ != null) { + return definedColumnBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(definedColumn_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder addDefinedColumnBuilder() { + return getDefinedColumnFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder addDefinedColumnBuilder( + int index) { + return getDefinedColumnFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.getDefaultInstance()); + } + public java.util.List + getDefinedColumnBuilderList() { + return getDefinedColumnFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchemaOrBuilder> + getDefinedColumnFieldBuilder() { + if (definedColumnBuilder_ == null) { + definedColumnBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchemaOrBuilder>( + definedColumn_, + ((bitField0_ & 0x00000004) == 0x00000004), + getParentForChildren(), + isClean()); + definedColumn_ = null; + } + return definedColumnBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TableMeta) + } + + static { + defaultInstance = new TableMeta(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TableMeta) + } + + public interface ConditionOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.RowExistenceExpectation row_existence = 1; + boolean hasRowExistence(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation getRowExistence(); + + // optional bytes column_condition = 2; + boolean hasColumnCondition(); + com.google.protobuf.ByteString getColumnCondition(); + } + public static final class Condition extends + com.google.protobuf.GeneratedMessage + implements ConditionOrBuilder { + // Use Condition.newBuilder() to construct. + private Condition(Builder builder) { + super(builder); + } + private Condition(boolean noInit) {} + + private static final Condition defaultInstance; + public static Condition getDefaultInstance() { + return defaultInstance; + } + + public Condition getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.RowExistenceExpectation row_existence = 1; + public static final int ROW_EXISTENCE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation rowExistence_; + public boolean hasRowExistence() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation getRowExistence() { + return rowExistence_; + } + + // optional bytes column_condition = 2; + public static final int COLUMN_CONDITION_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString columnCondition_; + public boolean hasColumnCondition() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getColumnCondition() { + return columnCondition_; + } + + private void initFields() { + rowExistence_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation.IGNORE; + columnCondition_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasRowExistence()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, rowExistence_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, columnCondition_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, rowExistence_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, columnCondition_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + rowExistence_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation.IGNORE; + bitField0_ = (bitField0_ & ~0x00000001); + columnCondition_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.rowExistence_ = rowExistence_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.columnCondition_ = columnCondition_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance()) return this; + if (other.hasRowExistence()) { + setRowExistence(other.getRowExistence()); + } + if (other.hasColumnCondition()) { + setColumnCondition(other.getColumnCondition()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasRowExistence()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + rowExistence_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + columnCondition_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.RowExistenceExpectation row_existence = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation rowExistence_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation.IGNORE; + public boolean hasRowExistence() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation getRowExistence() { + return rowExistence_; + } + public Builder setRowExistence(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + rowExistence_ = value; + onChanged(); + return this; + } + public Builder clearRowExistence() { + bitField0_ = (bitField0_ & ~0x00000001); + rowExistence_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowExistenceExpectation.IGNORE; + onChanged(); + return this; + } + + // optional bytes column_condition = 2; + private com.google.protobuf.ByteString columnCondition_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasColumnCondition() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getColumnCondition() { + return columnCondition_; + } + public Builder setColumnCondition(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + columnCondition_ = value; + onChanged(); + return this; + } + public Builder clearColumnCondition() { + bitField0_ = (bitField0_ & ~0x00000002); + columnCondition_ = getDefaultInstance().getColumnCondition(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Condition) + } + + static { + defaultInstance = new Condition(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Condition) + } + + public interface CapacityUnitOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int32 read = 1; + boolean hasRead(); + int getRead(); + + // optional int32 write = 2; + boolean hasWrite(); + int getWrite(); + } + public static final class CapacityUnit extends + com.google.protobuf.GeneratedMessage + implements CapacityUnitOrBuilder { + // Use CapacityUnit.newBuilder() to construct. + private CapacityUnit(Builder builder) { + super(builder); + } + private CapacityUnit(boolean noInit) {} + + private static final CapacityUnit defaultInstance; + public static CapacityUnit getDefaultInstance() { + return defaultInstance; + } + + public CapacityUnit getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_fieldAccessorTable; + } + + private int bitField0_; + // optional int32 read = 1; + public static final int READ_FIELD_NUMBER = 1; + private int read_; + public boolean hasRead() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getRead() { + return read_; + } + + // optional int32 write = 2; + public static final int WRITE_FIELD_NUMBER = 2; + private int write_; + public boolean hasWrite() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getWrite() { + return write_; + } + + private void initFields() { + read_ = 0; + write_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(1, read_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(2, write_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, read_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, write_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + read_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + write_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.read_ = read_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.write_ = write_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance()) return this; + if (other.hasRead()) { + setRead(other.getRead()); + } + if (other.hasWrite()) { + setWrite(other.getWrite()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + read_ = input.readInt32(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + write_ = input.readInt32(); + break; + } + } + } + } + + private int bitField0_; + + // optional int32 read = 1; + private int read_ ; + public boolean hasRead() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getRead() { + return read_; + } + public Builder setRead(int value) { + bitField0_ |= 0x00000001; + read_ = value; + onChanged(); + return this; + } + public Builder clearRead() { + bitField0_ = (bitField0_ & ~0x00000001); + read_ = 0; + onChanged(); + return this; + } + + // optional int32 write = 2; + private int write_ ; + public boolean hasWrite() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getWrite() { + return write_; + } + public Builder setWrite(int value) { + bitField0_ |= 0x00000002; + write_ = value; + onChanged(); + return this; + } + public Builder clearWrite() { + bitField0_ = (bitField0_ & ~0x00000002); + write_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CapacityUnit) + } + + static { + defaultInstance = new CapacityUnit(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CapacityUnit) + } + + public interface ReservedThroughputDetailsOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + boolean hasCapacityUnit(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder(); + + // required int64 last_increase_time = 2; + boolean hasLastIncreaseTime(); + long getLastIncreaseTime(); + + // optional int64 last_decrease_time = 3; + boolean hasLastDecreaseTime(); + long getLastDecreaseTime(); + } + public static final class ReservedThroughputDetails extends + com.google.protobuf.GeneratedMessage + implements ReservedThroughputDetailsOrBuilder { + // Use ReservedThroughputDetails.newBuilder() to construct. + private ReservedThroughputDetails(Builder builder) { + super(builder); + } + private ReservedThroughputDetails(boolean noInit) {} + + private static final ReservedThroughputDetails defaultInstance; + public static ReservedThroughputDetails getDefaultInstance() { + return defaultInstance; + } + + public ReservedThroughputDetails getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + public static final int CAPACITY_UNIT_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit capacityUnit_; + public boolean hasCapacityUnit() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit() { + return capacityUnit_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { + return capacityUnit_; + } + + // required int64 last_increase_time = 2; + public static final int LAST_INCREASE_TIME_FIELD_NUMBER = 2; + private long lastIncreaseTime_; + public boolean hasLastIncreaseTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getLastIncreaseTime() { + return lastIncreaseTime_; + } + + // optional int64 last_decrease_time = 3; + public static final int LAST_DECREASE_TIME_FIELD_NUMBER = 3; + private long lastDecreaseTime_; + public boolean hasLastDecreaseTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getLastDecreaseTime() { + return lastDecreaseTime_; + } + + private void initFields() { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + lastIncreaseTime_ = 0L; + lastDecreaseTime_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasCapacityUnit()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLastIncreaseTime()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, capacityUnit_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, lastIncreaseTime_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, lastDecreaseTime_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, capacityUnit_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, lastIncreaseTime_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, lastDecreaseTime_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getCapacityUnitFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (capacityUnitBuilder_ == null) { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + } else { + capacityUnitBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + lastIncreaseTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + lastDecreaseTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (capacityUnitBuilder_ == null) { + result.capacityUnit_ = capacityUnit_; + } else { + result.capacityUnit_ = capacityUnitBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.lastIncreaseTime_ = lastIncreaseTime_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.lastDecreaseTime_ = lastDecreaseTime_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance()) return this; + if (other.hasCapacityUnit()) { + mergeCapacityUnit(other.getCapacityUnit()); + } + if (other.hasLastIncreaseTime()) { + setLastIncreaseTime(other.getLastIncreaseTime()); + } + if (other.hasLastDecreaseTime()) { + setLastDecreaseTime(other.getLastDecreaseTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasCapacityUnit()) { + + return false; + } + if (!hasLastIncreaseTime()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.newBuilder(); + if (hasCapacityUnit()) { + subBuilder.mergeFrom(getCapacityUnit()); + } + input.readMessage(subBuilder, extensionRegistry); + setCapacityUnit(subBuilder.buildPartial()); + break; + } + case 16: { + bitField0_ |= 0x00000002; + lastIncreaseTime_ = input.readInt64(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + lastDecreaseTime_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder> capacityUnitBuilder_; + public boolean hasCapacityUnit() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit() { + if (capacityUnitBuilder_ == null) { + return capacityUnit_; + } else { + return capacityUnitBuilder_.getMessage(); + } + } + public Builder setCapacityUnit(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit value) { + if (capacityUnitBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + capacityUnit_ = value; + onChanged(); + } else { + capacityUnitBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setCapacityUnit( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder builderForValue) { + if (capacityUnitBuilder_ == null) { + capacityUnit_ = builderForValue.build(); + onChanged(); + } else { + capacityUnitBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeCapacityUnit(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit value) { + if (capacityUnitBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + capacityUnit_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance()) { + capacityUnit_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.newBuilder(capacityUnit_).mergeFrom(value).buildPartial(); + } else { + capacityUnit_ = value; + } + onChanged(); + } else { + capacityUnitBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearCapacityUnit() { + if (capacityUnitBuilder_ == null) { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + onChanged(); + } else { + capacityUnitBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder getCapacityUnitBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getCapacityUnitFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { + if (capacityUnitBuilder_ != null) { + return capacityUnitBuilder_.getMessageOrBuilder(); + } else { + return capacityUnit_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder> + getCapacityUnitFieldBuilder() { + if (capacityUnitBuilder_ == null) { + capacityUnitBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder>( + capacityUnit_, + getParentForChildren(), + isClean()); + capacityUnit_ = null; + } + return capacityUnitBuilder_; + } + + // required int64 last_increase_time = 2; + private long lastIncreaseTime_ ; + public boolean hasLastIncreaseTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getLastIncreaseTime() { + return lastIncreaseTime_; + } + public Builder setLastIncreaseTime(long value) { + bitField0_ |= 0x00000002; + lastIncreaseTime_ = value; + onChanged(); + return this; + } + public Builder clearLastIncreaseTime() { + bitField0_ = (bitField0_ & ~0x00000002); + lastIncreaseTime_ = 0L; + onChanged(); + return this; + } + + // optional int64 last_decrease_time = 3; + private long lastDecreaseTime_ ; + public boolean hasLastDecreaseTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getLastDecreaseTime() { + return lastDecreaseTime_; + } + public Builder setLastDecreaseTime(long value) { + bitField0_ |= 0x00000004; + lastDecreaseTime_ = value; + onChanged(); + return this; + } + public Builder clearLastDecreaseTime() { + bitField0_ = (bitField0_ & ~0x00000004); + lastDecreaseTime_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails) + } + + static { + defaultInstance = new ReservedThroughputDetails(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails) + } + + public interface ReservedThroughputOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + boolean hasCapacityUnit(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder(); + } + public static final class ReservedThroughput extends + com.google.protobuf.GeneratedMessage + implements ReservedThroughputOrBuilder { + // Use ReservedThroughput.newBuilder() to construct. + private ReservedThroughput(Builder builder) { + super(builder); + } + private ReservedThroughput(boolean noInit) {} + + private static final ReservedThroughput defaultInstance; + public static ReservedThroughput getDefaultInstance() { + return defaultInstance; + } + + public ReservedThroughput getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + public static final int CAPACITY_UNIT_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit capacityUnit_; + public boolean hasCapacityUnit() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit() { + return capacityUnit_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { + return capacityUnit_; + } + + private void initFields() { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasCapacityUnit()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, capacityUnit_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, capacityUnit_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getCapacityUnitFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (capacityUnitBuilder_ == null) { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + } else { + capacityUnitBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (capacityUnitBuilder_ == null) { + result.capacityUnit_ = capacityUnit_; + } else { + result.capacityUnit_ = capacityUnitBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance()) return this; + if (other.hasCapacityUnit()) { + mergeCapacityUnit(other.getCapacityUnit()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasCapacityUnit()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.newBuilder(); + if (hasCapacityUnit()) { + subBuilder.mergeFrom(getCapacityUnit()); + } + input.readMessage(subBuilder, extensionRegistry); + setCapacityUnit(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder> capacityUnitBuilder_; + public boolean hasCapacityUnit() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit() { + if (capacityUnitBuilder_ == null) { + return capacityUnit_; + } else { + return capacityUnitBuilder_.getMessage(); + } + } + public Builder setCapacityUnit(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit value) { + if (capacityUnitBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + capacityUnit_ = value; + onChanged(); + } else { + capacityUnitBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setCapacityUnit( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder builderForValue) { + if (capacityUnitBuilder_ == null) { + capacityUnit_ = builderForValue.build(); + onChanged(); + } else { + capacityUnitBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeCapacityUnit(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit value) { + if (capacityUnitBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + capacityUnit_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance()) { + capacityUnit_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.newBuilder(capacityUnit_).mergeFrom(value).buildPartial(); + } else { + capacityUnit_ = value; + } + onChanged(); + } else { + capacityUnitBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearCapacityUnit() { + if (capacityUnitBuilder_ == null) { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + onChanged(); + } else { + capacityUnitBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder getCapacityUnitBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getCapacityUnitFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { + if (capacityUnitBuilder_ != null) { + return capacityUnitBuilder_.getMessageOrBuilder(); + } else { + return capacityUnit_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder> + getCapacityUnitFieldBuilder() { + if (capacityUnitBuilder_ == null) { + capacityUnitBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder>( + capacityUnit_, + getParentForChildren(), + isClean()); + capacityUnit_ = null; + } + return capacityUnitBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput) + } + + static { + defaultInstance = new ReservedThroughput(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput) + } + + public interface ConsumedCapacityOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + boolean hasCapacityUnit(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder(); + } + public static final class ConsumedCapacity extends + com.google.protobuf.GeneratedMessage + implements ConsumedCapacityOrBuilder { + // Use ConsumedCapacity.newBuilder() to construct. + private ConsumedCapacity(Builder builder) { + super(builder); + } + private ConsumedCapacity(boolean noInit) {} + + private static final ConsumedCapacity defaultInstance; + public static ConsumedCapacity getDefaultInstance() { + return defaultInstance; + } + + public ConsumedCapacity getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + public static final int CAPACITY_UNIT_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit capacityUnit_; + public boolean hasCapacityUnit() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit() { + return capacityUnit_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { + return capacityUnit_; + } + + private void initFields() { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasCapacityUnit()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, capacityUnit_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, capacityUnit_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getCapacityUnitFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (capacityUnitBuilder_ == null) { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + } else { + capacityUnitBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (capacityUnitBuilder_ == null) { + result.capacityUnit_ = capacityUnit_; + } else { + result.capacityUnit_ = capacityUnitBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) return this; + if (other.hasCapacityUnit()) { + mergeCapacityUnit(other.getCapacityUnit()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasCapacityUnit()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.newBuilder(); + if (hasCapacityUnit()) { + subBuilder.mergeFrom(getCapacityUnit()); + } + input.readMessage(subBuilder, extensionRegistry); + setCapacityUnit(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.CapacityUnit capacity_unit = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder> capacityUnitBuilder_; + public boolean hasCapacityUnit() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit getCapacityUnit() { + if (capacityUnitBuilder_ == null) { + return capacityUnit_; + } else { + return capacityUnitBuilder_.getMessage(); + } + } + public Builder setCapacityUnit(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit value) { + if (capacityUnitBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + capacityUnit_ = value; + onChanged(); + } else { + capacityUnitBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setCapacityUnit( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder builderForValue) { + if (capacityUnitBuilder_ == null) { + capacityUnit_ = builderForValue.build(); + onChanged(); + } else { + capacityUnitBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeCapacityUnit(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit value) { + if (capacityUnitBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + capacityUnit_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance()) { + capacityUnit_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.newBuilder(capacityUnit_).mergeFrom(value).buildPartial(); + } else { + capacityUnit_ = value; + } + onChanged(); + } else { + capacityUnitBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearCapacityUnit() { + if (capacityUnitBuilder_ == null) { + capacityUnit_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.getDefaultInstance(); + onChanged(); + } else { + capacityUnitBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder getCapacityUnitBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getCapacityUnitFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { + if (capacityUnitBuilder_ != null) { + return capacityUnitBuilder_.getMessageOrBuilder(); + } else { + return capacityUnit_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder> + getCapacityUnitFieldBuilder() { + if (capacityUnitBuilder_ == null) { + capacityUnitBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnitOrBuilder>( + capacityUnit_, + getParentForChildren(), + isClean()); + capacityUnit_ = null; + } + return capacityUnitBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity) + } + + static { + defaultInstance = new ConsumedCapacity(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity) + } + + public interface StreamSpecificationOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required bool enable_stream = 1; + boolean hasEnableStream(); + boolean getEnableStream(); + + // optional int32 expiration_time = 2; + boolean hasExpirationTime(); + int getExpirationTime(); + } + public static final class StreamSpecification extends + com.google.protobuf.GeneratedMessage + implements StreamSpecificationOrBuilder { + // Use StreamSpecification.newBuilder() to construct. + private StreamSpecification(Builder builder) { + super(builder); + } + private StreamSpecification(boolean noInit) {} + + private static final StreamSpecification defaultInstance; + public static StreamSpecification getDefaultInstance() { + return defaultInstance; + } + + public StreamSpecification getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_fieldAccessorTable; + } + + private int bitField0_; + // required bool enable_stream = 1; + public static final int ENABLE_STREAM_FIELD_NUMBER = 1; + private boolean enableStream_; + public boolean hasEnableStream() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getEnableStream() { + return enableStream_; + } + + // optional int32 expiration_time = 2; + public static final int EXPIRATION_TIME_FIELD_NUMBER = 2; + private int expirationTime_; + public boolean hasExpirationTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getExpirationTime() { + return expirationTime_; + } + + private void initFields() { + enableStream_ = false; + expirationTime_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasEnableStream()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBool(1, enableStream_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(2, expirationTime_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, enableStream_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, expirationTime_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + enableStream_ = false; + bitField0_ = (bitField0_ & ~0x00000001); + expirationTime_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.enableStream_ = enableStream_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.expirationTime_ = expirationTime_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance()) return this; + if (other.hasEnableStream()) { + setEnableStream(other.getEnableStream()); + } + if (other.hasExpirationTime()) { + setExpirationTime(other.getExpirationTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasEnableStream()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + enableStream_ = input.readBool(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + expirationTime_ = input.readInt32(); + break; + } + } + } + } + + private int bitField0_; + + // required bool enable_stream = 1; + private boolean enableStream_ ; + public boolean hasEnableStream() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getEnableStream() { + return enableStream_; + } + public Builder setEnableStream(boolean value) { + bitField0_ |= 0x00000001; + enableStream_ = value; + onChanged(); + return this; + } + public Builder clearEnableStream() { + bitField0_ = (bitField0_ & ~0x00000001); + enableStream_ = false; + onChanged(); + return this; + } + + // optional int32 expiration_time = 2; + private int expirationTime_ ; + public boolean hasExpirationTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getExpirationTime() { + return expirationTime_; + } + public Builder setExpirationTime(int value) { + bitField0_ |= 0x00000002; + expirationTime_ = value; + onChanged(); + return this; + } + public Builder clearExpirationTime() { + bitField0_ = (bitField0_ & ~0x00000002); + expirationTime_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.StreamSpecification) + } + + static { + defaultInstance = new StreamSpecification(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.StreamSpecification) + } + + public interface StreamDetailsOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required bool enable_stream = 1; + boolean hasEnableStream(); + boolean getEnableStream(); + + // optional string stream_id = 2; + boolean hasStreamId(); + String getStreamId(); + + // optional int32 expiration_time = 3; + boolean hasExpirationTime(); + int getExpirationTime(); + + // optional int64 last_enable_time = 4; + boolean hasLastEnableTime(); + long getLastEnableTime(); + } + public static final class StreamDetails extends + com.google.protobuf.GeneratedMessage + implements StreamDetailsOrBuilder { + // Use StreamDetails.newBuilder() to construct. + private StreamDetails(Builder builder) { + super(builder); + } + private StreamDetails(boolean noInit) {} + + private static final StreamDetails defaultInstance; + public static StreamDetails getDefaultInstance() { + return defaultInstance; + } + + public StreamDetails getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_fieldAccessorTable; + } + + private int bitField0_; + // required bool enable_stream = 1; + public static final int ENABLE_STREAM_FIELD_NUMBER = 1; + private boolean enableStream_; + public boolean hasEnableStream() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getEnableStream() { + return enableStream_; + } + + // optional string stream_id = 2; + public static final int STREAM_ID_FIELD_NUMBER = 2; + private java.lang.Object streamId_; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + streamId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStreamIdBytes() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + streamId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int32 expiration_time = 3; + public static final int EXPIRATION_TIME_FIELD_NUMBER = 3; + private int expirationTime_; + public boolean hasExpirationTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getExpirationTime() { + return expirationTime_; + } + + // optional int64 last_enable_time = 4; + public static final int LAST_ENABLE_TIME_FIELD_NUMBER = 4; + private long lastEnableTime_; + public boolean hasLastEnableTime() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getLastEnableTime() { + return lastEnableTime_; + } + + private void initFields() { + enableStream_ = false; + streamId_ = ""; + expirationTime_ = 0; + lastEnableTime_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasEnableStream()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBool(1, enableStream_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(3, expirationTime_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt64(4, lastEnableTime_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, enableStream_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, expirationTime_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(4, lastEnableTime_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + enableStream_ = false; + bitField0_ = (bitField0_ & ~0x00000001); + streamId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + expirationTime_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + lastEnableTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.enableStream_ = enableStream_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.streamId_ = streamId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.expirationTime_ = expirationTime_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.lastEnableTime_ = lastEnableTime_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance()) return this; + if (other.hasEnableStream()) { + setEnableStream(other.getEnableStream()); + } + if (other.hasStreamId()) { + setStreamId(other.getStreamId()); + } + if (other.hasExpirationTime()) { + setExpirationTime(other.getExpirationTime()); + } + if (other.hasLastEnableTime()) { + setLastEnableTime(other.getLastEnableTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasEnableStream()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + enableStream_ = input.readBool(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + streamId_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + expirationTime_ = input.readInt32(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + lastEnableTime_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required bool enable_stream = 1; + private boolean enableStream_ ; + public boolean hasEnableStream() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getEnableStream() { + return enableStream_; + } + public Builder setEnableStream(boolean value) { + bitField0_ |= 0x00000001; + enableStream_ = value; + onChanged(); + return this; + } + public Builder clearEnableStream() { + bitField0_ = (bitField0_ & ~0x00000001); + enableStream_ = false; + onChanged(); + return this; + } + + // optional string stream_id = 2; + private java.lang.Object streamId_ = ""; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + streamId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStreamId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + streamId_ = value; + onChanged(); + return this; + } + public Builder clearStreamId() { + bitField0_ = (bitField0_ & ~0x00000002); + streamId_ = getDefaultInstance().getStreamId(); + onChanged(); + return this; + } + void setStreamId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + streamId_ = value; + onChanged(); + } + + // optional int32 expiration_time = 3; + private int expirationTime_ ; + public boolean hasExpirationTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getExpirationTime() { + return expirationTime_; + } + public Builder setExpirationTime(int value) { + bitField0_ |= 0x00000004; + expirationTime_ = value; + onChanged(); + return this; + } + public Builder clearExpirationTime() { + bitField0_ = (bitField0_ & ~0x00000004); + expirationTime_ = 0; + onChanged(); + return this; + } + + // optional int64 last_enable_time = 4; + private long lastEnableTime_ ; + public boolean hasLastEnableTime() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getLastEnableTime() { + return lastEnableTime_; + } + public Builder setLastEnableTime(long value) { + bitField0_ |= 0x00000008; + lastEnableTime_ = value; + onChanged(); + return this; + } + public Builder clearLastEnableTime() { + bitField0_ = (bitField0_ & ~0x00000008); + lastEnableTime_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.StreamDetails) + } + + static { + defaultInstance = new StreamDetails(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.StreamDetails) + } + + public interface CreateTableRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.TableMeta table_meta = 1; + boolean hasTableMeta(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta getTableMeta(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder getTableMetaOrBuilder(); + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput reserved_throughput = 2; + boolean hasReservedThroughput(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput getReservedThroughput(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder getReservedThroughputOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + boolean hasTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamSpecification stream_spec = 5; + boolean hasStreamSpec(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification getStreamSpec(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder getStreamSpecOrBuilder(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_metas = 7; + java.util.List + getIndexMetasList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMetas(int index); + int getIndexMetasCount(); + java.util.List + getIndexMetasOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetasOrBuilder( + int index); + } + public static final class CreateTableRequest extends + com.google.protobuf.GeneratedMessage + implements CreateTableRequestOrBuilder { + // Use CreateTableRequest.newBuilder() to construct. + private CreateTableRequest(Builder builder) { + super(builder); + } + private CreateTableRequest(boolean noInit) {} + + private static final CreateTableRequest defaultInstance; + public static CreateTableRequest getDefaultInstance() { + return defaultInstance; + } + + public CreateTableRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.TableMeta table_meta = 1; + public static final int TABLE_META_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta tableMeta_; + public boolean hasTableMeta() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta getTableMeta() { + return tableMeta_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder getTableMetaOrBuilder() { + return tableMeta_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput reserved_throughput = 2; + public static final int RESERVED_THROUGHPUT_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput reservedThroughput_; + public boolean hasReservedThroughput() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput getReservedThroughput() { + return reservedThroughput_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { + return reservedThroughput_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + public static final int TABLE_OPTIONS_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + return tableOptions_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + return tableOptions_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamSpecification stream_spec = 5; + public static final int STREAM_SPEC_FIELD_NUMBER = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification streamSpec_; + public boolean hasStreamSpec() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification getStreamSpec() { + return streamSpec_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder getStreamSpecOrBuilder() { + return streamSpec_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_metas = 7; + public static final int INDEX_METAS_FIELD_NUMBER = 7; + private java.util.List indexMetas_; + public java.util.List getIndexMetasList() { + return indexMetas_; + } + public java.util.List + getIndexMetasOrBuilderList() { + return indexMetas_; + } + public int getIndexMetasCount() { + return indexMetas_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMetas(int index) { + return indexMetas_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetasOrBuilder( + int index) { + return indexMetas_.get(index); + } + + private void initFields() { + tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + indexMetas_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableMeta()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasReservedThroughput()) { + memoizedIsInitialized = 0; + return false; + } + if (!getTableMeta().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (!getReservedThroughput().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (hasStreamSpec()) { + if (!getStreamSpec().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getIndexMetasCount(); i++) { + if (!getIndexMetas(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, tableMeta_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, reservedThroughput_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, tableOptions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(5, streamSpec_); + } + for (int i = 0; i < indexMetas_.size(); i++) { + output.writeMessage(7, indexMetas_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tableMeta_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, reservedThroughput_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, tableOptions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, streamSpec_); + } + for (int i = 0; i < indexMetas_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, indexMetas_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTableMetaFieldBuilder(); + getReservedThroughputFieldBuilder(); + getTableOptionsFieldBuilder(); + getStreamSpecFieldBuilder(); + getIndexMetasFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tableMetaBuilder_ == null) { + tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + } else { + tableMetaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (reservedThroughputBuilder_ == null) { + reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + } else { + reservedThroughputBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (streamSpecBuilder_ == null) { + streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + } else { + streamSpecBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + if (indexMetasBuilder_ == null) { + indexMetas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + } else { + indexMetasBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (tableMetaBuilder_ == null) { + result.tableMeta_ = tableMeta_; + } else { + result.tableMeta_ = tableMetaBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (reservedThroughputBuilder_ == null) { + result.reservedThroughput_ = reservedThroughput_; + } else { + result.reservedThroughput_ = reservedThroughputBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (tableOptionsBuilder_ == null) { + result.tableOptions_ = tableOptions_; + } else { + result.tableOptions_ = tableOptionsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (streamSpecBuilder_ == null) { + result.streamSpec_ = streamSpec_; + } else { + result.streamSpec_ = streamSpecBuilder_.build(); + } + if (indexMetasBuilder_ == null) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { + indexMetas_ = java.util.Collections.unmodifiableList(indexMetas_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.indexMetas_ = indexMetas_; + } else { + result.indexMetas_ = indexMetasBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest.getDefaultInstance()) return this; + if (other.hasTableMeta()) { + mergeTableMeta(other.getTableMeta()); + } + if (other.hasReservedThroughput()) { + mergeReservedThroughput(other.getReservedThroughput()); + } + if (other.hasTableOptions()) { + mergeTableOptions(other.getTableOptions()); + } + if (other.hasStreamSpec()) { + mergeStreamSpec(other.getStreamSpec()); + } + if (indexMetasBuilder_ == null) { + if (!other.indexMetas_.isEmpty()) { + if (indexMetas_.isEmpty()) { + indexMetas_ = other.indexMetas_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureIndexMetasIsMutable(); + indexMetas_.addAll(other.indexMetas_); + } + onChanged(); + } + } else { + if (!other.indexMetas_.isEmpty()) { + if (indexMetasBuilder_.isEmpty()) { + indexMetasBuilder_.dispose(); + indexMetasBuilder_ = null; + indexMetas_ = other.indexMetas_; + bitField0_ = (bitField0_ & ~0x00000010); + indexMetasBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getIndexMetasFieldBuilder() : null; + } else { + indexMetasBuilder_.addAllMessages(other.indexMetas_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableMeta()) { + + return false; + } + if (!hasReservedThroughput()) { + + return false; + } + if (!getTableMeta().isInitialized()) { + + return false; + } + if (!getReservedThroughput().isInitialized()) { + + return false; + } + if (hasStreamSpec()) { + if (!getStreamSpec().isInitialized()) { + + return false; + } + } + for (int i = 0; i < getIndexMetasCount(); i++) { + if (!getIndexMetas(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.newBuilder(); + if (hasTableMeta()) { + subBuilder.mergeFrom(getTableMeta()); + } + input.readMessage(subBuilder, extensionRegistry); + setTableMeta(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.newBuilder(); + if (hasReservedThroughput()) { + subBuilder.mergeFrom(getReservedThroughput()); + } + input.readMessage(subBuilder, extensionRegistry); + setReservedThroughput(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(); + if (hasTableOptions()) { + subBuilder.mergeFrom(getTableOptions()); + } + input.readMessage(subBuilder, extensionRegistry); + setTableOptions(subBuilder.buildPartial()); + break; + } + case 42: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.newBuilder(); + if (hasStreamSpec()) { + subBuilder.mergeFrom(getStreamSpec()); + } + input.readMessage(subBuilder, extensionRegistry); + setStreamSpec(subBuilder.buildPartial()); + break; + } + case 58: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addIndexMetas(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.TableMeta table_meta = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder> tableMetaBuilder_; + public boolean hasTableMeta() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta getTableMeta() { + if (tableMetaBuilder_ == null) { + return tableMeta_; + } else { + return tableMetaBuilder_.getMessage(); + } + } + public Builder setTableMeta(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta value) { + if (tableMetaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tableMeta_ = value; + onChanged(); + } else { + tableMetaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setTableMeta( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder builderForValue) { + if (tableMetaBuilder_ == null) { + tableMeta_ = builderForValue.build(); + onChanged(); + } else { + tableMetaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeTableMeta(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta value) { + if (tableMetaBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + tableMeta_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance()) { + tableMeta_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.newBuilder(tableMeta_).mergeFrom(value).buildPartial(); + } else { + tableMeta_ = value; + } + onChanged(); + } else { + tableMetaBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearTableMeta() { + if (tableMetaBuilder_ == null) { + tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + onChanged(); + } else { + tableMetaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder getTableMetaBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getTableMetaFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder getTableMetaOrBuilder() { + if (tableMetaBuilder_ != null) { + return tableMetaBuilder_.getMessageOrBuilder(); + } else { + return tableMeta_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder> + getTableMetaFieldBuilder() { + if (tableMetaBuilder_ == null) { + tableMetaBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder>( + tableMeta_, + getParentForChildren(), + isClean()); + tableMeta_ = null; + } + return tableMetaBuilder_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput reserved_throughput = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder> reservedThroughputBuilder_; + public boolean hasReservedThroughput() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput getReservedThroughput() { + if (reservedThroughputBuilder_ == null) { + return reservedThroughput_; + } else { + return reservedThroughputBuilder_.getMessage(); + } + } + public Builder setReservedThroughput(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput value) { + if (reservedThroughputBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reservedThroughput_ = value; + onChanged(); + } else { + reservedThroughputBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setReservedThroughput( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder builderForValue) { + if (reservedThroughputBuilder_ == null) { + reservedThroughput_ = builderForValue.build(); + onChanged(); + } else { + reservedThroughputBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeReservedThroughput(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput value) { + if (reservedThroughputBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + reservedThroughput_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance()) { + reservedThroughput_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.newBuilder(reservedThroughput_).mergeFrom(value).buildPartial(); + } else { + reservedThroughput_ = value; + } + onChanged(); + } else { + reservedThroughputBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearReservedThroughput() { + if (reservedThroughputBuilder_ == null) { + reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + onChanged(); + } else { + reservedThroughputBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder getReservedThroughputBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getReservedThroughputFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { + if (reservedThroughputBuilder_ != null) { + return reservedThroughputBuilder_.getMessageOrBuilder(); + } else { + return reservedThroughput_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder> + getReservedThroughputFieldBuilder() { + if (reservedThroughputBuilder_ == null) { + reservedThroughputBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder>( + reservedThroughput_, + getParentForChildren(), + isClean()); + reservedThroughput_ = null; + } + return reservedThroughputBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> tableOptionsBuilder_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + if (tableOptionsBuilder_ == null) { + return tableOptions_; + } else { + return tableOptionsBuilder_.getMessage(); + } + } + public Builder setTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tableOptions_ = value; + onChanged(); + } else { + tableOptionsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setTableOptions( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder builderForValue) { + if (tableOptionsBuilder_ == null) { + tableOptions_ = builderForValue.build(); + onChanged(); + } else { + tableOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + tableOptions_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance()) { + tableOptions_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(tableOptions_).mergeFrom(value).buildPartial(); + } else { + tableOptions_ = value; + } + onChanged(); + } else { + tableOptionsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearTableOptions() { + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + onChanged(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder getTableOptionsBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getTableOptionsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + if (tableOptionsBuilder_ != null) { + return tableOptionsBuilder_.getMessageOrBuilder(); + } else { + return tableOptions_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> + getTableOptionsFieldBuilder() { + if (tableOptionsBuilder_ == null) { + tableOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder>( + tableOptions_, + getParentForChildren(), + isClean()); + tableOptions_ = null; + } + return tableOptionsBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamSpecification stream_spec = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder> streamSpecBuilder_; + public boolean hasStreamSpec() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification getStreamSpec() { + if (streamSpecBuilder_ == null) { + return streamSpec_; + } else { + return streamSpecBuilder_.getMessage(); + } + } + public Builder setStreamSpec(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification value) { + if (streamSpecBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + streamSpec_ = value; + onChanged(); + } else { + streamSpecBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setStreamSpec( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder builderForValue) { + if (streamSpecBuilder_ == null) { + streamSpec_ = builderForValue.build(); + onChanged(); + } else { + streamSpecBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeStreamSpec(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification value) { + if (streamSpecBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + streamSpec_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance()) { + streamSpec_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.newBuilder(streamSpec_).mergeFrom(value).buildPartial(); + } else { + streamSpec_ = value; + } + onChanged(); + } else { + streamSpecBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearStreamSpec() { + if (streamSpecBuilder_ == null) { + streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + onChanged(); + } else { + streamSpecBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder getStreamSpecBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getStreamSpecFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder getStreamSpecOrBuilder() { + if (streamSpecBuilder_ != null) { + return streamSpecBuilder_.getMessageOrBuilder(); + } else { + return streamSpec_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder> + getStreamSpecFieldBuilder() { + if (streamSpecBuilder_ == null) { + streamSpecBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder>( + streamSpec_, + getParentForChildren(), + isClean()); + streamSpec_ = null; + } + return streamSpecBuilder_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_metas = 7; + private java.util.List indexMetas_ = + java.util.Collections.emptyList(); + private void ensureIndexMetasIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + indexMetas_ = new java.util.ArrayList(indexMetas_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder> indexMetasBuilder_; + + public java.util.List getIndexMetasList() { + if (indexMetasBuilder_ == null) { + return java.util.Collections.unmodifiableList(indexMetas_); + } else { + return indexMetasBuilder_.getMessageList(); + } + } + public int getIndexMetasCount() { + if (indexMetasBuilder_ == null) { + return indexMetas_.size(); + } else { + return indexMetasBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMetas(int index) { + if (indexMetasBuilder_ == null) { + return indexMetas_.get(index); + } else { + return indexMetasBuilder_.getMessage(index); + } + } + public Builder setIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndexMetasIsMutable(); + indexMetas_.set(index, value); + onChanged(); + } else { + indexMetasBuilder_.setMessage(index, value); + } + return this; + } + public Builder setIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder builderForValue) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.set(index, builderForValue.build()); + onChanged(); + } else { + indexMetasBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addIndexMetas(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndexMetasIsMutable(); + indexMetas_.add(value); + onChanged(); + } else { + indexMetasBuilder_.addMessage(value); + } + return this; + } + public Builder addIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndexMetasIsMutable(); + indexMetas_.add(index, value); + onChanged(); + } else { + indexMetasBuilder_.addMessage(index, value); + } + return this; + } + public Builder addIndexMetas( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder builderForValue) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.add(builderForValue.build()); + onChanged(); + } else { + indexMetasBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder builderForValue) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.add(index, builderForValue.build()); + onChanged(); + } else { + indexMetasBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllIndexMetas( + java.lang.Iterable values) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + super.addAll(values, indexMetas_); + onChanged(); + } else { + indexMetasBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearIndexMetas() { + if (indexMetasBuilder_ == null) { + indexMetas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + indexMetasBuilder_.clear(); + } + return this; + } + public Builder removeIndexMetas(int index) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.remove(index); + onChanged(); + } else { + indexMetasBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder getIndexMetasBuilder( + int index) { + return getIndexMetasFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetasOrBuilder( + int index) { + if (indexMetasBuilder_ == null) { + return indexMetas_.get(index); } else { + return indexMetasBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getIndexMetasOrBuilderList() { + if (indexMetasBuilder_ != null) { + return indexMetasBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(indexMetas_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder addIndexMetasBuilder() { + return getIndexMetasFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder addIndexMetasBuilder( + int index) { + return getIndexMetasFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance()); + } + public java.util.List + getIndexMetasBuilderList() { + return getIndexMetasFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder> + getIndexMetasFieldBuilder() { + if (indexMetasBuilder_ == null) { + indexMetasBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder>( + indexMetas_, + ((bitField0_ & 0x00000010) == 0x00000010), + getParentForChildren(), + isClean()); + indexMetas_ = null; + } + return indexMetasBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTableRequest) + } + + static { + defaultInstance = new CreateTableRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTableRequest) + } + + public interface CreateTableResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class CreateTableResponse extends + com.google.protobuf.GeneratedMessage + implements CreateTableResponseOrBuilder { + // Use CreateTableResponse.newBuilder() to construct. + private CreateTableResponse(Builder builder) { + super(builder); + } + private CreateTableResponse(boolean noInit) {} + + private static final CreateTableResponse defaultInstance; + public static CreateTableResponse getDefaultInstance() { + return defaultInstance; + } + + public CreateTableResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTableResponse) + } + + static { + defaultInstance = new CreateTableResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTableResponse) + } + + public interface CreateIndexRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string main_table_name = 1; + boolean hasMainTableName(); + String getMainTableName(); + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_meta = 2; + boolean hasIndexMeta(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMeta(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetaOrBuilder(); + + // optional bool include_base_data = 3; + boolean hasIncludeBaseData(); + boolean getIncludeBaseData(); + } + public static final class CreateIndexRequest extends + com.google.protobuf.GeneratedMessage + implements CreateIndexRequestOrBuilder { + // Use CreateIndexRequest.newBuilder() to construct. + private CreateIndexRequest(Builder builder) { + super(builder); + } + private CreateIndexRequest(boolean noInit) {} + + private static final CreateIndexRequest defaultInstance; + public static CreateIndexRequest getDefaultInstance() { + return defaultInstance; + } + + public CreateIndexRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string main_table_name = 1; + public static final int MAIN_TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object mainTableName_; + public boolean hasMainTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getMainTableName() { + java.lang.Object ref = mainTableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + mainTableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getMainTableNameBytes() { + java.lang.Object ref = mainTableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + mainTableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_meta = 2; + public static final int INDEX_META_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta indexMeta_; + public boolean hasIndexMeta() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMeta() { + return indexMeta_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetaOrBuilder() { + return indexMeta_; + } + + // optional bool include_base_data = 3; + public static final int INCLUDE_BASE_DATA_FIELD_NUMBER = 3; + private boolean includeBaseData_; + public boolean hasIncludeBaseData() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public boolean getIncludeBaseData() { + return includeBaseData_; + } + + private void initFields() { + mainTableName_ = ""; + indexMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance(); + includeBaseData_ = false; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasMainTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasIndexMeta()) { + memoizedIsInitialized = 0; + return false; + } + if (!getIndexMeta().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getMainTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, indexMeta_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBool(3, includeBaseData_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getMainTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, indexMeta_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, includeBaseData_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getIndexMetaFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + mainTableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (indexMetaBuilder_ == null) { + indexMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance(); + } else { + indexMetaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + includeBaseData_ = false; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.mainTableName_ = mainTableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (indexMetaBuilder_ == null) { + result.indexMeta_ = indexMeta_; + } else { + result.indexMeta_ = indexMetaBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.includeBaseData_ = includeBaseData_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest.getDefaultInstance()) return this; + if (other.hasMainTableName()) { + setMainTableName(other.getMainTableName()); + } + if (other.hasIndexMeta()) { + mergeIndexMeta(other.getIndexMeta()); + } + if (other.hasIncludeBaseData()) { + setIncludeBaseData(other.getIncludeBaseData()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasMainTableName()) { + + return false; + } + if (!hasIndexMeta()) { + + return false; + } + if (!getIndexMeta().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + mainTableName_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.newBuilder(); + if (hasIndexMeta()) { + subBuilder.mergeFrom(getIndexMeta()); + } + input.readMessage(subBuilder, extensionRegistry); + setIndexMeta(subBuilder.buildPartial()); + break; + } + case 24: { + bitField0_ |= 0x00000004; + includeBaseData_ = input.readBool(); + break; + } + } + } + } + + private int bitField0_; + + // required string main_table_name = 1; + private java.lang.Object mainTableName_ = ""; + public boolean hasMainTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getMainTableName() { + java.lang.Object ref = mainTableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + mainTableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setMainTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + mainTableName_ = value; + onChanged(); + return this; + } + public Builder clearMainTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + mainTableName_ = getDefaultInstance().getMainTableName(); + onChanged(); + return this; + } + void setMainTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + mainTableName_ = value; + onChanged(); + } + + // required .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_meta = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta indexMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder> indexMetaBuilder_; + public boolean hasIndexMeta() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMeta() { + if (indexMetaBuilder_ == null) { + return indexMeta_; + } else { + return indexMetaBuilder_.getMessage(); + } + } + public Builder setIndexMeta(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + indexMeta_ = value; + onChanged(); + } else { + indexMetaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setIndexMeta( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder builderForValue) { + if (indexMetaBuilder_ == null) { + indexMeta_ = builderForValue.build(); + onChanged(); + } else { + indexMetaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeIndexMeta(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetaBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + indexMeta_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance()) { + indexMeta_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.newBuilder(indexMeta_).mergeFrom(value).buildPartial(); + } else { + indexMeta_ = value; + } + onChanged(); + } else { + indexMetaBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearIndexMeta() { + if (indexMetaBuilder_ == null) { + indexMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance(); + onChanged(); + } else { + indexMetaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder getIndexMetaBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getIndexMetaFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetaOrBuilder() { + if (indexMetaBuilder_ != null) { + return indexMetaBuilder_.getMessageOrBuilder(); + } else { + return indexMeta_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder> + getIndexMetaFieldBuilder() { + if (indexMetaBuilder_ == null) { + indexMetaBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder>( + indexMeta_, + getParentForChildren(), + isClean()); + indexMeta_ = null; + } + return indexMetaBuilder_; + } + + // optional bool include_base_data = 3; + private boolean includeBaseData_ ; + public boolean hasIncludeBaseData() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public boolean getIncludeBaseData() { + return includeBaseData_; + } + public Builder setIncludeBaseData(boolean value) { + bitField0_ |= 0x00000004; + includeBaseData_ = value; + onChanged(); + return this; + } + public Builder clearIncludeBaseData() { + bitField0_ = (bitField0_ & ~0x00000004); + includeBaseData_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateIndexRequest) + } + + static { + defaultInstance = new CreateIndexRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateIndexRequest) + } + + public interface CreateIndexResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class CreateIndexResponse extends + com.google.protobuf.GeneratedMessage + implements CreateIndexResponseOrBuilder { + // Use CreateIndexResponse.newBuilder() to construct. + private CreateIndexResponse(Builder builder) { + super(builder); + } + private CreateIndexResponse(boolean noInit) {} + + private static final CreateIndexResponse defaultInstance; + public static CreateIndexResponse getDefaultInstance() { + return defaultInstance; + } + + public CreateIndexResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateIndexResponse) + } + + static { + defaultInstance = new CreateIndexResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateIndexResponse) + } + + public interface DropIndexRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string main_table_name = 1; + boolean hasMainTableName(); + String getMainTableName(); + + // required string index_name = 2; + boolean hasIndexName(); + String getIndexName(); + } + public static final class DropIndexRequest extends + com.google.protobuf.GeneratedMessage + implements DropIndexRequestOrBuilder { + // Use DropIndexRequest.newBuilder() to construct. + private DropIndexRequest(Builder builder) { + super(builder); + } + private DropIndexRequest(boolean noInit) {} + + private static final DropIndexRequest defaultInstance; + public static DropIndexRequest getDefaultInstance() { + return defaultInstance; + } + + public DropIndexRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string main_table_name = 1; + public static final int MAIN_TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object mainTableName_; + public boolean hasMainTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getMainTableName() { + java.lang.Object ref = mainTableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + mainTableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getMainTableNameBytes() { + java.lang.Object ref = mainTableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + mainTableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string index_name = 2; + public static final int INDEX_NAME_FIELD_NUMBER = 2; + private java.lang.Object indexName_; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + indexName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIndexNameBytes() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + indexName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + mainTableName_ = ""; + indexName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasMainTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasIndexName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getMainTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIndexNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getMainTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIndexNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + mainTableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + indexName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.mainTableName_ = mainTableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.indexName_ = indexName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest.getDefaultInstance()) return this; + if (other.hasMainTableName()) { + setMainTableName(other.getMainTableName()); + } + if (other.hasIndexName()) { + setIndexName(other.getIndexName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasMainTableName()) { + + return false; + } + if (!hasIndexName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + mainTableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + indexName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string main_table_name = 1; + private java.lang.Object mainTableName_ = ""; + public boolean hasMainTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getMainTableName() { + java.lang.Object ref = mainTableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + mainTableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setMainTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + mainTableName_ = value; + onChanged(); + return this; + } + public Builder clearMainTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + mainTableName_ = getDefaultInstance().getMainTableName(); + onChanged(); + return this; + } + void setMainTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + mainTableName_ = value; + onChanged(); + } + + // required string index_name = 2; + private java.lang.Object indexName_ = ""; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + indexName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIndexName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + return this; + } + public Builder clearIndexName() { + bitField0_ = (bitField0_ & ~0x00000002); + indexName_ = getDefaultInstance().getIndexName(); + onChanged(); + return this; + } + void setIndexName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DropIndexRequest) + } + + static { + defaultInstance = new DropIndexRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DropIndexRequest) + } + + public interface DropIndexResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class DropIndexResponse extends + com.google.protobuf.GeneratedMessage + implements DropIndexResponseOrBuilder { + // Use DropIndexResponse.newBuilder() to construct. + private DropIndexResponse(Builder builder) { + super(builder); + } + private DropIndexResponse(boolean noInit) {} + + private static final DropIndexResponse defaultInstance; + public static DropIndexResponse getDefaultInstance() { + return defaultInstance; + } + + public DropIndexResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DropIndexResponse) + } + + static { + defaultInstance = new DropIndexResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DropIndexResponse) + } + + public interface UpdateTableRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput reserved_throughput = 2; + boolean hasReservedThroughput(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput getReservedThroughput(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder getReservedThroughputOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + boolean hasTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamSpecification stream_spec = 4; + boolean hasStreamSpec(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification getStreamSpec(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder getStreamSpecOrBuilder(); + } + public static final class UpdateTableRequest extends + com.google.protobuf.GeneratedMessage + implements UpdateTableRequestOrBuilder { + // Use UpdateTableRequest.newBuilder() to construct. + private UpdateTableRequest(Builder builder) { + super(builder); + } + private UpdateTableRequest(boolean noInit) {} + + private static final UpdateTableRequest defaultInstance; + public static UpdateTableRequest getDefaultInstance() { + return defaultInstance; + } + + public UpdateTableRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput reserved_throughput = 2; + public static final int RESERVED_THROUGHPUT_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput reservedThroughput_; + public boolean hasReservedThroughput() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput getReservedThroughput() { + return reservedThroughput_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { + return reservedThroughput_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + public static final int TABLE_OPTIONS_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + return tableOptions_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + return tableOptions_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamSpecification stream_spec = 4; + public static final int STREAM_SPEC_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification streamSpec_; + public boolean hasStreamSpec() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification getStreamSpec() { + return streamSpec_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder getStreamSpecOrBuilder() { + return streamSpec_; + } + + private void initFields() { + tableName_ = ""; + reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (hasReservedThroughput()) { + if (!getReservedThroughput().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasStreamSpec()) { + if (!getStreamSpec().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, reservedThroughput_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, tableOptions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, streamSpec_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, reservedThroughput_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, tableOptions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, streamSpec_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getReservedThroughputFieldBuilder(); + getTableOptionsFieldBuilder(); + getStreamSpecFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (reservedThroughputBuilder_ == null) { + reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + } else { + reservedThroughputBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (streamSpecBuilder_ == null) { + streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + } else { + streamSpecBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (reservedThroughputBuilder_ == null) { + result.reservedThroughput_ = reservedThroughput_; + } else { + result.reservedThroughput_ = reservedThroughputBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (tableOptionsBuilder_ == null) { + result.tableOptions_ = tableOptions_; + } else { + result.tableOptions_ = tableOptionsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (streamSpecBuilder_ == null) { + result.streamSpec_ = streamSpec_; + } else { + result.streamSpec_ = streamSpecBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasReservedThroughput()) { + mergeReservedThroughput(other.getReservedThroughput()); + } + if (other.hasTableOptions()) { + mergeTableOptions(other.getTableOptions()); + } + if (other.hasStreamSpec()) { + mergeStreamSpec(other.getStreamSpec()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (hasReservedThroughput()) { + if (!getReservedThroughput().isInitialized()) { + + return false; + } + } + if (hasStreamSpec()) { + if (!getStreamSpec().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.newBuilder(); + if (hasReservedThroughput()) { + subBuilder.mergeFrom(getReservedThroughput()); + } + input.readMessage(subBuilder, extensionRegistry); + setReservedThroughput(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(); + if (hasTableOptions()) { + subBuilder.mergeFrom(getTableOptions()); + } + input.readMessage(subBuilder, extensionRegistry); + setTableOptions(subBuilder.buildPartial()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.newBuilder(); + if (hasStreamSpec()) { + subBuilder.mergeFrom(getStreamSpec()); + } + input.readMessage(subBuilder, extensionRegistry); + setStreamSpec(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughput reserved_throughput = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder> reservedThroughputBuilder_; + public boolean hasReservedThroughput() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput getReservedThroughput() { + if (reservedThroughputBuilder_ == null) { + return reservedThroughput_; + } else { + return reservedThroughputBuilder_.getMessage(); + } + } + public Builder setReservedThroughput(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput value) { + if (reservedThroughputBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reservedThroughput_ = value; + onChanged(); + } else { + reservedThroughputBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setReservedThroughput( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder builderForValue) { + if (reservedThroughputBuilder_ == null) { + reservedThroughput_ = builderForValue.build(); + onChanged(); + } else { + reservedThroughputBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeReservedThroughput(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput value) { + if (reservedThroughputBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + reservedThroughput_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance()) { + reservedThroughput_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.newBuilder(reservedThroughput_).mergeFrom(value).buildPartial(); + } else { + reservedThroughput_ = value; + } + onChanged(); + } else { + reservedThroughputBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearReservedThroughput() { + if (reservedThroughputBuilder_ == null) { + reservedThroughput_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.getDefaultInstance(); + onChanged(); + } else { + reservedThroughputBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder getReservedThroughputBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getReservedThroughputFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { + if (reservedThroughputBuilder_ != null) { + return reservedThroughputBuilder_.getMessageOrBuilder(); + } else { + return reservedThroughput_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder> + getReservedThroughputFieldBuilder() { + if (reservedThroughputBuilder_ == null) { + reservedThroughputBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputOrBuilder>( + reservedThroughput_, + getParentForChildren(), + isClean()); + reservedThroughput_ = null; + } + return reservedThroughputBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> tableOptionsBuilder_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + if (tableOptionsBuilder_ == null) { + return tableOptions_; + } else { + return tableOptionsBuilder_.getMessage(); + } + } + public Builder setTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tableOptions_ = value; + onChanged(); + } else { + tableOptionsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setTableOptions( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder builderForValue) { + if (tableOptionsBuilder_ == null) { + tableOptions_ = builderForValue.build(); + onChanged(); + } else { + tableOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + tableOptions_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance()) { + tableOptions_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(tableOptions_).mergeFrom(value).buildPartial(); + } else { + tableOptions_ = value; + } + onChanged(); + } else { + tableOptionsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearTableOptions() { + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + onChanged(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder getTableOptionsBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getTableOptionsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + if (tableOptionsBuilder_ != null) { + return tableOptionsBuilder_.getMessageOrBuilder(); + } else { + return tableOptions_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> + getTableOptionsFieldBuilder() { + if (tableOptionsBuilder_ == null) { + tableOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder>( + tableOptions_, + getParentForChildren(), + isClean()); + tableOptions_ = null; + } + return tableOptionsBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamSpecification stream_spec = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder> streamSpecBuilder_; + public boolean hasStreamSpec() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification getStreamSpec() { + if (streamSpecBuilder_ == null) { + return streamSpec_; + } else { + return streamSpecBuilder_.getMessage(); + } + } + public Builder setStreamSpec(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification value) { + if (streamSpecBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + streamSpec_ = value; + onChanged(); + } else { + streamSpecBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setStreamSpec( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder builderForValue) { + if (streamSpecBuilder_ == null) { + streamSpec_ = builderForValue.build(); + onChanged(); + } else { + streamSpecBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeStreamSpec(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification value) { + if (streamSpecBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + streamSpec_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance()) { + streamSpec_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.newBuilder(streamSpec_).mergeFrom(value).buildPartial(); + } else { + streamSpec_ = value; + } + onChanged(); + } else { + streamSpecBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearStreamSpec() { + if (streamSpecBuilder_ == null) { + streamSpec_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.getDefaultInstance(); + onChanged(); + } else { + streamSpecBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder getStreamSpecBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getStreamSpecFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder getStreamSpecOrBuilder() { + if (streamSpecBuilder_ != null) { + return streamSpecBuilder_.getMessageOrBuilder(); + } else { + return streamSpec_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder> + getStreamSpecFieldBuilder() { + if (streamSpecBuilder_ == null) { + streamSpecBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecificationOrBuilder>( + streamSpec_, + getParentForChildren(), + isClean()); + streamSpec_ = null; + } + return streamSpecBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateTableRequest) + } + + static { + defaultInstance = new UpdateTableRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateTableRequest) + } + + public interface UpdateTableResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails reserved_throughput_details = 1; + boolean hasReservedThroughputDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails getReservedThroughputDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder(); + + // required .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 2; + boolean hasTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamDetails stream_details = 3; + boolean hasStreamDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails getStreamDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder getStreamDetailsOrBuilder(); + } + public static final class UpdateTableResponse extends + com.google.protobuf.GeneratedMessage + implements UpdateTableResponseOrBuilder { + // Use UpdateTableResponse.newBuilder() to construct. + private UpdateTableResponse(Builder builder) { + super(builder); + } + private UpdateTableResponse(boolean noInit) {} + + private static final UpdateTableResponse defaultInstance; + public static UpdateTableResponse getDefaultInstance() { + return defaultInstance; + } + + public UpdateTableResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails reserved_throughput_details = 1; + public static final int RESERVED_THROUGHPUT_DETAILS_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails reservedThroughputDetails_; + public boolean hasReservedThroughputDetails() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails getReservedThroughputDetails() { + return reservedThroughputDetails_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { + return reservedThroughputDetails_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 2; + public static final int TABLE_OPTIONS_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + return tableOptions_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + return tableOptions_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamDetails stream_details = 3; + public static final int STREAM_DETAILS_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails streamDetails_; + public boolean hasStreamDetails() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails getStreamDetails() { + return streamDetails_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder getStreamDetailsOrBuilder() { + return streamDetails_; + } + + private void initFields() { + reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasReservedThroughputDetails()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTableOptions()) { + memoizedIsInitialized = 0; + return false; + } + if (!getReservedThroughputDetails().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (hasStreamDetails()) { + if (!getStreamDetails().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, reservedThroughputDetails_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, tableOptions_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, streamDetails_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, reservedThroughputDetails_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, tableOptions_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, streamDetails_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getReservedThroughputDetailsFieldBuilder(); + getTableOptionsFieldBuilder(); + getStreamDetailsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + } else { + reservedThroughputDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (streamDetailsBuilder_ == null) { + streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + } else { + streamDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (reservedThroughputDetailsBuilder_ == null) { + result.reservedThroughputDetails_ = reservedThroughputDetails_; + } else { + result.reservedThroughputDetails_ = reservedThroughputDetailsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (tableOptionsBuilder_ == null) { + result.tableOptions_ = tableOptions_; + } else { + result.tableOptions_ = tableOptionsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (streamDetailsBuilder_ == null) { + result.streamDetails_ = streamDetails_; + } else { + result.streamDetails_ = streamDetailsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse.getDefaultInstance()) return this; + if (other.hasReservedThroughputDetails()) { + mergeReservedThroughputDetails(other.getReservedThroughputDetails()); + } + if (other.hasTableOptions()) { + mergeTableOptions(other.getTableOptions()); + } + if (other.hasStreamDetails()) { + mergeStreamDetails(other.getStreamDetails()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasReservedThroughputDetails()) { + + return false; + } + if (!hasTableOptions()) { + + return false; + } + if (!getReservedThroughputDetails().isInitialized()) { + + return false; + } + if (hasStreamDetails()) { + if (!getStreamDetails().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.newBuilder(); + if (hasReservedThroughputDetails()) { + subBuilder.mergeFrom(getReservedThroughputDetails()); + } + input.readMessage(subBuilder, extensionRegistry); + setReservedThroughputDetails(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(); + if (hasTableOptions()) { + subBuilder.mergeFrom(getTableOptions()); + } + input.readMessage(subBuilder, extensionRegistry); + setTableOptions(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.newBuilder(); + if (hasStreamDetails()) { + subBuilder.mergeFrom(getStreamDetails()); + } + input.readMessage(subBuilder, extensionRegistry); + setStreamDetails(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails reserved_throughput_details = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder> reservedThroughputDetailsBuilder_; + public boolean hasReservedThroughputDetails() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails getReservedThroughputDetails() { + if (reservedThroughputDetailsBuilder_ == null) { + return reservedThroughputDetails_; + } else { + return reservedThroughputDetailsBuilder_.getMessage(); + } + } + public Builder setReservedThroughputDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails value) { + if (reservedThroughputDetailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reservedThroughputDetails_ = value; + onChanged(); + } else { + reservedThroughputDetailsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setReservedThroughputDetails( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder builderForValue) { + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetails_ = builderForValue.build(); + onChanged(); + } else { + reservedThroughputDetailsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeReservedThroughputDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails value) { + if (reservedThroughputDetailsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + reservedThroughputDetails_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance()) { + reservedThroughputDetails_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.newBuilder(reservedThroughputDetails_).mergeFrom(value).buildPartial(); + } else { + reservedThroughputDetails_ = value; + } + onChanged(); + } else { + reservedThroughputDetailsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearReservedThroughputDetails() { + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + onChanged(); + } else { + reservedThroughputDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder getReservedThroughputDetailsBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getReservedThroughputDetailsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { + if (reservedThroughputDetailsBuilder_ != null) { + return reservedThroughputDetailsBuilder_.getMessageOrBuilder(); + } else { + return reservedThroughputDetails_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder> + getReservedThroughputDetailsFieldBuilder() { + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetailsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder>( + reservedThroughputDetails_, + getParentForChildren(), + isClean()); + reservedThroughputDetails_ = null; + } + return reservedThroughputDetailsBuilder_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> tableOptionsBuilder_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + if (tableOptionsBuilder_ == null) { + return tableOptions_; + } else { + return tableOptionsBuilder_.getMessage(); + } + } + public Builder setTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tableOptions_ = value; + onChanged(); + } else { + tableOptionsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setTableOptions( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder builderForValue) { + if (tableOptionsBuilder_ == null) { + tableOptions_ = builderForValue.build(); + onChanged(); + } else { + tableOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + tableOptions_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance()) { + tableOptions_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(tableOptions_).mergeFrom(value).buildPartial(); + } else { + tableOptions_ = value; + } + onChanged(); + } else { + tableOptionsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearTableOptions() { + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + onChanged(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder getTableOptionsBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getTableOptionsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + if (tableOptionsBuilder_ != null) { + return tableOptionsBuilder_.getMessageOrBuilder(); + } else { + return tableOptions_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> + getTableOptionsFieldBuilder() { + if (tableOptionsBuilder_ == null) { + tableOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder>( + tableOptions_, + getParentForChildren(), + isClean()); + tableOptions_ = null; + } + return tableOptionsBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamDetails stream_details = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder> streamDetailsBuilder_; + public boolean hasStreamDetails() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails getStreamDetails() { + if (streamDetailsBuilder_ == null) { + return streamDetails_; + } else { + return streamDetailsBuilder_.getMessage(); + } + } + public Builder setStreamDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails value) { + if (streamDetailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + streamDetails_ = value; + onChanged(); + } else { + streamDetailsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setStreamDetails( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder builderForValue) { + if (streamDetailsBuilder_ == null) { + streamDetails_ = builderForValue.build(); + onChanged(); + } else { + streamDetailsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeStreamDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails value) { + if (streamDetailsBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + streamDetails_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance()) { + streamDetails_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.newBuilder(streamDetails_).mergeFrom(value).buildPartial(); + } else { + streamDetails_ = value; + } + onChanged(); + } else { + streamDetailsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearStreamDetails() { + if (streamDetailsBuilder_ == null) { + streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + onChanged(); + } else { + streamDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder getStreamDetailsBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getStreamDetailsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder getStreamDetailsOrBuilder() { + if (streamDetailsBuilder_ != null) { + return streamDetailsBuilder_.getMessageOrBuilder(); + } else { + return streamDetails_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder> + getStreamDetailsFieldBuilder() { + if (streamDetailsBuilder_ == null) { + streamDetailsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder>( + streamDetails_, + getParentForChildren(), + isClean()); + streamDetails_ = null; + } + return streamDetailsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateTableResponse) + } + + static { + defaultInstance = new UpdateTableResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateTableResponse) + } + + public interface DescribeTableRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + } + public static final class DescribeTableRequest extends + com.google.protobuf.GeneratedMessage + implements DescribeTableRequestOrBuilder { + // Use DescribeTableRequest.newBuilder() to construct. + private DescribeTableRequest(Builder builder) { + super(builder); + } + private DescribeTableRequest(boolean noInit) {} + + private static final DescribeTableRequest defaultInstance; + public static DescribeTableRequest getDefaultInstance() { + return defaultInstance; + } + + public DescribeTableRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTableRequest) + } + + static { + defaultInstance = new DescribeTableRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTableRequest) + } + + public interface DescribeTableResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.TableMeta table_meta = 1; + boolean hasTableMeta(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta getTableMeta(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder getTableMetaOrBuilder(); + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails reserved_throughput_details = 2; + boolean hasReservedThroughputDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails getReservedThroughputDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder(); + + // required .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + boolean hasTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamDetails stream_details = 5; + boolean hasStreamDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails getStreamDetails(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder getStreamDetailsOrBuilder(); + + // repeated bytes shard_splits = 6; + java.util.List getShardSplitsList(); + int getShardSplitsCount(); + com.google.protobuf.ByteString getShardSplits(int index); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_metas = 8; + java.util.List + getIndexMetasList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMetas(int index); + int getIndexMetasCount(); + java.util.List + getIndexMetasOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetasOrBuilder( + int index); + } + public static final class DescribeTableResponse extends + com.google.protobuf.GeneratedMessage + implements DescribeTableResponseOrBuilder { + // Use DescribeTableResponse.newBuilder() to construct. + private DescribeTableResponse(Builder builder) { + super(builder); + } + private DescribeTableResponse(boolean noInit) {} + + private static final DescribeTableResponse defaultInstance; + public static DescribeTableResponse getDefaultInstance() { + return defaultInstance; + } + + public DescribeTableResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.TableMeta table_meta = 1; + public static final int TABLE_META_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta tableMeta_; + public boolean hasTableMeta() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta getTableMeta() { + return tableMeta_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder getTableMetaOrBuilder() { + return tableMeta_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails reserved_throughput_details = 2; + public static final int RESERVED_THROUGHPUT_DETAILS_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails reservedThroughputDetails_; + public boolean hasReservedThroughputDetails() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails getReservedThroughputDetails() { + return reservedThroughputDetails_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { + return reservedThroughputDetails_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + public static final int TABLE_OPTIONS_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + return tableOptions_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + return tableOptions_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamDetails stream_details = 5; + public static final int STREAM_DETAILS_FIELD_NUMBER = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails streamDetails_; + public boolean hasStreamDetails() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails getStreamDetails() { + return streamDetails_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder getStreamDetailsOrBuilder() { + return streamDetails_; + } + + // repeated bytes shard_splits = 6; + public static final int SHARD_SPLITS_FIELD_NUMBER = 6; + private java.util.List shardSplits_; + public java.util.List + getShardSplitsList() { + return shardSplits_; + } + public int getShardSplitsCount() { + return shardSplits_.size(); + } + public com.google.protobuf.ByteString getShardSplits(int index) { + return shardSplits_.get(index); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_metas = 8; + public static final int INDEX_METAS_FIELD_NUMBER = 8; + private java.util.List indexMetas_; + public java.util.List getIndexMetasList() { + return indexMetas_; + } + public java.util.List + getIndexMetasOrBuilderList() { + return indexMetas_; + } + public int getIndexMetasCount() { + return indexMetas_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMetas(int index) { + return indexMetas_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetasOrBuilder( + int index) { + return indexMetas_.get(index); + } + + private void initFields() { + tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + shardSplits_ = java.util.Collections.emptyList();; + indexMetas_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableMeta()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasReservedThroughputDetails()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTableOptions()) { + memoizedIsInitialized = 0; + return false; + } + if (!getTableMeta().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (!getReservedThroughputDetails().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (hasStreamDetails()) { + if (!getStreamDetails().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getIndexMetasCount(); i++) { + if (!getIndexMetas(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, tableMeta_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, reservedThroughputDetails_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, tableOptions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(5, streamDetails_); + } + for (int i = 0; i < shardSplits_.size(); i++) { + output.writeBytes(6, shardSplits_.get(i)); + } + for (int i = 0; i < indexMetas_.size(); i++) { + output.writeMessage(8, indexMetas_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tableMeta_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, reservedThroughputDetails_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, tableOptions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, streamDetails_); + } + { + int dataSize = 0; + for (int i = 0; i < shardSplits_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(shardSplits_.get(i)); + } + size += dataSize; + size += 1 * getShardSplitsList().size(); + } + for (int i = 0; i < indexMetas_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, indexMetas_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTableMetaFieldBuilder(); + getReservedThroughputDetailsFieldBuilder(); + getTableOptionsFieldBuilder(); + getStreamDetailsFieldBuilder(); + getIndexMetasFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tableMetaBuilder_ == null) { + tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + } else { + tableMetaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + } else { + reservedThroughputDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (streamDetailsBuilder_ == null) { + streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + } else { + streamDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + shardSplits_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000010); + if (indexMetasBuilder_ == null) { + indexMetas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + } else { + indexMetasBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (tableMetaBuilder_ == null) { + result.tableMeta_ = tableMeta_; + } else { + result.tableMeta_ = tableMetaBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (reservedThroughputDetailsBuilder_ == null) { + result.reservedThroughputDetails_ = reservedThroughputDetails_; + } else { + result.reservedThroughputDetails_ = reservedThroughputDetailsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (tableOptionsBuilder_ == null) { + result.tableOptions_ = tableOptions_; + } else { + result.tableOptions_ = tableOptionsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (streamDetailsBuilder_ == null) { + result.streamDetails_ = streamDetails_; + } else { + result.streamDetails_ = streamDetailsBuilder_.build(); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + shardSplits_ = java.util.Collections.unmodifiableList(shardSplits_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.shardSplits_ = shardSplits_; + if (indexMetasBuilder_ == null) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { + indexMetas_ = java.util.Collections.unmodifiableList(indexMetas_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.indexMetas_ = indexMetas_; + } else { + result.indexMetas_ = indexMetasBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse.getDefaultInstance()) return this; + if (other.hasTableMeta()) { + mergeTableMeta(other.getTableMeta()); + } + if (other.hasReservedThroughputDetails()) { + mergeReservedThroughputDetails(other.getReservedThroughputDetails()); + } + if (other.hasTableOptions()) { + mergeTableOptions(other.getTableOptions()); + } + if (other.hasStreamDetails()) { + mergeStreamDetails(other.getStreamDetails()); + } + if (!other.shardSplits_.isEmpty()) { + if (shardSplits_.isEmpty()) { + shardSplits_ = other.shardSplits_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureShardSplitsIsMutable(); + shardSplits_.addAll(other.shardSplits_); + } + onChanged(); + } + if (indexMetasBuilder_ == null) { + if (!other.indexMetas_.isEmpty()) { + if (indexMetas_.isEmpty()) { + indexMetas_ = other.indexMetas_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureIndexMetasIsMutable(); + indexMetas_.addAll(other.indexMetas_); + } + onChanged(); + } + } else { + if (!other.indexMetas_.isEmpty()) { + if (indexMetasBuilder_.isEmpty()) { + indexMetasBuilder_.dispose(); + indexMetasBuilder_ = null; + indexMetas_ = other.indexMetas_; + bitField0_ = (bitField0_ & ~0x00000020); + indexMetasBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getIndexMetasFieldBuilder() : null; + } else { + indexMetasBuilder_.addAllMessages(other.indexMetas_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableMeta()) { + + return false; + } + if (!hasReservedThroughputDetails()) { + + return false; + } + if (!hasTableOptions()) { + + return false; + } + if (!getTableMeta().isInitialized()) { + + return false; + } + if (!getReservedThroughputDetails().isInitialized()) { + + return false; + } + if (hasStreamDetails()) { + if (!getStreamDetails().isInitialized()) { + + return false; + } + } + for (int i = 0; i < getIndexMetasCount(); i++) { + if (!getIndexMetas(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.newBuilder(); + if (hasTableMeta()) { + subBuilder.mergeFrom(getTableMeta()); + } + input.readMessage(subBuilder, extensionRegistry); + setTableMeta(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.newBuilder(); + if (hasReservedThroughputDetails()) { + subBuilder.mergeFrom(getReservedThroughputDetails()); + } + input.readMessage(subBuilder, extensionRegistry); + setReservedThroughputDetails(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(); + if (hasTableOptions()) { + subBuilder.mergeFrom(getTableOptions()); + } + input.readMessage(subBuilder, extensionRegistry); + setTableOptions(subBuilder.buildPartial()); + break; + } + case 42: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.newBuilder(); + if (hasStreamDetails()) { + subBuilder.mergeFrom(getStreamDetails()); + } + input.readMessage(subBuilder, extensionRegistry); + setStreamDetails(subBuilder.buildPartial()); + break; + } + case 50: { + ensureShardSplitsIsMutable(); + shardSplits_.add(input.readBytes()); + break; + } + case 66: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addIndexMetas(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.TableMeta table_meta = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder> tableMetaBuilder_; + public boolean hasTableMeta() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta getTableMeta() { + if (tableMetaBuilder_ == null) { + return tableMeta_; + } else { + return tableMetaBuilder_.getMessage(); + } + } + public Builder setTableMeta(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta value) { + if (tableMetaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tableMeta_ = value; + onChanged(); + } else { + tableMetaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setTableMeta( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder builderForValue) { + if (tableMetaBuilder_ == null) { + tableMeta_ = builderForValue.build(); + onChanged(); + } else { + tableMetaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeTableMeta(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta value) { + if (tableMetaBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + tableMeta_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance()) { + tableMeta_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.newBuilder(tableMeta_).mergeFrom(value).buildPartial(); + } else { + tableMeta_ = value; + } + onChanged(); + } else { + tableMetaBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearTableMeta() { + if (tableMetaBuilder_ == null) { + tableMeta_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.getDefaultInstance(); + onChanged(); + } else { + tableMetaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder getTableMetaBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getTableMetaFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder getTableMetaOrBuilder() { + if (tableMetaBuilder_ != null) { + return tableMetaBuilder_.getMessageOrBuilder(); + } else { + return tableMeta_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder> + getTableMetaFieldBuilder() { + if (tableMetaBuilder_ == null) { + tableMetaBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMetaOrBuilder>( + tableMeta_, + getParentForChildren(), + isClean()); + tableMeta_ = null; + } + return tableMetaBuilder_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.ReservedThroughputDetails reserved_throughput_details = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder> reservedThroughputDetailsBuilder_; + public boolean hasReservedThroughputDetails() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails getReservedThroughputDetails() { + if (reservedThroughputDetailsBuilder_ == null) { + return reservedThroughputDetails_; + } else { + return reservedThroughputDetailsBuilder_.getMessage(); + } + } + public Builder setReservedThroughputDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails value) { + if (reservedThroughputDetailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + reservedThroughputDetails_ = value; + onChanged(); + } else { + reservedThroughputDetailsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setReservedThroughputDetails( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder builderForValue) { + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetails_ = builderForValue.build(); + onChanged(); + } else { + reservedThroughputDetailsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeReservedThroughputDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails value) { + if (reservedThroughputDetailsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + reservedThroughputDetails_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance()) { + reservedThroughputDetails_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.newBuilder(reservedThroughputDetails_).mergeFrom(value).buildPartial(); + } else { + reservedThroughputDetails_ = value; + } + onChanged(); + } else { + reservedThroughputDetailsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearReservedThroughputDetails() { + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.getDefaultInstance(); + onChanged(); + } else { + reservedThroughputDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder getReservedThroughputDetailsBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getReservedThroughputDetailsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { + if (reservedThroughputDetailsBuilder_ != null) { + return reservedThroughputDetailsBuilder_.getMessageOrBuilder(); + } else { + return reservedThroughputDetails_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder> + getReservedThroughputDetailsFieldBuilder() { + if (reservedThroughputDetailsBuilder_ == null) { + reservedThroughputDetailsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetailsOrBuilder>( + reservedThroughputDetails_, + getParentForChildren(), + isClean()); + reservedThroughputDetails_ = null; + } + return reservedThroughputDetailsBuilder_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.TableOptions table_options = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> tableOptionsBuilder_; + public boolean hasTableOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions getTableOptions() { + if (tableOptionsBuilder_ == null) { + return tableOptions_; + } else { + return tableOptionsBuilder_.getMessage(); + } + } + public Builder setTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tableOptions_ = value; + onChanged(); + } else { + tableOptionsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setTableOptions( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder builderForValue) { + if (tableOptionsBuilder_ == null) { + tableOptions_ = builderForValue.build(); + onChanged(); + } else { + tableOptionsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeTableOptions(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions value) { + if (tableOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + tableOptions_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance()) { + tableOptions_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.newBuilder(tableOptions_).mergeFrom(value).buildPartial(); + } else { + tableOptions_ = value; + } + onChanged(); + } else { + tableOptionsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearTableOptions() { + if (tableOptionsBuilder_ == null) { + tableOptions_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.getDefaultInstance(); + onChanged(); + } else { + tableOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder getTableOptionsBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getTableOptionsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder getTableOptionsOrBuilder() { + if (tableOptionsBuilder_ != null) { + return tableOptionsBuilder_.getMessageOrBuilder(); + } else { + return tableOptions_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder> + getTableOptionsFieldBuilder() { + if (tableOptionsBuilder_ == null) { + tableOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptionsOrBuilder>( + tableOptions_, + getParentForChildren(), + isClean()); + tableOptions_ = null; + } + return tableOptionsBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.StreamDetails stream_details = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder> streamDetailsBuilder_; + public boolean hasStreamDetails() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails getStreamDetails() { + if (streamDetailsBuilder_ == null) { + return streamDetails_; + } else { + return streamDetailsBuilder_.getMessage(); + } + } + public Builder setStreamDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails value) { + if (streamDetailsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + streamDetails_ = value; + onChanged(); + } else { + streamDetailsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setStreamDetails( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder builderForValue) { + if (streamDetailsBuilder_ == null) { + streamDetails_ = builderForValue.build(); + onChanged(); + } else { + streamDetailsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeStreamDetails(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails value) { + if (streamDetailsBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + streamDetails_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance()) { + streamDetails_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.newBuilder(streamDetails_).mergeFrom(value).buildPartial(); + } else { + streamDetails_ = value; + } + onChanged(); + } else { + streamDetailsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearStreamDetails() { + if (streamDetailsBuilder_ == null) { + streamDetails_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.getDefaultInstance(); + onChanged(); + } else { + streamDetailsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder getStreamDetailsBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getStreamDetailsFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder getStreamDetailsOrBuilder() { + if (streamDetailsBuilder_ != null) { + return streamDetailsBuilder_.getMessageOrBuilder(); + } else { + return streamDetails_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder> + getStreamDetailsFieldBuilder() { + if (streamDetailsBuilder_ == null) { + streamDetailsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetailsOrBuilder>( + streamDetails_, + getParentForChildren(), + isClean()); + streamDetails_ = null; + } + return streamDetailsBuilder_; + } + + // repeated bytes shard_splits = 6; + private java.util.List shardSplits_ = java.util.Collections.emptyList();; + private void ensureShardSplitsIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + shardSplits_ = new java.util.ArrayList(shardSplits_); + bitField0_ |= 0x00000010; + } + } + public java.util.List + getShardSplitsList() { + return java.util.Collections.unmodifiableList(shardSplits_); + } + public int getShardSplitsCount() { + return shardSplits_.size(); + } + public com.google.protobuf.ByteString getShardSplits(int index) { + return shardSplits_.get(index); + } + public Builder setShardSplits( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureShardSplitsIsMutable(); + shardSplits_.set(index, value); + onChanged(); + return this; + } + public Builder addShardSplits(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureShardSplitsIsMutable(); + shardSplits_.add(value); + onChanged(); + return this; + } + public Builder addAllShardSplits( + java.lang.Iterable values) { + ensureShardSplitsIsMutable(); + super.addAll(values, shardSplits_); + onChanged(); + return this; + } + public Builder clearShardSplits() { + shardSplits_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexMeta index_metas = 8; + private java.util.List indexMetas_ = + java.util.Collections.emptyList(); + private void ensureIndexMetasIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + indexMetas_ = new java.util.ArrayList(indexMetas_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder> indexMetasBuilder_; + + public java.util.List getIndexMetasList() { + if (indexMetasBuilder_ == null) { + return java.util.Collections.unmodifiableList(indexMetas_); + } else { + return indexMetasBuilder_.getMessageList(); + } + } + public int getIndexMetasCount() { + if (indexMetasBuilder_ == null) { + return indexMetas_.size(); + } else { + return indexMetasBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta getIndexMetas(int index) { + if (indexMetasBuilder_ == null) { + return indexMetas_.get(index); + } else { + return indexMetasBuilder_.getMessage(index); + } + } + public Builder setIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndexMetasIsMutable(); + indexMetas_.set(index, value); + onChanged(); + } else { + indexMetasBuilder_.setMessage(index, value); + } + return this; + } + public Builder setIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder builderForValue) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.set(index, builderForValue.build()); + onChanged(); + } else { + indexMetasBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addIndexMetas(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndexMetasIsMutable(); + indexMetas_.add(value); + onChanged(); + } else { + indexMetasBuilder_.addMessage(value); + } + return this; + } + public Builder addIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta value) { + if (indexMetasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndexMetasIsMutable(); + indexMetas_.add(index, value); + onChanged(); + } else { + indexMetasBuilder_.addMessage(index, value); + } + return this; + } + public Builder addIndexMetas( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder builderForValue) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.add(builderForValue.build()); + onChanged(); + } else { + indexMetasBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addIndexMetas( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder builderForValue) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.add(index, builderForValue.build()); + onChanged(); + } else { + indexMetasBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllIndexMetas( + java.lang.Iterable values) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + super.addAll(values, indexMetas_); + onChanged(); + } else { + indexMetasBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearIndexMetas() { + if (indexMetasBuilder_ == null) { + indexMetas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + indexMetasBuilder_.clear(); + } + return this; + } + public Builder removeIndexMetas(int index) { + if (indexMetasBuilder_ == null) { + ensureIndexMetasIsMutable(); + indexMetas_.remove(index); + onChanged(); + } else { + indexMetasBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder getIndexMetasBuilder( + int index) { + return getIndexMetasFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder getIndexMetasOrBuilder( + int index) { + if (indexMetasBuilder_ == null) { + return indexMetas_.get(index); } else { + return indexMetasBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getIndexMetasOrBuilderList() { + if (indexMetasBuilder_ != null) { + return indexMetasBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(indexMetas_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder addIndexMetasBuilder() { + return getIndexMetasFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder addIndexMetasBuilder( + int index) { + return getIndexMetasFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.getDefaultInstance()); + } + public java.util.List + getIndexMetasBuilderList() { + return getIndexMetasFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder> + getIndexMetasFieldBuilder() { + if (indexMetasBuilder_ == null) { + indexMetasBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMetaOrBuilder>( + indexMetas_, + ((bitField0_ & 0x00000020) == 0x00000020), + getParentForChildren(), + isClean()); + indexMetas_ = null; + } + return indexMetasBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTableResponse) + } + + static { + defaultInstance = new DescribeTableResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTableResponse) + } + + public interface ListTableRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class ListTableRequest extends + com.google.protobuf.GeneratedMessage + implements ListTableRequestOrBuilder { + // Use ListTableRequest.newBuilder() to construct. + private ListTableRequest(Builder builder) { + super(builder); + } + private ListTableRequest(boolean noInit) {} + + private static final ListTableRequest defaultInstance; + public static ListTableRequest getDefaultInstance() { + return defaultInstance; + } + + public ListTableRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListTableRequest) + } + + static { + defaultInstance = new ListTableRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListTableRequest) + } + + public interface ListTableResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated string table_names = 1; + java.util.List getTableNamesList(); + int getTableNamesCount(); + String getTableNames(int index); + } + public static final class ListTableResponse extends + com.google.protobuf.GeneratedMessage + implements ListTableResponseOrBuilder { + // Use ListTableResponse.newBuilder() to construct. + private ListTableResponse(Builder builder) { + super(builder); + } + private ListTableResponse(boolean noInit) {} + + private static final ListTableResponse defaultInstance; + public static ListTableResponse getDefaultInstance() { + return defaultInstance; + } + + public ListTableResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_fieldAccessorTable; + } + + // repeated string table_names = 1; + public static final int TABLE_NAMES_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList tableNames_; + public java.util.List + getTableNamesList() { + return tableNames_; + } + public int getTableNamesCount() { + return tableNames_.size(); + } + public String getTableNames(int index) { + return tableNames_.get(index); + } + + private void initFields() { + tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < tableNames_.size(); i++) { + output.writeBytes(1, tableNames_.getByteString(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < tableNames_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(tableNames_.getByteString(i)); + } + size += dataSize; + size += 1 * getTableNamesList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + tableNames_ = new com.google.protobuf.UnmodifiableLazyStringList( + tableNames_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tableNames_ = tableNames_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse.getDefaultInstance()) return this; + if (!other.tableNames_.isEmpty()) { + if (tableNames_.isEmpty()) { + tableNames_ = other.tableNames_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTableNamesIsMutable(); + tableNames_.addAll(other.tableNames_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + ensureTableNamesIsMutable(); + tableNames_.add(input.readBytes()); + break; + } + } + } + } + + private int bitField0_; + + // repeated string table_names = 1; + private com.google.protobuf.LazyStringList tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureTableNamesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + tableNames_ = new com.google.protobuf.LazyStringArrayList(tableNames_); + bitField0_ |= 0x00000001; + } + } + public java.util.List + getTableNamesList() { + return java.util.Collections.unmodifiableList(tableNames_); + } + public int getTableNamesCount() { + return tableNames_.size(); + } + public String getTableNames(int index) { + return tableNames_.get(index); + } + public Builder setTableNames( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTableNamesIsMutable(); + tableNames_.set(index, value); + onChanged(); + return this; + } + public Builder addTableNames(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTableNamesIsMutable(); + tableNames_.add(value); + onChanged(); + return this; + } + public Builder addAllTableNames( + java.lang.Iterable values) { + ensureTableNamesIsMutable(); + super.addAll(values, tableNames_); + onChanged(); + return this; + } + public Builder clearTableNames() { + tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + void addTableNames(com.google.protobuf.ByteString value) { + ensureTableNamesIsMutable(); + tableNames_.add(value); + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListTableResponse) + } + + static { + defaultInstance = new ListTableResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListTableResponse) + } + + public interface DeleteTableRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + } + public static final class DeleteTableRequest extends + com.google.protobuf.GeneratedMessage + implements DeleteTableRequestOrBuilder { + // Use DeleteTableRequest.newBuilder() to construct. + private DeleteTableRequest(Builder builder) { + super(builder); + } + private DeleteTableRequest(boolean noInit) {} + + private static final DeleteTableRequest defaultInstance; + public static DeleteTableRequest getDefaultInstance() { + return defaultInstance; + } + + public DeleteTableRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTableRequest) + } + + static { + defaultInstance = new DeleteTableRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTableRequest) + } + + public interface DeleteTableResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class DeleteTableResponse extends + com.google.protobuf.GeneratedMessage + implements DeleteTableResponseOrBuilder { + // Use DeleteTableResponse.newBuilder() to construct. + private DeleteTableResponse(Builder builder) { + super(builder); + } + private DeleteTableResponse(boolean noInit) {} + + private static final DeleteTableResponse defaultInstance; + public static DeleteTableResponse getDefaultInstance() { + return defaultInstance; + } + + public DeleteTableResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTableResponse) + } + + static { + defaultInstance = new DeleteTableResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTableResponse) + } + + public interface LoadTableRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + } + public static final class LoadTableRequest extends + com.google.protobuf.GeneratedMessage + implements LoadTableRequestOrBuilder { + // Use LoadTableRequest.newBuilder() to construct. + private LoadTableRequest(Builder builder) { + super(builder); + } + private LoadTableRequest(boolean noInit) {} + + private static final LoadTableRequest defaultInstance; + public static LoadTableRequest getDefaultInstance() { + return defaultInstance; + } + + public LoadTableRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.LoadTableRequest) + } + + static { + defaultInstance = new LoadTableRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.LoadTableRequest) + } + + public interface LoadTableResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class LoadTableResponse extends + com.google.protobuf.GeneratedMessage + implements LoadTableResponseOrBuilder { + // Use LoadTableResponse.newBuilder() to construct. + private LoadTableResponse(Builder builder) { + super(builder); + } + private LoadTableResponse(boolean noInit) {} + + private static final LoadTableResponse defaultInstance; + public static LoadTableResponse getDefaultInstance() { + return defaultInstance; + } + + public LoadTableResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.LoadTableResponse) + } + + static { + defaultInstance = new LoadTableResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.LoadTableResponse) + } + + public interface UnloadTableRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + } + public static final class UnloadTableRequest extends + com.google.protobuf.GeneratedMessage + implements UnloadTableRequestOrBuilder { + // Use UnloadTableRequest.newBuilder() to construct. + private UnloadTableRequest(Builder builder) { + super(builder); + } + private UnloadTableRequest(boolean noInit) {} + + private static final UnloadTableRequest defaultInstance; + public static UnloadTableRequest getDefaultInstance() { + return defaultInstance; + } + + public UnloadTableRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UnloadTableRequest) + } + + static { + defaultInstance = new UnloadTableRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UnloadTableRequest) + } + + public interface UnloadTableResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class UnloadTableResponse extends + com.google.protobuf.GeneratedMessage + implements UnloadTableResponseOrBuilder { + // Use UnloadTableResponse.newBuilder() to construct. + private UnloadTableResponse(Builder builder) { + super(builder); + } + private UnloadTableResponse(boolean noInit) {} + + private static final UnloadTableResponse defaultInstance; + public static UnloadTableResponse getDefaultInstance() { + return defaultInstance; + } + + public UnloadTableResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UnloadTableResponse) + } + + static { + defaultInstance = new UnloadTableResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UnloadTableResponse) + } + + public interface TimeRangeOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int64 start_time = 1; + boolean hasStartTime(); + long getStartTime(); + + // optional int64 end_time = 2; + boolean hasEndTime(); + long getEndTime(); + + // optional int64 specific_time = 3; + boolean hasSpecificTime(); + long getSpecificTime(); + } + public static final class TimeRange extends + com.google.protobuf.GeneratedMessage + implements TimeRangeOrBuilder { + // Use TimeRange.newBuilder() to construct. + private TimeRange(Builder builder) { + super(builder); + } + private TimeRange(boolean noInit) {} + + private static final TimeRange defaultInstance; + public static TimeRange getDefaultInstance() { + return defaultInstance; + } + + public TimeRange getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_fieldAccessorTable; + } + + private int bitField0_; + // optional int64 start_time = 1; + public static final int START_TIME_FIELD_NUMBER = 1; + private long startTime_; + public boolean hasStartTime() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getStartTime() { + return startTime_; + } + + // optional int64 end_time = 2; + public static final int END_TIME_FIELD_NUMBER = 2; + private long endTime_; + public boolean hasEndTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getEndTime() { + return endTime_; + } + + // optional int64 specific_time = 3; + public static final int SPECIFIC_TIME_FIELD_NUMBER = 3; + private long specificTime_; + public boolean hasSpecificTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getSpecificTime() { + return specificTime_; + } + + private void initFields() { + startTime_ = 0L; + endTime_ = 0L; + specificTime_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, startTime_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, endTime_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, specificTime_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, startTime_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, endTime_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, specificTime_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + startTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + endTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + specificTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.startTime_ = startTime_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.endTime_ = endTime_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.specificTime_ = specificTime_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance()) return this; + if (other.hasStartTime()) { + setStartTime(other.getStartTime()); + } + if (other.hasEndTime()) { + setEndTime(other.getEndTime()); + } + if (other.hasSpecificTime()) { + setSpecificTime(other.getSpecificTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + startTime_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + endTime_ = input.readInt64(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + specificTime_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional int64 start_time = 1; + private long startTime_ ; + public boolean hasStartTime() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getStartTime() { + return startTime_; + } + public Builder setStartTime(long value) { + bitField0_ |= 0x00000001; + startTime_ = value; + onChanged(); + return this; + } + public Builder clearStartTime() { + bitField0_ = (bitField0_ & ~0x00000001); + startTime_ = 0L; + onChanged(); + return this; + } + + // optional int64 end_time = 2; + private long endTime_ ; + public boolean hasEndTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getEndTime() { + return endTime_; + } + public Builder setEndTime(long value) { + bitField0_ |= 0x00000002; + endTime_ = value; + onChanged(); + return this; + } + public Builder clearEndTime() { + bitField0_ = (bitField0_ & ~0x00000002); + endTime_ = 0L; + onChanged(); + return this; + } + + // optional int64 specific_time = 3; + private long specificTime_ ; + public boolean hasSpecificTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getSpecificTime() { + return specificTime_; + } + public Builder setSpecificTime(long value) { + bitField0_ |= 0x00000004; + specificTime_ = value; + onChanged(); + return this; + } + public Builder clearSpecificTime() { + bitField0_ = (bitField0_ & ~0x00000004); + specificTime_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TimeRange) + } + + static { + defaultInstance = new TimeRange(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TimeRange) + } + + public interface ReturnContentOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnType return_type = 1; + boolean hasReturnType(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType getReturnType(); + + // repeated string return_column_names = 2; + java.util.List getReturnColumnNamesList(); + int getReturnColumnNamesCount(); + String getReturnColumnNames(int index); + } + public static final class ReturnContent extends + com.google.protobuf.GeneratedMessage + implements ReturnContentOrBuilder { + // Use ReturnContent.newBuilder() to construct. + private ReturnContent(Builder builder) { + super(builder); + } + private ReturnContent(boolean noInit) {} + + private static final ReturnContent defaultInstance; + public static ReturnContent getDefaultInstance() { + return defaultInstance; + } + + public ReturnContent getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnType return_type = 1; + public static final int RETURN_TYPE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType returnType_; + public boolean hasReturnType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType getReturnType() { + return returnType_; + } + + // repeated string return_column_names = 2; + public static final int RETURN_COLUMN_NAMES_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList returnColumnNames_; + public java.util.List + getReturnColumnNamesList() { + return returnColumnNames_; + } + public int getReturnColumnNamesCount() { + return returnColumnNames_.size(); + } + public String getReturnColumnNames(int index) { + return returnColumnNames_.get(index); + } + + private void initFields() { + returnType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType.RT_NONE; + returnColumnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, returnType_.getNumber()); + } + for (int i = 0; i < returnColumnNames_.size(); i++) { + output.writeBytes(2, returnColumnNames_.getByteString(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, returnType_.getNumber()); + } + { + int dataSize = 0; + for (int i = 0; i < returnColumnNames_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(returnColumnNames_.getByteString(i)); + } + size += dataSize; + size += 1 * getReturnColumnNamesList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + returnType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType.RT_NONE; + bitField0_ = (bitField0_ & ~0x00000001); + returnColumnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.returnType_ = returnType_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + returnColumnNames_ = new com.google.protobuf.UnmodifiableLazyStringList( + returnColumnNames_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.returnColumnNames_ = returnColumnNames_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance()) return this; + if (other.hasReturnType()) { + setReturnType(other.getReturnType()); + } + if (!other.returnColumnNames_.isEmpty()) { + if (returnColumnNames_.isEmpty()) { + returnColumnNames_ = other.returnColumnNames_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureReturnColumnNamesIsMutable(); + returnColumnNames_.addAll(other.returnColumnNames_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + returnType_ = value; + } + break; + } + case 18: { + ensureReturnColumnNamesIsMutable(); + returnColumnNames_.add(input.readBytes()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnType return_type = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType returnType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType.RT_NONE; + public boolean hasReturnType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType getReturnType() { + return returnType_; + } + public Builder setReturnType(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + returnType_ = value; + onChanged(); + return this; + } + public Builder clearReturnType() { + bitField0_ = (bitField0_ & ~0x00000001); + returnType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnType.RT_NONE; + onChanged(); + return this; + } + + // repeated string return_column_names = 2; + private com.google.protobuf.LazyStringList returnColumnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureReturnColumnNamesIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + returnColumnNames_ = new com.google.protobuf.LazyStringArrayList(returnColumnNames_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getReturnColumnNamesList() { + return java.util.Collections.unmodifiableList(returnColumnNames_); + } + public int getReturnColumnNamesCount() { + return returnColumnNames_.size(); + } + public String getReturnColumnNames(int index) { + return returnColumnNames_.get(index); + } + public Builder setReturnColumnNames( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReturnColumnNamesIsMutable(); + returnColumnNames_.set(index, value); + onChanged(); + return this; + } + public Builder addReturnColumnNames(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureReturnColumnNamesIsMutable(); + returnColumnNames_.add(value); + onChanged(); + return this; + } + public Builder addAllReturnColumnNames( + java.lang.Iterable values) { + ensureReturnColumnNamesIsMutable(); + super.addAll(values, returnColumnNames_); + onChanged(); + return this; + } + public Builder clearReturnColumnNames() { + returnColumnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + void addReturnColumnNames(com.google.protobuf.ByteString value) { + ensureReturnColumnNamesIsMutable(); + returnColumnNames_.add(value); + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ReturnContent) + } + + static { + defaultInstance = new ReturnContent(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ReturnContent) + } + + public interface GetRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required bytes primary_key = 2; + boolean hasPrimaryKey(); + com.google.protobuf.ByteString getPrimaryKey(); + + // repeated string columns_to_get = 3; + java.util.List getColumnsToGetList(); + int getColumnsToGetCount(); + String getColumnsToGet(int index); + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 4; + boolean hasTimeRange(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder(); + + // optional int32 max_versions = 5; + boolean hasMaxVersions(); + int getMaxVersions(); + + // optional bytes filter = 7; + boolean hasFilter(); + com.google.protobuf.ByteString getFilter(); + + // optional string start_column = 8; + boolean hasStartColumn(); + String getStartColumn(); + + // optional string end_column = 9; + boolean hasEndColumn(); + String getEndColumn(); + + // optional bytes token = 10; + boolean hasToken(); + com.google.protobuf.ByteString getToken(); + + // optional string transaction_id = 11; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class GetRowRequest extends + com.google.protobuf.GeneratedMessage + implements GetRowRequestOrBuilder { + // Use GetRowRequest.newBuilder() to construct. + private GetRowRequest(Builder builder) { + super(builder); + } + private GetRowRequest(boolean noInit) {} + + private static final GetRowRequest defaultInstance; + public static GetRowRequest getDefaultInstance() { + return defaultInstance; + } + + public GetRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required bytes primary_key = 2; + public static final int PRIMARY_KEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString primaryKey_; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + + // repeated string columns_to_get = 3; + public static final int COLUMNS_TO_GET_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList columnsToGet_; + public java.util.List + getColumnsToGetList() { + return columnsToGet_; + } + public int getColumnsToGetCount() { + return columnsToGet_.size(); + } + public String getColumnsToGet(int index) { + return columnsToGet_.get(index); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 4; + public static final int TIME_RANGE_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange timeRange_; + public boolean hasTimeRange() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange() { + return timeRange_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder() { + return timeRange_; + } + + // optional int32 max_versions = 5; + public static final int MAX_VERSIONS_FIELD_NUMBER = 5; + private int maxVersions_; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public int getMaxVersions() { + return maxVersions_; + } + + // optional bytes filter = 7; + public static final int FILTER_FIELD_NUMBER = 7; + private com.google.protobuf.ByteString filter_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + + // optional string start_column = 8; + public static final int START_COLUMN_FIELD_NUMBER = 8; + private java.lang.Object startColumn_; + public boolean hasStartColumn() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public String getStartColumn() { + java.lang.Object ref = startColumn_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + startColumn_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStartColumnBytes() { + java.lang.Object ref = startColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + startColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string end_column = 9; + public static final int END_COLUMN_FIELD_NUMBER = 9; + private java.lang.Object endColumn_; + public boolean hasEndColumn() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public String getEndColumn() { + java.lang.Object ref = endColumn_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + endColumn_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getEndColumnBytes() { + java.lang.Object ref = endColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + endColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bytes token = 10; + public static final int TOKEN_FIELD_NUMBER = 10; + private com.google.protobuf.ByteString token_; + public boolean hasToken() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public com.google.protobuf.ByteString getToken() { + return token_; + } + + // optional string transaction_id = 11; + public static final int TRANSACTION_ID_FIELD_NUMBER = 11; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + maxVersions_ = 0; + filter_ = com.google.protobuf.ByteString.EMPTY; + startColumn_ = ""; + endColumn_ = ""; + token_ = com.google.protobuf.ByteString.EMPTY; + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasPrimaryKey()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, primaryKey_); + } + for (int i = 0; i < columnsToGet_.size(); i++) { + output.writeBytes(3, columnsToGet_.getByteString(i)); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(4, timeRange_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(5, maxVersions_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(7, filter_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(8, getStartColumnBytes()); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBytes(9, getEndColumnBytes()); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeBytes(10, token_); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + output.writeBytes(11, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, primaryKey_); + } + { + int dataSize = 0; + for (int i = 0; i < columnsToGet_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(columnsToGet_.getByteString(i)); + } + size += dataSize; + size += 1 * getColumnsToGetList().size(); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, timeRange_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, maxVersions_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(7, filter_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(8, getStartColumnBytes()); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(9, getEndColumnBytes()); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(10, token_); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(11, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTimeRangeFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + if (timeRangeBuilder_ == null) { + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + } else { + timeRangeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + maxVersions_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + filter_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000020); + startColumn_ = ""; + bitField0_ = (bitField0_ & ~0x00000040); + endColumn_ = ""; + bitField0_ = (bitField0_ & ~0x00000080); + token_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000100); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000200); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.primaryKey_ = primaryKey_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + columnsToGet_ = new com.google.protobuf.UnmodifiableLazyStringList( + columnsToGet_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.columnsToGet_ = columnsToGet_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000004; + } + if (timeRangeBuilder_ == null) { + result.timeRange_ = timeRange_; + } else { + result.timeRange_ = timeRangeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000008; + } + result.maxVersions_ = maxVersions_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000010; + } + result.filter_ = filter_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000020; + } + result.startColumn_ = startColumn_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000040; + } + result.endColumn_ = endColumn_; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000080; + } + result.token_ = token_; + if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + to_bitField0_ |= 0x00000100; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasPrimaryKey()) { + setPrimaryKey(other.getPrimaryKey()); + } + if (!other.columnsToGet_.isEmpty()) { + if (columnsToGet_.isEmpty()) { + columnsToGet_ = other.columnsToGet_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureColumnsToGetIsMutable(); + columnsToGet_.addAll(other.columnsToGet_); + } + onChanged(); + } + if (other.hasTimeRange()) { + mergeTimeRange(other.getTimeRange()); + } + if (other.hasMaxVersions()) { + setMaxVersions(other.getMaxVersions()); + } + if (other.hasFilter()) { + setFilter(other.getFilter()); + } + if (other.hasStartColumn()) { + setStartColumn(other.getStartColumn()); + } + if (other.hasEndColumn()) { + setEndColumn(other.getEndColumn()); + } + if (other.hasToken()) { + setToken(other.getToken()); + } + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasPrimaryKey()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + primaryKey_ = input.readBytes(); + break; + } + case 26: { + ensureColumnsToGetIsMutable(); + columnsToGet_.add(input.readBytes()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.newBuilder(); + if (hasTimeRange()) { + subBuilder.mergeFrom(getTimeRange()); + } + input.readMessage(subBuilder, extensionRegistry); + setTimeRange(subBuilder.buildPartial()); + break; + } + case 40: { + bitField0_ |= 0x00000010; + maxVersions_ = input.readInt32(); + break; + } + case 58: { + bitField0_ |= 0x00000020; + filter_ = input.readBytes(); + break; + } + case 66: { + bitField0_ |= 0x00000040; + startColumn_ = input.readBytes(); + break; + } + case 74: { + bitField0_ |= 0x00000080; + endColumn_ = input.readBytes(); + break; + } + case 82: { + bitField0_ |= 0x00000100; + token_ = input.readBytes(); + break; + } + case 90: { + bitField0_ |= 0x00000200; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required bytes primary_key = 2; + private com.google.protobuf.ByteString primaryKey_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + public Builder setPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + primaryKey_ = value; + onChanged(); + return this; + } + public Builder clearPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000002); + primaryKey_ = getDefaultInstance().getPrimaryKey(); + onChanged(); + return this; + } + + // repeated string columns_to_get = 3; + private com.google.protobuf.LazyStringList columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureColumnsToGetIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + columnsToGet_ = new com.google.protobuf.LazyStringArrayList(columnsToGet_); + bitField0_ |= 0x00000004; + } + } + public java.util.List + getColumnsToGetList() { + return java.util.Collections.unmodifiableList(columnsToGet_); + } + public int getColumnsToGetCount() { + return columnsToGet_.size(); + } + public String getColumnsToGet(int index) { + return columnsToGet_.get(index); + } + public Builder setColumnsToGet( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsToGetIsMutable(); + columnsToGet_.set(index, value); + onChanged(); + return this; + } + public Builder addColumnsToGet(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsToGetIsMutable(); + columnsToGet_.add(value); + onChanged(); + return this; + } + public Builder addAllColumnsToGet( + java.lang.Iterable values) { + ensureColumnsToGetIsMutable(); + super.addAll(values, columnsToGet_); + onChanged(); + return this; + } + public Builder clearColumnsToGet() { + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + void addColumnsToGet(com.google.protobuf.ByteString value) { + ensureColumnsToGetIsMutable(); + columnsToGet_.add(value); + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder> timeRangeBuilder_; + public boolean hasTimeRange() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange() { + if (timeRangeBuilder_ == null) { + return timeRange_; + } else { + return timeRangeBuilder_.getMessage(); + } + } + public Builder setTimeRange(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange value) { + if (timeRangeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timeRange_ = value; + onChanged(); + } else { + timeRangeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setTimeRange( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder builderForValue) { + if (timeRangeBuilder_ == null) { + timeRange_ = builderForValue.build(); + onChanged(); + } else { + timeRangeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeTimeRange(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange value) { + if (timeRangeBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + timeRange_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance()) { + timeRange_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.newBuilder(timeRange_).mergeFrom(value).buildPartial(); + } else { + timeRange_ = value; + } + onChanged(); + } else { + timeRangeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearTimeRange() { + if (timeRangeBuilder_ == null) { + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + onChanged(); + } else { + timeRangeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder getTimeRangeBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getTimeRangeFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder() { + if (timeRangeBuilder_ != null) { + return timeRangeBuilder_.getMessageOrBuilder(); + } else { + return timeRange_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder> + getTimeRangeFieldBuilder() { + if (timeRangeBuilder_ == null) { + timeRangeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder>( + timeRange_, + getParentForChildren(), + isClean()); + timeRange_ = null; + } + return timeRangeBuilder_; + } + + // optional int32 max_versions = 5; + private int maxVersions_ ; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public int getMaxVersions() { + return maxVersions_; + } + public Builder setMaxVersions(int value) { + bitField0_ |= 0x00000010; + maxVersions_ = value; + onChanged(); + return this; + } + public Builder clearMaxVersions() { + bitField0_ = (bitField0_ & ~0x00000010); + maxVersions_ = 0; + onChanged(); + return this; + } + + // optional bytes filter = 7; + private com.google.protobuf.ByteString filter_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasFilter() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + public Builder setFilter(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + filter_ = value; + onChanged(); + return this; + } + public Builder clearFilter() { + bitField0_ = (bitField0_ & ~0x00000020); + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + + // optional string start_column = 8; + private java.lang.Object startColumn_ = ""; + public boolean hasStartColumn() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public String getStartColumn() { + java.lang.Object ref = startColumn_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + startColumn_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStartColumn(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + startColumn_ = value; + onChanged(); + return this; + } + public Builder clearStartColumn() { + bitField0_ = (bitField0_ & ~0x00000040); + startColumn_ = getDefaultInstance().getStartColumn(); + onChanged(); + return this; + } + void setStartColumn(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000040; + startColumn_ = value; + onChanged(); + } + + // optional string end_column = 9; + private java.lang.Object endColumn_ = ""; + public boolean hasEndColumn() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public String getEndColumn() { + java.lang.Object ref = endColumn_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + endColumn_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setEndColumn(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000080; + endColumn_ = value; + onChanged(); + return this; + } + public Builder clearEndColumn() { + bitField0_ = (bitField0_ & ~0x00000080); + endColumn_ = getDefaultInstance().getEndColumn(); + onChanged(); + return this; + } + void setEndColumn(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000080; + endColumn_ = value; + onChanged(); + } + + // optional bytes token = 10; + private com.google.protobuf.ByteString token_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasToken() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public com.google.protobuf.ByteString getToken() { + return token_; + } + public Builder setToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000100; + token_ = value; + onChanged(); + return this; + } + public Builder clearToken() { + bitField0_ = (bitField0_ & ~0x00000100); + token_ = getDefaultInstance().getToken(); + onChanged(); + return this; + } + + // optional string transaction_id = 11; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000200) == 0x00000200); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000200; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000200); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000200; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetRowRequest) + } + + static { + defaultInstance = new GetRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetRowRequest) + } + + public interface GetRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // required bytes row = 2; + boolean hasRow(); + com.google.protobuf.ByteString getRow(); + + // optional bytes next_token = 3; + boolean hasNextToken(); + com.google.protobuf.ByteString getNextToken(); + } + public static final class GetRowResponse extends + com.google.protobuf.GeneratedMessage + implements GetRowResponseOrBuilder { + // Use GetRowResponse.newBuilder() to construct. + private GetRowResponse(Builder builder) { + super(builder); + } + private GetRowResponse(boolean noInit) {} + + private static final GetRowResponse defaultInstance; + public static GetRowResponse getDefaultInstance() { + return defaultInstance; + } + + public GetRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + public static final int CONSUMED_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // required bytes row = 2; + public static final int ROW_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString row_; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + + // optional bytes next_token = 3; + public static final int NEXT_TOKEN_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString nextToken_; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + + private void initFields() { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + row_ = com.google.protobuf.ByteString.EMPTY; + nextToken_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasConsumed()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRow()) { + memoizedIsInitialized = 0; + return false; + } + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, row_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, nextToken_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, row_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, nextToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConsumedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + row_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + nextToken_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.row_ = row_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.nextToken_ = nextToken_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse.getDefaultInstance()) return this; + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (other.hasRow()) { + setRow(other.getRow()); + } + if (other.hasNextToken()) { + setNextToken(other.getNextToken()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasConsumed()) { + + return false; + } + if (!hasRow()) { + + return false; + } + if (!getConsumed().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + row_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + nextToken_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // required bytes row = 2; + private com.google.protobuf.ByteString row_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + public Builder setRow(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + row_ = value; + onChanged(); + return this; + } + public Builder clearRow() { + bitField0_ = (bitField0_ & ~0x00000002); + row_ = getDefaultInstance().getRow(); + onChanged(); + return this; + } + + // optional bytes next_token = 3; + private com.google.protobuf.ByteString nextToken_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + public Builder setNextToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + nextToken_ = value; + onChanged(); + return this; + } + public Builder clearNextToken() { + bitField0_ = (bitField0_ & ~0x00000004); + nextToken_ = getDefaultInstance().getNextToken(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetRowResponse) + } + + static { + defaultInstance = new GetRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetRowResponse) + } + + public interface UpdateRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required bytes row_change = 2; + boolean hasRowChange(); + com.google.protobuf.ByteString getRowChange(); + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + boolean hasCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + boolean hasReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder(); + + // optional string transaction_id = 5; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class UpdateRowRequest extends + com.google.protobuf.GeneratedMessage + implements UpdateRowRequestOrBuilder { + // Use UpdateRowRequest.newBuilder() to construct. + private UpdateRowRequest(Builder builder) { + super(builder); + } + private UpdateRowRequest(boolean noInit) {} + + private static final UpdateRowRequest defaultInstance; + public static UpdateRowRequest getDefaultInstance() { + return defaultInstance; + } + + public UpdateRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required bytes row_change = 2; + public static final int ROW_CHANGE_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString rowChange_; + public boolean hasRowChange() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRowChange() { + return rowChange_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + public static final int CONDITION_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + return condition_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + return condition_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + public static final int RETURN_CONTENT_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + return returnContent_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + return returnContent_; + } + + // optional string transaction_id = 5; + public static final int TRANSACTION_ID_FIELD_NUMBER = 5; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + rowChange_ = com.google.protobuf.ByteString.EMPTY; + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRowChange()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCondition()) { + memoizedIsInitialized = 0; + return false; + } + if (!getCondition().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, rowChange_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, returnContent_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, rowChange_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, returnContent_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConditionFieldBuilder(); + getReturnContentFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + rowChange_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.rowChange_ = rowChange_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (conditionBuilder_ == null) { + result.condition_ = condition_; + } else { + result.condition_ = conditionBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (returnContentBuilder_ == null) { + result.returnContent_ = returnContent_; + } else { + result.returnContent_ = returnContentBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasRowChange()) { + setRowChange(other.getRowChange()); + } + if (other.hasCondition()) { + mergeCondition(other.getCondition()); + } + if (other.hasReturnContent()) { + mergeReturnContent(other.getReturnContent()); + } + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasRowChange()) { + + return false; + } + if (!hasCondition()) { + + return false; + } + if (!getCondition().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + rowChange_ = input.readBytes(); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(); + if (hasCondition()) { + subBuilder.mergeFrom(getCondition()); + } + input.readMessage(subBuilder, extensionRegistry); + setCondition(subBuilder.buildPartial()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(); + if (hasReturnContent()) { + subBuilder.mergeFrom(getReturnContent()); + } + input.readMessage(subBuilder, extensionRegistry); + setReturnContent(subBuilder.buildPartial()); + break; + } + case 42: { + bitField0_ |= 0x00000010; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required bytes row_change = 2; + private com.google.protobuf.ByteString rowChange_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRowChange() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRowChange() { + return rowChange_; + } + public Builder setRowChange(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + rowChange_ = value; + onChanged(); + return this; + } + public Builder clearRowChange() { + bitField0_ = (bitField0_ & ~0x00000002); + rowChange_ = getDefaultInstance().getRowChange(); + onChanged(); + return this; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> conditionBuilder_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + if (conditionBuilder_ == null) { + return condition_; + } else { + return conditionBuilder_.getMessage(); + } + } + public Builder setCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + condition_ = value; + onChanged(); + } else { + conditionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setCondition( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder builderForValue) { + if (conditionBuilder_ == null) { + condition_ = builderForValue.build(); + onChanged(); + } else { + conditionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + condition_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance()) { + condition_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); + } else { + condition_ = value; + } + onChanged(); + } else { + conditionBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearCondition() { + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + onChanged(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder getConditionBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getConditionFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + if (conditionBuilder_ != null) { + return conditionBuilder_.getMessageOrBuilder(); + } else { + return condition_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> + getConditionFieldBuilder() { + if (conditionBuilder_ == null) { + conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder>( + condition_, + getParentForChildren(), + isClean()); + condition_ = null; + } + return conditionBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> returnContentBuilder_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + if (returnContentBuilder_ == null) { + return returnContent_; + } else { + return returnContentBuilder_.getMessage(); + } + } + public Builder setReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + returnContent_ = value; + onChanged(); + } else { + returnContentBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setReturnContent( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder builderForValue) { + if (returnContentBuilder_ == null) { + returnContent_ = builderForValue.build(); + onChanged(); + } else { + returnContentBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + returnContent_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance()) { + returnContent_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(returnContent_).mergeFrom(value).buildPartial(); + } else { + returnContent_ = value; + } + onChanged(); + } else { + returnContentBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearReturnContent() { + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + onChanged(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder getReturnContentBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getReturnContentFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + if (returnContentBuilder_ != null) { + return returnContentBuilder_.getMessageOrBuilder(); + } else { + return returnContent_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> + getReturnContentFieldBuilder() { + if (returnContentBuilder_ == null) { + returnContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder>( + returnContent_, + getParentForChildren(), + isClean()); + returnContent_ = null; + } + return returnContentBuilder_; + } + + // optional string transaction_id = 5; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000010); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000010; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateRowRequest) + } + + static { + defaultInstance = new UpdateRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateRowRequest) + } + + public interface UpdateRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // optional bytes row = 2; + boolean hasRow(); + com.google.protobuf.ByteString getRow(); + } + public static final class UpdateRowResponse extends + com.google.protobuf.GeneratedMessage + implements UpdateRowResponseOrBuilder { + // Use UpdateRowResponse.newBuilder() to construct. + private UpdateRowResponse(Builder builder) { + super(builder); + } + private UpdateRowResponse(boolean noInit) {} + + private static final UpdateRowResponse defaultInstance; + public static UpdateRowResponse getDefaultInstance() { + return defaultInstance; + } + + public UpdateRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + public static final int CONSUMED_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // optional bytes row = 2; + public static final int ROW_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString row_; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + + private void initFields() { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + row_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasConsumed()) { + memoizedIsInitialized = 0; + return false; + } + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, row_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, row_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConsumedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + row_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.row_ = row_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse.getDefaultInstance()) return this; + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (other.hasRow()) { + setRow(other.getRow()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasConsumed()) { + + return false; + } + if (!getConsumed().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + row_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // optional bytes row = 2; + private com.google.protobuf.ByteString row_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + public Builder setRow(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + row_ = value; + onChanged(); + return this; + } + public Builder clearRow() { + bitField0_ = (bitField0_ & ~0x00000002); + row_ = getDefaultInstance().getRow(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateRowResponse) + } + + static { + defaultInstance = new UpdateRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UpdateRowResponse) + } + + public interface PutRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required bytes row = 2; + boolean hasRow(); + com.google.protobuf.ByteString getRow(); + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + boolean hasCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + boolean hasReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder(); + + // optional string transaction_id = 5; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class PutRowRequest extends + com.google.protobuf.GeneratedMessage + implements PutRowRequestOrBuilder { + // Use PutRowRequest.newBuilder() to construct. + private PutRowRequest(Builder builder) { + super(builder); + } + private PutRowRequest(boolean noInit) {} + + private static final PutRowRequest defaultInstance; + public static PutRowRequest getDefaultInstance() { + return defaultInstance; + } + + public PutRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required bytes row = 2; + public static final int ROW_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString row_; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + public static final int CONDITION_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + return condition_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + return condition_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + public static final int RETURN_CONTENT_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + return returnContent_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + return returnContent_; + } + + // optional string transaction_id = 5; + public static final int TRANSACTION_ID_FIELD_NUMBER = 5; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + row_ = com.google.protobuf.ByteString.EMPTY; + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRow()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCondition()) { + memoizedIsInitialized = 0; + return false; + } + if (!getCondition().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, row_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, returnContent_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, row_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, returnContent_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConditionFieldBuilder(); + getReturnContentFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + row_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.row_ = row_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (conditionBuilder_ == null) { + result.condition_ = condition_; + } else { + result.condition_ = conditionBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (returnContentBuilder_ == null) { + result.returnContent_ = returnContent_; + } else { + result.returnContent_ = returnContentBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasRow()) { + setRow(other.getRow()); + } + if (other.hasCondition()) { + mergeCondition(other.getCondition()); + } + if (other.hasReturnContent()) { + mergeReturnContent(other.getReturnContent()); + } + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasRow()) { + + return false; + } + if (!hasCondition()) { + + return false; + } + if (!getCondition().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + row_ = input.readBytes(); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(); + if (hasCondition()) { + subBuilder.mergeFrom(getCondition()); + } + input.readMessage(subBuilder, extensionRegistry); + setCondition(subBuilder.buildPartial()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(); + if (hasReturnContent()) { + subBuilder.mergeFrom(getReturnContent()); + } + input.readMessage(subBuilder, extensionRegistry); + setReturnContent(subBuilder.buildPartial()); + break; + } + case 42: { + bitField0_ |= 0x00000010; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required bytes row = 2; + private com.google.protobuf.ByteString row_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + public Builder setRow(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + row_ = value; + onChanged(); + return this; + } + public Builder clearRow() { + bitField0_ = (bitField0_ & ~0x00000002); + row_ = getDefaultInstance().getRow(); + onChanged(); + return this; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> conditionBuilder_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + if (conditionBuilder_ == null) { + return condition_; + } else { + return conditionBuilder_.getMessage(); + } + } + public Builder setCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + condition_ = value; + onChanged(); + } else { + conditionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setCondition( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder builderForValue) { + if (conditionBuilder_ == null) { + condition_ = builderForValue.build(); + onChanged(); + } else { + conditionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + condition_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance()) { + condition_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); + } else { + condition_ = value; + } + onChanged(); + } else { + conditionBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearCondition() { + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + onChanged(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder getConditionBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getConditionFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + if (conditionBuilder_ != null) { + return conditionBuilder_.getMessageOrBuilder(); + } else { + return condition_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> + getConditionFieldBuilder() { + if (conditionBuilder_ == null) { + conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder>( + condition_, + getParentForChildren(), + isClean()); + condition_ = null; + } + return conditionBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> returnContentBuilder_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + if (returnContentBuilder_ == null) { + return returnContent_; + } else { + return returnContentBuilder_.getMessage(); + } + } + public Builder setReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + returnContent_ = value; + onChanged(); + } else { + returnContentBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setReturnContent( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder builderForValue) { + if (returnContentBuilder_ == null) { + returnContent_ = builderForValue.build(); + onChanged(); + } else { + returnContentBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + returnContent_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance()) { + returnContent_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(returnContent_).mergeFrom(value).buildPartial(); + } else { + returnContent_ = value; + } + onChanged(); + } else { + returnContentBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearReturnContent() { + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + onChanged(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder getReturnContentBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getReturnContentFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + if (returnContentBuilder_ != null) { + return returnContentBuilder_.getMessageOrBuilder(); + } else { + return returnContent_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> + getReturnContentFieldBuilder() { + if (returnContentBuilder_ == null) { + returnContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder>( + returnContent_, + getParentForChildren(), + isClean()); + returnContent_ = null; + } + return returnContentBuilder_; + } + + // optional string transaction_id = 5; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000010); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000010; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.PutRowRequest) + } + + static { + defaultInstance = new PutRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.PutRowRequest) + } + + public interface PutRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // optional bytes row = 2; + boolean hasRow(); + com.google.protobuf.ByteString getRow(); + } + public static final class PutRowResponse extends + com.google.protobuf.GeneratedMessage + implements PutRowResponseOrBuilder { + // Use PutRowResponse.newBuilder() to construct. + private PutRowResponse(Builder builder) { + super(builder); + } + private PutRowResponse(boolean noInit) {} + + private static final PutRowResponse defaultInstance; + public static PutRowResponse getDefaultInstance() { + return defaultInstance; + } + + public PutRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + public static final int CONSUMED_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // optional bytes row = 2; + public static final int ROW_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString row_; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + + private void initFields() { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + row_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasConsumed()) { + memoizedIsInitialized = 0; + return false; + } + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, row_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, row_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConsumedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + row_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.row_ = row_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse.getDefaultInstance()) return this; + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (other.hasRow()) { + setRow(other.getRow()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasConsumed()) { + + return false; + } + if (!getConsumed().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + row_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // optional bytes row = 2; + private com.google.protobuf.ByteString row_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + public Builder setRow(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + row_ = value; + onChanged(); + return this; + } + public Builder clearRow() { + bitField0_ = (bitField0_ & ~0x00000002); + row_ = getDefaultInstance().getRow(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.PutRowResponse) + } + + static { + defaultInstance = new PutRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.PutRowResponse) + } + + public interface DeleteRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required bytes primary_key = 2; + boolean hasPrimaryKey(); + com.google.protobuf.ByteString getPrimaryKey(); + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + boolean hasCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + boolean hasReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder(); + + // optional string transaction_id = 5; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class DeleteRowRequest extends + com.google.protobuf.GeneratedMessage + implements DeleteRowRequestOrBuilder { + // Use DeleteRowRequest.newBuilder() to construct. + private DeleteRowRequest(Builder builder) { + super(builder); + } + private DeleteRowRequest(boolean noInit) {} + + private static final DeleteRowRequest defaultInstance; + public static DeleteRowRequest getDefaultInstance() { + return defaultInstance; + } + + public DeleteRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required bytes primary_key = 2; + public static final int PRIMARY_KEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString primaryKey_; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + public static final int CONDITION_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + return condition_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + return condition_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + public static final int RETURN_CONTENT_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + return returnContent_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + return returnContent_; + } + + // optional string transaction_id = 5; + public static final int TRANSACTION_ID_FIELD_NUMBER = 5; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasPrimaryKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCondition()) { + memoizedIsInitialized = 0; + return false; + } + if (!getCondition().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, primaryKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, returnContent_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, primaryKey_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, returnContent_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConditionFieldBuilder(); + getReturnContentFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.primaryKey_ = primaryKey_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (conditionBuilder_ == null) { + result.condition_ = condition_; + } else { + result.condition_ = conditionBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (returnContentBuilder_ == null) { + result.returnContent_ = returnContent_; + } else { + result.returnContent_ = returnContentBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasPrimaryKey()) { + setPrimaryKey(other.getPrimaryKey()); + } + if (other.hasCondition()) { + mergeCondition(other.getCondition()); + } + if (other.hasReturnContent()) { + mergeReturnContent(other.getReturnContent()); + } + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasPrimaryKey()) { + + return false; + } + if (!hasCondition()) { + + return false; + } + if (!getCondition().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + primaryKey_ = input.readBytes(); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(); + if (hasCondition()) { + subBuilder.mergeFrom(getCondition()); + } + input.readMessage(subBuilder, extensionRegistry); + setCondition(subBuilder.buildPartial()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(); + if (hasReturnContent()) { + subBuilder.mergeFrom(getReturnContent()); + } + input.readMessage(subBuilder, extensionRegistry); + setReturnContent(subBuilder.buildPartial()); + break; + } + case 42: { + bitField0_ |= 0x00000010; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required bytes primary_key = 2; + private com.google.protobuf.ByteString primaryKey_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + public Builder setPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + primaryKey_ = value; + onChanged(); + return this; + } + public Builder clearPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000002); + primaryKey_ = getDefaultInstance().getPrimaryKey(); + onChanged(); + return this; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> conditionBuilder_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + if (conditionBuilder_ == null) { + return condition_; + } else { + return conditionBuilder_.getMessage(); + } + } + public Builder setCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + condition_ = value; + onChanged(); + } else { + conditionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setCondition( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder builderForValue) { + if (conditionBuilder_ == null) { + condition_ = builderForValue.build(); + onChanged(); + } else { + conditionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + condition_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance()) { + condition_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); + } else { + condition_ = value; + } + onChanged(); + } else { + conditionBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearCondition() { + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + onChanged(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder getConditionBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getConditionFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + if (conditionBuilder_ != null) { + return conditionBuilder_.getMessageOrBuilder(); + } else { + return condition_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> + getConditionFieldBuilder() { + if (conditionBuilder_ == null) { + conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder>( + condition_, + getParentForChildren(), + isClean()); + condition_ = null; + } + return conditionBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> returnContentBuilder_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + if (returnContentBuilder_ == null) { + return returnContent_; + } else { + return returnContentBuilder_.getMessage(); + } + } + public Builder setReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + returnContent_ = value; + onChanged(); + } else { + returnContentBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setReturnContent( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder builderForValue) { + if (returnContentBuilder_ == null) { + returnContent_ = builderForValue.build(); + onChanged(); + } else { + returnContentBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + returnContent_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance()) { + returnContent_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(returnContent_).mergeFrom(value).buildPartial(); + } else { + returnContent_ = value; + } + onChanged(); + } else { + returnContentBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearReturnContent() { + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + onChanged(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder getReturnContentBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getReturnContentFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + if (returnContentBuilder_ != null) { + return returnContentBuilder_.getMessageOrBuilder(); + } else { + return returnContent_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> + getReturnContentFieldBuilder() { + if (returnContentBuilder_ == null) { + returnContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder>( + returnContent_, + getParentForChildren(), + isClean()); + returnContent_ = null; + } + return returnContentBuilder_; + } + + // optional string transaction_id = 5; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000010); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000010; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteRowRequest) + } + + static { + defaultInstance = new DeleteRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteRowRequest) + } + + public interface DeleteRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // optional bytes row = 2; + boolean hasRow(); + com.google.protobuf.ByteString getRow(); + } + public static final class DeleteRowResponse extends + com.google.protobuf.GeneratedMessage + implements DeleteRowResponseOrBuilder { + // Use DeleteRowResponse.newBuilder() to construct. + private DeleteRowResponse(Builder builder) { + super(builder); + } + private DeleteRowResponse(boolean noInit) {} + + private static final DeleteRowResponse defaultInstance; + public static DeleteRowResponse getDefaultInstance() { + return defaultInstance; + } + + public DeleteRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + public static final int CONSUMED_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // optional bytes row = 2; + public static final int ROW_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString row_; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + + private void initFields() { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + row_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasConsumed()) { + memoizedIsInitialized = 0; + return false; + } + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, row_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, row_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConsumedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + row_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.row_ = row_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse.getDefaultInstance()) return this; + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (other.hasRow()) { + setRow(other.getRow()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasConsumed()) { + + return false; + } + if (!getConsumed().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + row_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // optional bytes row = 2; + private com.google.protobuf.ByteString row_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRow() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + public Builder setRow(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + row_ = value; + onChanged(); + return this; + } + public Builder clearRow() { + bitField0_ = (bitField0_ & ~0x00000002); + row_ = getDefaultInstance().getRow(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteRowResponse) + } + + static { + defaultInstance = new DeleteRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteRowResponse) + } + + public interface TableInBatchGetRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // repeated bytes primary_key = 2; + java.util.List getPrimaryKeyList(); + int getPrimaryKeyCount(); + com.google.protobuf.ByteString getPrimaryKey(int index); + + // repeated bytes token = 3; + java.util.List getTokenList(); + int getTokenCount(); + com.google.protobuf.ByteString getToken(int index); + + // repeated string columns_to_get = 4; + java.util.List getColumnsToGetList(); + int getColumnsToGetCount(); + String getColumnsToGet(int index); + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 5; + boolean hasTimeRange(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder(); + + // optional int32 max_versions = 6; + boolean hasMaxVersions(); + int getMaxVersions(); + + // optional bytes filter = 8; + boolean hasFilter(); + com.google.protobuf.ByteString getFilter(); + + // optional string start_column = 9; + boolean hasStartColumn(); + String getStartColumn(); + + // optional string end_column = 10; + boolean hasEndColumn(); + String getEndColumn(); + } + public static final class TableInBatchGetRowRequest extends + com.google.protobuf.GeneratedMessage + implements TableInBatchGetRowRequestOrBuilder { + // Use TableInBatchGetRowRequest.newBuilder() to construct. + private TableInBatchGetRowRequest(Builder builder) { + super(builder); + } + private TableInBatchGetRowRequest(boolean noInit) {} + + private static final TableInBatchGetRowRequest defaultInstance; + public static TableInBatchGetRowRequest getDefaultInstance() { + return defaultInstance; + } + + public TableInBatchGetRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated bytes primary_key = 2; + public static final int PRIMARY_KEY_FIELD_NUMBER = 2; + private java.util.List primaryKey_; + public java.util.List + getPrimaryKeyList() { + return primaryKey_; + } + public int getPrimaryKeyCount() { + return primaryKey_.size(); + } + public com.google.protobuf.ByteString getPrimaryKey(int index) { + return primaryKey_.get(index); + } + + // repeated bytes token = 3; + public static final int TOKEN_FIELD_NUMBER = 3; + private java.util.List token_; + public java.util.List + getTokenList() { + return token_; + } + public int getTokenCount() { + return token_.size(); + } + public com.google.protobuf.ByteString getToken(int index) { + return token_.get(index); + } + + // repeated string columns_to_get = 4; + public static final int COLUMNS_TO_GET_FIELD_NUMBER = 4; + private com.google.protobuf.LazyStringList columnsToGet_; + public java.util.List + getColumnsToGetList() { + return columnsToGet_; + } + public int getColumnsToGetCount() { + return columnsToGet_.size(); + } + public String getColumnsToGet(int index) { + return columnsToGet_.get(index); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 5; + public static final int TIME_RANGE_FIELD_NUMBER = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange timeRange_; + public boolean hasTimeRange() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange() { + return timeRange_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder() { + return timeRange_; + } + + // optional int32 max_versions = 6; + public static final int MAX_VERSIONS_FIELD_NUMBER = 6; + private int maxVersions_; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getMaxVersions() { + return maxVersions_; + } + + // optional bytes filter = 8; + public static final int FILTER_FIELD_NUMBER = 8; + private com.google.protobuf.ByteString filter_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + + // optional string start_column = 9; + public static final int START_COLUMN_FIELD_NUMBER = 9; + private java.lang.Object startColumn_; + public boolean hasStartColumn() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getStartColumn() { + java.lang.Object ref = startColumn_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + startColumn_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStartColumnBytes() { + java.lang.Object ref = startColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + startColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string end_column = 10; + public static final int END_COLUMN_FIELD_NUMBER = 10; + private java.lang.Object endColumn_; + public boolean hasEndColumn() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public String getEndColumn() { + java.lang.Object ref = endColumn_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + endColumn_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getEndColumnBytes() { + java.lang.Object ref = endColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + endColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + primaryKey_ = java.util.Collections.emptyList();; + token_ = java.util.Collections.emptyList();; + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + maxVersions_ = 0; + filter_ = com.google.protobuf.ByteString.EMPTY; + startColumn_ = ""; + endColumn_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + for (int i = 0; i < primaryKey_.size(); i++) { + output.writeBytes(2, primaryKey_.get(i)); + } + for (int i = 0; i < token_.size(); i++) { + output.writeBytes(3, token_.get(i)); + } + for (int i = 0; i < columnsToGet_.size(); i++) { + output.writeBytes(4, columnsToGet_.getByteString(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(5, timeRange_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(6, maxVersions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(8, filter_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(9, getStartColumnBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(10, getEndColumnBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < primaryKey_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(primaryKey_.get(i)); + } + size += dataSize; + size += 1 * getPrimaryKeyList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < token_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(token_.get(i)); + } + size += dataSize; + size += 1 * getTokenList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < columnsToGet_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(columnsToGet_.getByteString(i)); + } + size += dataSize; + size += 1 * getColumnsToGetList().size(); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, timeRange_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, maxVersions_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(8, filter_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(9, getStartColumnBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(10, getEndColumnBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTimeRangeFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + primaryKey_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000002); + token_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000004); + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + if (timeRangeBuilder_ == null) { + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + } else { + timeRangeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + maxVersions_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + filter_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + startColumn_ = ""; + bitField0_ = (bitField0_ & ~0x00000080); + endColumn_ = ""; + bitField0_ = (bitField0_ & ~0x00000100); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.primaryKey_ = primaryKey_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + token_ = java.util.Collections.unmodifiableList(token_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.token_ = token_; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + columnsToGet_ = new com.google.protobuf.UnmodifiableLazyStringList( + columnsToGet_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.columnsToGet_ = columnsToGet_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000002; + } + if (timeRangeBuilder_ == null) { + result.timeRange_ = timeRange_; + } else { + result.timeRange_ = timeRangeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000004; + } + result.maxVersions_ = maxVersions_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000008; + } + result.filter_ = filter_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000010; + } + result.startColumn_ = startColumn_; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000020; + } + result.endColumn_ = endColumn_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (!other.primaryKey_.isEmpty()) { + if (primaryKey_.isEmpty()) { + primaryKey_ = other.primaryKey_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensurePrimaryKeyIsMutable(); + primaryKey_.addAll(other.primaryKey_); + } + onChanged(); + } + if (!other.token_.isEmpty()) { + if (token_.isEmpty()) { + token_ = other.token_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureTokenIsMutable(); + token_.addAll(other.token_); + } + onChanged(); + } + if (!other.columnsToGet_.isEmpty()) { + if (columnsToGet_.isEmpty()) { + columnsToGet_ = other.columnsToGet_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureColumnsToGetIsMutable(); + columnsToGet_.addAll(other.columnsToGet_); + } + onChanged(); + } + if (other.hasTimeRange()) { + mergeTimeRange(other.getTimeRange()); + } + if (other.hasMaxVersions()) { + setMaxVersions(other.getMaxVersions()); + } + if (other.hasFilter()) { + setFilter(other.getFilter()); + } + if (other.hasStartColumn()) { + setStartColumn(other.getStartColumn()); + } + if (other.hasEndColumn()) { + setEndColumn(other.getEndColumn()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + ensurePrimaryKeyIsMutable(); + primaryKey_.add(input.readBytes()); + break; + } + case 26: { + ensureTokenIsMutable(); + token_.add(input.readBytes()); + break; + } + case 34: { + ensureColumnsToGetIsMutable(); + columnsToGet_.add(input.readBytes()); + break; + } + case 42: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.newBuilder(); + if (hasTimeRange()) { + subBuilder.mergeFrom(getTimeRange()); + } + input.readMessage(subBuilder, extensionRegistry); + setTimeRange(subBuilder.buildPartial()); + break; + } + case 48: { + bitField0_ |= 0x00000020; + maxVersions_ = input.readInt32(); + break; + } + case 66: { + bitField0_ |= 0x00000040; + filter_ = input.readBytes(); + break; + } + case 74: { + bitField0_ |= 0x00000080; + startColumn_ = input.readBytes(); + break; + } + case 82: { + bitField0_ |= 0x00000100; + endColumn_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // repeated bytes primary_key = 2; + private java.util.List primaryKey_ = java.util.Collections.emptyList();; + private void ensurePrimaryKeyIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + primaryKey_ = new java.util.ArrayList(primaryKey_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getPrimaryKeyList() { + return java.util.Collections.unmodifiableList(primaryKey_); + } + public int getPrimaryKeyCount() { + return primaryKey_.size(); + } + public com.google.protobuf.ByteString getPrimaryKey(int index) { + return primaryKey_.get(index); + } + public Builder setPrimaryKey( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePrimaryKeyIsMutable(); + primaryKey_.set(index, value); + onChanged(); + return this; + } + public Builder addPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePrimaryKeyIsMutable(); + primaryKey_.add(value); + onChanged(); + return this; + } + public Builder addAllPrimaryKey( + java.lang.Iterable values) { + ensurePrimaryKeyIsMutable(); + super.addAll(values, primaryKey_); + onChanged(); + return this; + } + public Builder clearPrimaryKey() { + primaryKey_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + // repeated bytes token = 3; + private java.util.List token_ = java.util.Collections.emptyList();; + private void ensureTokenIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + token_ = new java.util.ArrayList(token_); + bitField0_ |= 0x00000004; + } + } + public java.util.List + getTokenList() { + return java.util.Collections.unmodifiableList(token_); + } + public int getTokenCount() { + return token_.size(); + } + public com.google.protobuf.ByteString getToken(int index) { + return token_.get(index); + } + public Builder setToken( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokenIsMutable(); + token_.set(index, value); + onChanged(); + return this; + } + public Builder addToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokenIsMutable(); + token_.add(value); + onChanged(); + return this; + } + public Builder addAllToken( + java.lang.Iterable values) { + ensureTokenIsMutable(); + super.addAll(values, token_); + onChanged(); + return this; + } + public Builder clearToken() { + token_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + // repeated string columns_to_get = 4; + private com.google.protobuf.LazyStringList columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureColumnsToGetIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + columnsToGet_ = new com.google.protobuf.LazyStringArrayList(columnsToGet_); + bitField0_ |= 0x00000008; + } + } + public java.util.List + getColumnsToGetList() { + return java.util.Collections.unmodifiableList(columnsToGet_); + } + public int getColumnsToGetCount() { + return columnsToGet_.size(); + } + public String getColumnsToGet(int index) { + return columnsToGet_.get(index); + } + public Builder setColumnsToGet( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsToGetIsMutable(); + columnsToGet_.set(index, value); + onChanged(); + return this; + } + public Builder addColumnsToGet(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsToGetIsMutable(); + columnsToGet_.add(value); + onChanged(); + return this; + } + public Builder addAllColumnsToGet( + java.lang.Iterable values) { + ensureColumnsToGetIsMutable(); + super.addAll(values, columnsToGet_); + onChanged(); + return this; + } + public Builder clearColumnsToGet() { + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + void addColumnsToGet(com.google.protobuf.ByteString value) { + ensureColumnsToGetIsMutable(); + columnsToGet_.add(value); + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder> timeRangeBuilder_; + public boolean hasTimeRange() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange() { + if (timeRangeBuilder_ == null) { + return timeRange_; + } else { + return timeRangeBuilder_.getMessage(); + } + } + public Builder setTimeRange(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange value) { + if (timeRangeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timeRange_ = value; + onChanged(); + } else { + timeRangeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + return this; + } + public Builder setTimeRange( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder builderForValue) { + if (timeRangeBuilder_ == null) { + timeRange_ = builderForValue.build(); + onChanged(); + } else { + timeRangeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + return this; + } + public Builder mergeTimeRange(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange value) { + if (timeRangeBuilder_ == null) { + if (((bitField0_ & 0x00000010) == 0x00000010) && + timeRange_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance()) { + timeRange_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.newBuilder(timeRange_).mergeFrom(value).buildPartial(); + } else { + timeRange_ = value; + } + onChanged(); + } else { + timeRangeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000010; + return this; + } + public Builder clearTimeRange() { + if (timeRangeBuilder_ == null) { + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + onChanged(); + } else { + timeRangeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder getTimeRangeBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getTimeRangeFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder() { + if (timeRangeBuilder_ != null) { + return timeRangeBuilder_.getMessageOrBuilder(); + } else { + return timeRange_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder> + getTimeRangeFieldBuilder() { + if (timeRangeBuilder_ == null) { + timeRangeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder>( + timeRange_, + getParentForChildren(), + isClean()); + timeRange_ = null; + } + return timeRangeBuilder_; + } + + // optional int32 max_versions = 6; + private int maxVersions_ ; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public int getMaxVersions() { + return maxVersions_; + } + public Builder setMaxVersions(int value) { + bitField0_ |= 0x00000020; + maxVersions_ = value; + onChanged(); + return this; + } + public Builder clearMaxVersions() { + bitField0_ = (bitField0_ & ~0x00000020); + maxVersions_ = 0; + onChanged(); + return this; + } + + // optional bytes filter = 8; + private com.google.protobuf.ByteString filter_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasFilter() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + public Builder setFilter(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + filter_ = value; + onChanged(); + return this; + } + public Builder clearFilter() { + bitField0_ = (bitField0_ & ~0x00000040); + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + + // optional string start_column = 9; + private java.lang.Object startColumn_ = ""; + public boolean hasStartColumn() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public String getStartColumn() { + java.lang.Object ref = startColumn_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + startColumn_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStartColumn(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000080; + startColumn_ = value; + onChanged(); + return this; + } + public Builder clearStartColumn() { + bitField0_ = (bitField0_ & ~0x00000080); + startColumn_ = getDefaultInstance().getStartColumn(); + onChanged(); + return this; + } + void setStartColumn(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000080; + startColumn_ = value; + onChanged(); + } + + // optional string end_column = 10; + private java.lang.Object endColumn_ = ""; + public boolean hasEndColumn() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public String getEndColumn() { + java.lang.Object ref = endColumn_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + endColumn_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setEndColumn(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000100; + endColumn_ = value; + onChanged(); + return this; + } + public Builder clearEndColumn() { + bitField0_ = (bitField0_ & ~0x00000100); + endColumn_ = getDefaultInstance().getEndColumn(); + onChanged(); + return this; + } + void setEndColumn(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000100; + endColumn_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowRequest) + } + + static { + defaultInstance = new TableInBatchGetRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowRequest) + } + + public interface BatchGetRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowRequest tables = 1; + java.util.List + getTablesList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest getTables(int index); + int getTablesCount(); + java.util.List + getTablesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequestOrBuilder getTablesOrBuilder( + int index); + } + public static final class BatchGetRowRequest extends + com.google.protobuf.GeneratedMessage + implements BatchGetRowRequestOrBuilder { + // Use BatchGetRowRequest.newBuilder() to construct. + private BatchGetRowRequest(Builder builder) { + super(builder); + } + private BatchGetRowRequest(boolean noInit) {} + + private static final BatchGetRowRequest defaultInstance; + public static BatchGetRowRequest getDefaultInstance() { + return defaultInstance; + } + + public BatchGetRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowRequest tables = 1; + public static final int TABLES_FIELD_NUMBER = 1; + private java.util.List tables_; + public java.util.List getTablesList() { + return tables_; + } + public java.util.List + getTablesOrBuilderList() { + return tables_; + } + public int getTablesCount() { + return tables_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest getTables(int index) { + return tables_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequestOrBuilder getTablesOrBuilder( + int index) { + return tables_.get(index); + } + + private void initFields() { + tables_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < tables_.size(); i++) { + output.writeMessage(1, tables_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < tables_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tables_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTablesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + tablesBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest(this); + int from_bitField0_ = bitField0_; + if (tablesBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = java.util.Collections.unmodifiableList(tables_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tables_ = tables_; + } else { + result.tables_ = tablesBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest.getDefaultInstance()) return this; + if (tablesBuilder_ == null) { + if (!other.tables_.isEmpty()) { + if (tables_.isEmpty()) { + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTablesIsMutable(); + tables_.addAll(other.tables_); + } + onChanged(); + } + } else { + if (!other.tables_.isEmpty()) { + if (tablesBuilder_.isEmpty()) { + tablesBuilder_.dispose(); + tablesBuilder_ = null; + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + tablesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getTablesFieldBuilder() : null; + } else { + tablesBuilder_.addAllMessages(other.tables_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addTables(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowRequest tables = 1; + private java.util.List tables_ = + java.util.Collections.emptyList(); + private void ensureTablesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = new java.util.ArrayList(tables_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequestOrBuilder> tablesBuilder_; + + public java.util.List getTablesList() { + if (tablesBuilder_ == null) { + return java.util.Collections.unmodifiableList(tables_); + } else { + return tablesBuilder_.getMessageList(); + } + } + public int getTablesCount() { + if (tablesBuilder_ == null) { + return tables_.size(); + } else { + return tablesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest getTables(int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); + } else { + return tablesBuilder_.getMessage(index); + } + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.set(index, value); + onChanged(); + } else { + tablesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.set(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addTables(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(value); + onChanged(); + } else { + tablesBuilder_.addMessage(value); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(index, value); + onChanged(); + } else { + tablesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addTables( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllTables( + java.lang.Iterable values) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + super.addAll(values, tables_); + onChanged(); + } else { + tablesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearTables() { + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + tablesBuilder_.clear(); + } + return this; + } + public Builder removeTables(int index) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.remove(index); + onChanged(); + } else { + tablesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder getTablesBuilder( + int index) { + return getTablesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequestOrBuilder getTablesOrBuilder( + int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); } else { + return tablesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getTablesOrBuilderList() { + if (tablesBuilder_ != null) { + return tablesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tables_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder addTablesBuilder() { + return getTablesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder addTablesBuilder( + int index) { + return getTablesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.getDefaultInstance()); + } + public java.util.List + getTablesBuilderList() { + return getTablesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequestOrBuilder> + getTablesFieldBuilder() { + if (tablesBuilder_ == null) { + tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequestOrBuilder>( + tables_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + tables_ = null; + } + return tablesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.BatchGetRowRequest) + } + + static { + defaultInstance = new BatchGetRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.BatchGetRowRequest) + } + + public interface RowInBatchGetRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required bool is_ok = 1; + boolean hasIsOk(); + boolean getIsOk(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Error error = 2; + boolean hasError(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error getError(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder getErrorOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 3; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // optional bytes row = 4; + boolean hasRow(); + com.google.protobuf.ByteString getRow(); + + // optional bytes next_token = 5; + boolean hasNextToken(); + com.google.protobuf.ByteString getNextToken(); + } + public static final class RowInBatchGetRowResponse extends + com.google.protobuf.GeneratedMessage + implements RowInBatchGetRowResponseOrBuilder { + // Use RowInBatchGetRowResponse.newBuilder() to construct. + private RowInBatchGetRowResponse(Builder builder) { + super(builder); + } + private RowInBatchGetRowResponse(boolean noInit) {} + + private static final RowInBatchGetRowResponse defaultInstance; + public static RowInBatchGetRowResponse getDefaultInstance() { + return defaultInstance; + } + + public RowInBatchGetRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required bool is_ok = 1; + public static final int IS_OK_FIELD_NUMBER = 1; + private boolean isOk_; + public boolean hasIsOk() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getIsOk() { + return isOk_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Error error = 2; + public static final int ERROR_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error error_; + public boolean hasError() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error getError() { + return error_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder getErrorOrBuilder() { + return error_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 3; + public static final int CONSUMED_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // optional bytes row = 4; + public static final int ROW_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString row_; + public boolean hasRow() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + + // optional bytes next_token = 5; + public static final int NEXT_TOKEN_FIELD_NUMBER = 5; + private com.google.protobuf.ByteString nextToken_; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + + private void initFields() { + isOk_ = false; + error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + row_ = com.google.protobuf.ByteString.EMPTY; + nextToken_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasIsOk()) { + memoizedIsInitialized = 0; + return false; + } + if (hasError()) { + if (!getError().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasConsumed()) { + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBool(1, isOk_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, error_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, consumed_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, row_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, nextToken_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, isOk_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, error_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, consumed_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, row_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, nextToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getErrorFieldBuilder(); + getConsumedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + isOk_ = false; + bitField0_ = (bitField0_ & ~0x00000001); + if (errorBuilder_ == null) { + error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + } else { + errorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + row_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + nextToken_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.isOk_ = isOk_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (errorBuilder_ == null) { + result.error_ = error_; + } else { + result.error_ = errorBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.row_ = row_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.nextToken_ = nextToken_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.getDefaultInstance()) return this; + if (other.hasIsOk()) { + setIsOk(other.getIsOk()); + } + if (other.hasError()) { + mergeError(other.getError()); + } + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (other.hasRow()) { + setRow(other.getRow()); + } + if (other.hasNextToken()) { + setNextToken(other.getNextToken()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasIsOk()) { + + return false; + } + if (hasError()) { + if (!getError().isInitialized()) { + + return false; + } + } + if (hasConsumed()) { + if (!getConsumed().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + isOk_ = input.readBool(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.newBuilder(); + if (hasError()) { + subBuilder.mergeFrom(getError()); + } + input.readMessage(subBuilder, extensionRegistry); + setError(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 34: { + bitField0_ |= 0x00000008; + row_ = input.readBytes(); + break; + } + case 42: { + bitField0_ |= 0x00000010; + nextToken_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required bool is_ok = 1; + private boolean isOk_ ; + public boolean hasIsOk() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getIsOk() { + return isOk_; + } + public Builder setIsOk(boolean value) { + bitField0_ |= 0x00000001; + isOk_ = value; + onChanged(); + return this; + } + public Builder clearIsOk() { + bitField0_ = (bitField0_ & ~0x00000001); + isOk_ = false; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Error error = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder> errorBuilder_; + public boolean hasError() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error getError() { + if (errorBuilder_ == null) { + return error_; + } else { + return errorBuilder_.getMessage(); + } + } + public Builder setError(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + error_ = value; + onChanged(); + } else { + errorBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setError( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder builderForValue) { + if (errorBuilder_ == null) { + error_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeError(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error value) { + if (errorBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + error_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance()) { + error_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.newBuilder(error_).mergeFrom(value).buildPartial(); + } else { + error_ = value; + } + onChanged(); + } else { + errorBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearError() { + if (errorBuilder_ == null) { + error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + onChanged(); + } else { + errorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder getErrorBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getErrorFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder getErrorOrBuilder() { + if (errorBuilder_ != null) { + return errorBuilder_.getMessageOrBuilder(); + } else { + return error_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder>( + error_, + getParentForChildren(), + isClean()); + error_ = null; + } + return errorBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // optional bytes row = 4; + private com.google.protobuf.ByteString row_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRow() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + public Builder setRow(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + row_ = value; + onChanged(); + return this; + } + public Builder clearRow() { + bitField0_ = (bitField0_ & ~0x00000008); + row_ = getDefaultInstance().getRow(); + onChanged(); + return this; + } + + // optional bytes next_token = 5; + private com.google.protobuf.ByteString nextToken_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + public Builder setNextToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + nextToken_ = value; + onChanged(); + return this; + } + public Builder clearNextToken() { + bitField0_ = (bitField0_ & ~0x00000010); + nextToken_ = getDefaultInstance().getNextToken(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.RowInBatchGetRowResponse) + } + + static { + defaultInstance = new RowInBatchGetRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.RowInBatchGetRowResponse) + } + + public interface TableInBatchGetRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchGetRowResponse rows = 2; + java.util.List + getRowsList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse getRows(int index); + int getRowsCount(); + java.util.List + getRowsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponseOrBuilder getRowsOrBuilder( + int index); + } + public static final class TableInBatchGetRowResponse extends + com.google.protobuf.GeneratedMessage + implements TableInBatchGetRowResponseOrBuilder { + // Use TableInBatchGetRowResponse.newBuilder() to construct. + private TableInBatchGetRowResponse(Builder builder) { + super(builder); + } + private TableInBatchGetRowResponse(boolean noInit) {} + + private static final TableInBatchGetRowResponse defaultInstance; + public static TableInBatchGetRowResponse getDefaultInstance() { + return defaultInstance; + } + + public TableInBatchGetRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchGetRowResponse rows = 2; + public static final int ROWS_FIELD_NUMBER = 2; + private java.util.List rows_; + public java.util.List getRowsList() { + return rows_; + } + public java.util.List + getRowsOrBuilderList() { + return rows_; + } + public int getRowsCount() { + return rows_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse getRows(int index) { + return rows_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponseOrBuilder getRowsOrBuilder( + int index) { + return rows_.get(index); + } + + private void initFields() { + tableName_ = ""; + rows_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getRowsCount(); i++) { + if (!getRows(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + for (int i = 0; i < rows_.size(); i++) { + output.writeMessage(2, rows_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + for (int i = 0; i < rows_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, rows_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getRowsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + rowsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (rowsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = java.util.Collections.unmodifiableList(rows_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.rows_ = rows_; + } else { + result.rows_ = rowsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (rowsBuilder_ == null) { + if (!other.rows_.isEmpty()) { + if (rows_.isEmpty()) { + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRowsIsMutable(); + rows_.addAll(other.rows_); + } + onChanged(); + } + } else { + if (!other.rows_.isEmpty()) { + if (rowsBuilder_.isEmpty()) { + rowsBuilder_.dispose(); + rowsBuilder_ = null; + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + rowsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getRowsFieldBuilder() : null; + } else { + rowsBuilder_.addAllMessages(other.rows_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + for (int i = 0; i < getRowsCount(); i++) { + if (!getRows(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addRows(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchGetRowResponse rows = 2; + private java.util.List rows_ = + java.util.Collections.emptyList(); + private void ensureRowsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = new java.util.ArrayList(rows_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponseOrBuilder> rowsBuilder_; + + public java.util.List getRowsList() { + if (rowsBuilder_ == null) { + return java.util.Collections.unmodifiableList(rows_); + } else { + return rowsBuilder_.getMessageList(); + } + } + public int getRowsCount() { + if (rowsBuilder_ == null) { + return rows_.size(); + } else { + return rowsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse getRows(int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); + } else { + return rowsBuilder_.getMessage(index); + } + } + public Builder setRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.set(index, value); + onChanged(); + } else { + rowsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.set(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addRows(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(value); + onChanged(); + } else { + rowsBuilder_.addMessage(value); + } + return this; + } + public Builder addRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(index, value); + onChanged(); + } else { + rowsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addRows( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllRows( + java.lang.Iterable values) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + super.addAll(values, rows_); + onChanged(); + } else { + rowsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearRows() { + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + rowsBuilder_.clear(); + } + return this; + } + public Builder removeRows(int index) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.remove(index); + onChanged(); + } else { + rowsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder getRowsBuilder( + int index) { + return getRowsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponseOrBuilder getRowsOrBuilder( + int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); } else { + return rowsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getRowsOrBuilderList() { + if (rowsBuilder_ != null) { + return rowsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(rows_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder addRowsBuilder() { + return getRowsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder addRowsBuilder( + int index) { + return getRowsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.getDefaultInstance()); + } + public java.util.List + getRowsBuilderList() { + return getRowsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponseOrBuilder> + getRowsFieldBuilder() { + if (rowsBuilder_ == null) { + rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponseOrBuilder>( + rows_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + rows_ = null; + } + return rowsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowResponse) + } + + static { + defaultInstance = new TableInBatchGetRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowResponse) + } + + public interface BatchGetRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowResponse tables = 1; + java.util.List + getTablesList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse getTables(int index); + int getTablesCount(); + java.util.List + getTablesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponseOrBuilder getTablesOrBuilder( + int index); + } + public static final class BatchGetRowResponse extends + com.google.protobuf.GeneratedMessage + implements BatchGetRowResponseOrBuilder { + // Use BatchGetRowResponse.newBuilder() to construct. + private BatchGetRowResponse(Builder builder) { + super(builder); + } + private BatchGetRowResponse(boolean noInit) {} + + private static final BatchGetRowResponse defaultInstance; + public static BatchGetRowResponse getDefaultInstance() { + return defaultInstance; + } + + public BatchGetRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowResponse tables = 1; + public static final int TABLES_FIELD_NUMBER = 1; + private java.util.List tables_; + public java.util.List getTablesList() { + return tables_; + } + public java.util.List + getTablesOrBuilderList() { + return tables_; + } + public int getTablesCount() { + return tables_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse getTables(int index) { + return tables_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponseOrBuilder getTablesOrBuilder( + int index) { + return tables_.get(index); + } + + private void initFields() { + tables_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < tables_.size(); i++) { + output.writeMessage(1, tables_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < tables_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tables_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTablesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + tablesBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse(this); + int from_bitField0_ = bitField0_; + if (tablesBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = java.util.Collections.unmodifiableList(tables_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tables_ = tables_; + } else { + result.tables_ = tablesBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse.getDefaultInstance()) return this; + if (tablesBuilder_ == null) { + if (!other.tables_.isEmpty()) { + if (tables_.isEmpty()) { + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTablesIsMutable(); + tables_.addAll(other.tables_); + } + onChanged(); + } + } else { + if (!other.tables_.isEmpty()) { + if (tablesBuilder_.isEmpty()) { + tablesBuilder_.dispose(); + tablesBuilder_ = null; + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + tablesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getTablesFieldBuilder() : null; + } else { + tablesBuilder_.addAllMessages(other.tables_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addTables(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchGetRowResponse tables = 1; + private java.util.List tables_ = + java.util.Collections.emptyList(); + private void ensureTablesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = new java.util.ArrayList(tables_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponseOrBuilder> tablesBuilder_; + + public java.util.List getTablesList() { + if (tablesBuilder_ == null) { + return java.util.Collections.unmodifiableList(tables_); + } else { + return tablesBuilder_.getMessageList(); + } + } + public int getTablesCount() { + if (tablesBuilder_ == null) { + return tables_.size(); + } else { + return tablesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse getTables(int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); + } else { + return tablesBuilder_.getMessage(index); + } + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.set(index, value); + onChanged(); + } else { + tablesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.set(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addTables(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(value); + onChanged(); + } else { + tablesBuilder_.addMessage(value); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(index, value); + onChanged(); + } else { + tablesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addTables( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllTables( + java.lang.Iterable values) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + super.addAll(values, tables_); + onChanged(); + } else { + tablesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearTables() { + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + tablesBuilder_.clear(); + } + return this; + } + public Builder removeTables(int index) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.remove(index); + onChanged(); + } else { + tablesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder getTablesBuilder( + int index) { + return getTablesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponseOrBuilder getTablesOrBuilder( + int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); } else { + return tablesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getTablesOrBuilderList() { + if (tablesBuilder_ != null) { + return tablesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tables_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder addTablesBuilder() { + return getTablesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder addTablesBuilder( + int index) { + return getTablesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.getDefaultInstance()); + } + public java.util.List + getTablesBuilderList() { + return getTablesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponseOrBuilder> + getTablesFieldBuilder() { + if (tablesBuilder_ == null) { + tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponseOrBuilder>( + tables_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + tables_ = null; + } + return tablesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.BatchGetRowResponse) + } + + static { + defaultInstance = new BatchGetRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.BatchGetRowResponse) + } + + public interface RowInBatchWriteRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.OperationType type = 1; + boolean hasType(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType getType(); + + // required bytes row_change = 2; + boolean hasRowChange(); + com.google.protobuf.ByteString getRowChange(); + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + boolean hasCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + boolean hasReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder(); + } + public static final class RowInBatchWriteRowRequest extends + com.google.protobuf.GeneratedMessage + implements RowInBatchWriteRowRequestOrBuilder { + // Use RowInBatchWriteRowRequest.newBuilder() to construct. + private RowInBatchWriteRowRequest(Builder builder) { + super(builder); + } + private RowInBatchWriteRowRequest(boolean noInit) {} + + private static final RowInBatchWriteRowRequest defaultInstance; + public static RowInBatchWriteRowRequest getDefaultInstance() { + return defaultInstance; + } + + public RowInBatchWriteRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.OperationType type = 1; + public static final int TYPE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType type_; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType getType() { + return type_; + } + + // required bytes row_change = 2; + public static final int ROW_CHANGE_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString rowChange_; + public boolean hasRowChange() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRowChange() { + return rowChange_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + public static final int CONDITION_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + return condition_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + return condition_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + public static final int RETURN_CONTENT_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + return returnContent_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + return returnContent_; + } + + private void initFields() { + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType.PUT; + rowChange_ = com.google.protobuf.ByteString.EMPTY; + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRowChange()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCondition()) { + memoizedIsInitialized = 0; + return false; + } + if (!getCondition().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, rowChange_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, returnContent_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, rowChange_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, condition_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, returnContent_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConditionFieldBuilder(); + getReturnContentFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType.PUT; + bitField0_ = (bitField0_ & ~0x00000001); + rowChange_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.rowChange_ = rowChange_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (conditionBuilder_ == null) { + result.condition_ = condition_; + } else { + result.condition_ = conditionBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (returnContentBuilder_ == null) { + result.returnContent_ = returnContent_; + } else { + result.returnContent_ = returnContentBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.getDefaultInstance()) return this; + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasRowChange()) { + setRowChange(other.getRowChange()); + } + if (other.hasCondition()) { + mergeCondition(other.getCondition()); + } + if (other.hasReturnContent()) { + mergeReturnContent(other.getReturnContent()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasType()) { + + return false; + } + if (!hasRowChange()) { + + return false; + } + if (!hasCondition()) { + + return false; + } + if (!getCondition().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + type_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + rowChange_ = input.readBytes(); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(); + if (hasCondition()) { + subBuilder.mergeFrom(getCondition()); + } + input.readMessage(subBuilder, extensionRegistry); + setCondition(subBuilder.buildPartial()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(); + if (hasReturnContent()) { + subBuilder.mergeFrom(getReturnContent()); + } + input.readMessage(subBuilder, extensionRegistry); + setReturnContent(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.OperationType type = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType.PUT; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType getType() { + return type_; + } + public Builder setType(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + type_ = value; + onChanged(); + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000001); + type_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.OperationType.PUT; + onChanged(); + return this; + } + + // required bytes row_change = 2; + private com.google.protobuf.ByteString rowChange_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRowChange() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRowChange() { + return rowChange_; + } + public Builder setRowChange(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + rowChange_ = value; + onChanged(); + return this; + } + public Builder clearRowChange() { + bitField0_ = (bitField0_ & ~0x00000002); + rowChange_ = getDefaultInstance().getRowChange(); + onChanged(); + return this; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Condition condition = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> conditionBuilder_; + public boolean hasCondition() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition getCondition() { + if (conditionBuilder_ == null) { + return condition_; + } else { + return conditionBuilder_.getMessage(); + } + } + public Builder setCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + condition_ = value; + onChanged(); + } else { + conditionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setCondition( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder builderForValue) { + if (conditionBuilder_ == null) { + condition_ = builderForValue.build(); + onChanged(); + } else { + conditionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeCondition(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition value) { + if (conditionBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + condition_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance()) { + condition_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); + } else { + condition_ = value; + } + onChanged(); + } else { + conditionBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearCondition() { + if (conditionBuilder_ == null) { + condition_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.getDefaultInstance(); + onChanged(); + } else { + conditionBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder getConditionBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getConditionFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder getConditionOrBuilder() { + if (conditionBuilder_ != null) { + return conditionBuilder_.getMessageOrBuilder(); + } else { + return condition_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder> + getConditionFieldBuilder() { + if (conditionBuilder_ == null) { + conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConditionOrBuilder>( + condition_, + getParentForChildren(), + isClean()); + condition_ = null; + } + return conditionBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ReturnContent return_content = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> returnContentBuilder_; + public boolean hasReturnContent() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent getReturnContent() { + if (returnContentBuilder_ == null) { + return returnContent_; + } else { + return returnContentBuilder_.getMessage(); + } + } + public Builder setReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + returnContent_ = value; + onChanged(); + } else { + returnContentBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setReturnContent( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder builderForValue) { + if (returnContentBuilder_ == null) { + returnContent_ = builderForValue.build(); + onChanged(); + } else { + returnContentBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeReturnContent(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent value) { + if (returnContentBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + returnContent_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance()) { + returnContent_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.newBuilder(returnContent_).mergeFrom(value).buildPartial(); + } else { + returnContent_ = value; + } + onChanged(); + } else { + returnContentBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearReturnContent() { + if (returnContentBuilder_ == null) { + returnContent_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.getDefaultInstance(); + onChanged(); + } else { + returnContentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder getReturnContentBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getReturnContentFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder getReturnContentOrBuilder() { + if (returnContentBuilder_ != null) { + return returnContentBuilder_.getMessageOrBuilder(); + } else { + return returnContent_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder> + getReturnContentFieldBuilder() { + if (returnContentBuilder_ == null) { + returnContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContentOrBuilder>( + returnContent_, + getParentForChildren(), + isClean()); + returnContent_ = null; + } + return returnContentBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowRequest) + } + + static { + defaultInstance = new RowInBatchWriteRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowRequest) + } + + public interface TableInBatchWriteRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowRequest rows = 2; + java.util.List + getRowsList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest getRows(int index); + int getRowsCount(); + java.util.List + getRowsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequestOrBuilder getRowsOrBuilder( + int index); + } + public static final class TableInBatchWriteRowRequest extends + com.google.protobuf.GeneratedMessage + implements TableInBatchWriteRowRequestOrBuilder { + // Use TableInBatchWriteRowRequest.newBuilder() to construct. + private TableInBatchWriteRowRequest(Builder builder) { + super(builder); + } + private TableInBatchWriteRowRequest(boolean noInit) {} + + private static final TableInBatchWriteRowRequest defaultInstance; + public static TableInBatchWriteRowRequest getDefaultInstance() { + return defaultInstance; + } + + public TableInBatchWriteRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowRequest rows = 2; + public static final int ROWS_FIELD_NUMBER = 2; + private java.util.List rows_; + public java.util.List getRowsList() { + return rows_; + } + public java.util.List + getRowsOrBuilderList() { + return rows_; + } + public int getRowsCount() { + return rows_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest getRows(int index) { + return rows_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequestOrBuilder getRowsOrBuilder( + int index) { + return rows_.get(index); + } + + private void initFields() { + tableName_ = ""; + rows_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getRowsCount(); i++) { + if (!getRows(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + for (int i = 0; i < rows_.size(); i++) { + output.writeMessage(2, rows_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + for (int i = 0; i < rows_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, rows_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getRowsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + rowsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (rowsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = java.util.Collections.unmodifiableList(rows_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.rows_ = rows_; + } else { + result.rows_ = rowsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (rowsBuilder_ == null) { + if (!other.rows_.isEmpty()) { + if (rows_.isEmpty()) { + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRowsIsMutable(); + rows_.addAll(other.rows_); + } + onChanged(); + } + } else { + if (!other.rows_.isEmpty()) { + if (rowsBuilder_.isEmpty()) { + rowsBuilder_.dispose(); + rowsBuilder_ = null; + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + rowsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getRowsFieldBuilder() : null; + } else { + rowsBuilder_.addAllMessages(other.rows_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + for (int i = 0; i < getRowsCount(); i++) { + if (!getRows(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addRows(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowRequest rows = 2; + private java.util.List rows_ = + java.util.Collections.emptyList(); + private void ensureRowsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = new java.util.ArrayList(rows_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequestOrBuilder> rowsBuilder_; + + public java.util.List getRowsList() { + if (rowsBuilder_ == null) { + return java.util.Collections.unmodifiableList(rows_); + } else { + return rowsBuilder_.getMessageList(); + } + } + public int getRowsCount() { + if (rowsBuilder_ == null) { + return rows_.size(); + } else { + return rowsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest getRows(int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); + } else { + return rowsBuilder_.getMessage(index); + } + } + public Builder setRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.set(index, value); + onChanged(); + } else { + rowsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.set(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addRows(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(value); + onChanged(); + } else { + rowsBuilder_.addMessage(value); + } + return this; + } + public Builder addRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(index, value); + onChanged(); + } else { + rowsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addRows( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllRows( + java.lang.Iterable values) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + super.addAll(values, rows_); + onChanged(); + } else { + rowsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearRows() { + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + rowsBuilder_.clear(); + } + return this; + } + public Builder removeRows(int index) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.remove(index); + onChanged(); + } else { + rowsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder getRowsBuilder( + int index) { + return getRowsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequestOrBuilder getRowsOrBuilder( + int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); } else { + return rowsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getRowsOrBuilderList() { + if (rowsBuilder_ != null) { + return rowsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(rows_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder addRowsBuilder() { + return getRowsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder addRowsBuilder( + int index) { + return getRowsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.getDefaultInstance()); + } + public java.util.List + getRowsBuilderList() { + return getRowsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequestOrBuilder> + getRowsFieldBuilder() { + if (rowsBuilder_ == null) { + rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequestOrBuilder>( + rows_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + rows_ = null; + } + return rowsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowRequest) + } + + static { + defaultInstance = new TableInBatchWriteRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowRequest) + } + + public interface BatchWriteRowRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowRequest tables = 1; + java.util.List + getTablesList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest getTables(int index); + int getTablesCount(); + java.util.List + getTablesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequestOrBuilder getTablesOrBuilder( + int index); + + // optional string transaction_id = 2; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class BatchWriteRowRequest extends + com.google.protobuf.GeneratedMessage + implements BatchWriteRowRequestOrBuilder { + // Use BatchWriteRowRequest.newBuilder() to construct. + private BatchWriteRowRequest(Builder builder) { + super(builder); + } + private BatchWriteRowRequest(boolean noInit) {} + + private static final BatchWriteRowRequest defaultInstance; + public static BatchWriteRowRequest getDefaultInstance() { + return defaultInstance; + } + + public BatchWriteRowRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_fieldAccessorTable; + } + + private int bitField0_; + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowRequest tables = 1; + public static final int TABLES_FIELD_NUMBER = 1; + private java.util.List tables_; + public java.util.List getTablesList() { + return tables_; + } + public java.util.List + getTablesOrBuilderList() { + return tables_; + } + public int getTablesCount() { + return tables_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest getTables(int index) { + return tables_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequestOrBuilder getTablesOrBuilder( + int index) { + return tables_.get(index); + } + + // optional string transaction_id = 2; + public static final int TRANSACTION_ID_FIELD_NUMBER = 2; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tables_ = java.util.Collections.emptyList(); + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < tables_.size(); i++) { + output.writeMessage(1, tables_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(2, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < tables_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tables_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTablesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + tablesBuilder_.clear(); + } + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (tablesBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = java.util.Collections.unmodifiableList(tables_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tables_ = tables_; + } else { + result.tables_ = tablesBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000001; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest.getDefaultInstance()) return this; + if (tablesBuilder_ == null) { + if (!other.tables_.isEmpty()) { + if (tables_.isEmpty()) { + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTablesIsMutable(); + tables_.addAll(other.tables_); + } + onChanged(); + } + } else { + if (!other.tables_.isEmpty()) { + if (tablesBuilder_.isEmpty()) { + tablesBuilder_.dispose(); + tablesBuilder_ = null; + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + tablesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getTablesFieldBuilder() : null; + } else { + tablesBuilder_.addAllMessages(other.tables_); + } + } + } + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addTables(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowRequest tables = 1; + private java.util.List tables_ = + java.util.Collections.emptyList(); + private void ensureTablesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = new java.util.ArrayList(tables_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequestOrBuilder> tablesBuilder_; + + public java.util.List getTablesList() { + if (tablesBuilder_ == null) { + return java.util.Collections.unmodifiableList(tables_); + } else { + return tablesBuilder_.getMessageList(); + } + } + public int getTablesCount() { + if (tablesBuilder_ == null) { + return tables_.size(); + } else { + return tablesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest getTables(int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); + } else { + return tablesBuilder_.getMessage(index); + } + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.set(index, value); + onChanged(); + } else { + tablesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.set(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addTables(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(value); + onChanged(); + } else { + tablesBuilder_.addMessage(value); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(index, value); + onChanged(); + } else { + tablesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addTables( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllTables( + java.lang.Iterable values) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + super.addAll(values, tables_); + onChanged(); + } else { + tablesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearTables() { + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + tablesBuilder_.clear(); + } + return this; + } + public Builder removeTables(int index) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.remove(index); + onChanged(); + } else { + tablesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder getTablesBuilder( + int index) { + return getTablesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequestOrBuilder getTablesOrBuilder( + int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); } else { + return tablesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getTablesOrBuilderList() { + if (tablesBuilder_ != null) { + return tablesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tables_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder addTablesBuilder() { + return getTablesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder addTablesBuilder( + int index) { + return getTablesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.getDefaultInstance()); + } + public java.util.List + getTablesBuilderList() { + return getTablesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequestOrBuilder> + getTablesFieldBuilder() { + if (tablesBuilder_ == null) { + tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequestOrBuilder>( + tables_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + tables_ = null; + } + return tablesBuilder_; + } + + // optional string transaction_id = 2; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000002); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.BatchWriteRowRequest) + } + + static { + defaultInstance = new BatchWriteRowRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.BatchWriteRowRequest) + } + + public interface RowInBatchWriteRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required bool is_ok = 1; + boolean hasIsOk(); + boolean getIsOk(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Error error = 2; + boolean hasError(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error getError(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder getErrorOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 3; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // optional bytes row = 4; + boolean hasRow(); + com.google.protobuf.ByteString getRow(); + } + public static final class RowInBatchWriteRowResponse extends + com.google.protobuf.GeneratedMessage + implements RowInBatchWriteRowResponseOrBuilder { + // Use RowInBatchWriteRowResponse.newBuilder() to construct. + private RowInBatchWriteRowResponse(Builder builder) { + super(builder); + } + private RowInBatchWriteRowResponse(boolean noInit) {} + + private static final RowInBatchWriteRowResponse defaultInstance; + public static RowInBatchWriteRowResponse getDefaultInstance() { + return defaultInstance; + } + + public RowInBatchWriteRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required bool is_ok = 1; + public static final int IS_OK_FIELD_NUMBER = 1; + private boolean isOk_; + public boolean hasIsOk() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getIsOk() { + return isOk_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Error error = 2; + public static final int ERROR_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error error_; + public boolean hasError() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error getError() { + return error_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder getErrorOrBuilder() { + return error_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 3; + public static final int CONSUMED_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // optional bytes row = 4; + public static final int ROW_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString row_; + public boolean hasRow() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + + private void initFields() { + isOk_ = false; + error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + row_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasIsOk()) { + memoizedIsInitialized = 0; + return false; + } + if (hasError()) { + if (!getError().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + if (hasConsumed()) { + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBool(1, isOk_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, error_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, consumed_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, row_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, isOk_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, error_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, consumed_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, row_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getErrorFieldBuilder(); + getConsumedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + isOk_ = false; + bitField0_ = (bitField0_ & ~0x00000001); + if (errorBuilder_ == null) { + error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + } else { + errorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + row_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.isOk_ = isOk_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (errorBuilder_ == null) { + result.error_ = error_; + } else { + result.error_ = errorBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.row_ = row_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.getDefaultInstance()) return this; + if (other.hasIsOk()) { + setIsOk(other.getIsOk()); + } + if (other.hasError()) { + mergeError(other.getError()); + } + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (other.hasRow()) { + setRow(other.getRow()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasIsOk()) { + + return false; + } + if (hasError()) { + if (!getError().isInitialized()) { + + return false; + } + } + if (hasConsumed()) { + if (!getConsumed().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + isOk_ = input.readBool(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.newBuilder(); + if (hasError()) { + subBuilder.mergeFrom(getError()); + } + input.readMessage(subBuilder, extensionRegistry); + setError(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 34: { + bitField0_ |= 0x00000008; + row_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required bool is_ok = 1; + private boolean isOk_ ; + public boolean hasIsOk() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public boolean getIsOk() { + return isOk_; + } + public Builder setIsOk(boolean value) { + bitField0_ |= 0x00000001; + isOk_ = value; + onChanged(); + return this; + } + public Builder clearIsOk() { + bitField0_ = (bitField0_ & ~0x00000001); + isOk_ = false; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Error error = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder> errorBuilder_; + public boolean hasError() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error getError() { + if (errorBuilder_ == null) { + return error_; + } else { + return errorBuilder_.getMessage(); + } + } + public Builder setError(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error value) { + if (errorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + error_ = value; + onChanged(); + } else { + errorBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setError( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder builderForValue) { + if (errorBuilder_ == null) { + error_ = builderForValue.build(); + onChanged(); + } else { + errorBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeError(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error value) { + if (errorBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + error_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance()) { + error_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.newBuilder(error_).mergeFrom(value).buildPartial(); + } else { + error_ = value; + } + onChanged(); + } else { + errorBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearError() { + if (errorBuilder_ == null) { + error_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.getDefaultInstance(); + onChanged(); + } else { + errorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder getErrorBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getErrorFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder getErrorOrBuilder() { + if (errorBuilder_ != null) { + return errorBuilder_.getMessageOrBuilder(); + } else { + return error_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder> + getErrorFieldBuilder() { + if (errorBuilder_ == null) { + errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ErrorOrBuilder>( + error_, + getParentForChildren(), + isClean()); + error_ = null; + } + return errorBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 3; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // optional bytes row = 4; + private com.google.protobuf.ByteString row_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRow() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getRow() { + return row_; + } + public Builder setRow(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + row_ = value; + onChanged(); + return this; + } + public Builder clearRow() { + bitField0_ = (bitField0_ & ~0x00000008); + row_ = getDefaultInstance().getRow(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowResponse) + } + + static { + defaultInstance = new RowInBatchWriteRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowResponse) + } + + public interface TableInBatchWriteRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowResponse rows = 2; + java.util.List + getRowsList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse getRows(int index); + int getRowsCount(); + java.util.List + getRowsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponseOrBuilder getRowsOrBuilder( + int index); + } + public static final class TableInBatchWriteRowResponse extends + com.google.protobuf.GeneratedMessage + implements TableInBatchWriteRowResponseOrBuilder { + // Use TableInBatchWriteRowResponse.newBuilder() to construct. + private TableInBatchWriteRowResponse(Builder builder) { + super(builder); + } + private TableInBatchWriteRowResponse(boolean noInit) {} + + private static final TableInBatchWriteRowResponse defaultInstance; + public static TableInBatchWriteRowResponse getDefaultInstance() { + return defaultInstance; + } + + public TableInBatchWriteRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowResponse rows = 2; + public static final int ROWS_FIELD_NUMBER = 2; + private java.util.List rows_; + public java.util.List getRowsList() { + return rows_; + } + public java.util.List + getRowsOrBuilderList() { + return rows_; + } + public int getRowsCount() { + return rows_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse getRows(int index) { + return rows_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponseOrBuilder getRowsOrBuilder( + int index) { + return rows_.get(index); + } + + private void initFields() { + tableName_ = ""; + rows_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getRowsCount(); i++) { + if (!getRows(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + for (int i = 0; i < rows_.size(); i++) { + output.writeMessage(2, rows_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + for (int i = 0; i < rows_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, rows_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getRowsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + rowsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (rowsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = java.util.Collections.unmodifiableList(rows_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.rows_ = rows_; + } else { + result.rows_ = rowsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (rowsBuilder_ == null) { + if (!other.rows_.isEmpty()) { + if (rows_.isEmpty()) { + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRowsIsMutable(); + rows_.addAll(other.rows_); + } + onChanged(); + } + } else { + if (!other.rows_.isEmpty()) { + if (rowsBuilder_.isEmpty()) { + rowsBuilder_.dispose(); + rowsBuilder_ = null; + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + rowsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getRowsFieldBuilder() : null; + } else { + rowsBuilder_.addAllMessages(other.rows_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + for (int i = 0; i < getRowsCount(); i++) { + if (!getRows(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addRows(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.RowInBatchWriteRowResponse rows = 2; + private java.util.List rows_ = + java.util.Collections.emptyList(); + private void ensureRowsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = new java.util.ArrayList(rows_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponseOrBuilder> rowsBuilder_; + + public java.util.List getRowsList() { + if (rowsBuilder_ == null) { + return java.util.Collections.unmodifiableList(rows_); + } else { + return rowsBuilder_.getMessageList(); + } + } + public int getRowsCount() { + if (rowsBuilder_ == null) { + return rows_.size(); + } else { + return rowsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse getRows(int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); + } else { + return rowsBuilder_.getMessage(index); + } + } + public Builder setRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.set(index, value); + onChanged(); + } else { + rowsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.set(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addRows(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(value); + onChanged(); + } else { + rowsBuilder_.addMessage(value); + } + return this; + } + public Builder addRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(index, value); + onChanged(); + } else { + rowsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addRows( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addRows( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllRows( + java.lang.Iterable values) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + super.addAll(values, rows_); + onChanged(); + } else { + rowsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearRows() { + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + rowsBuilder_.clear(); + } + return this; + } + public Builder removeRows(int index) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.remove(index); + onChanged(); + } else { + rowsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder getRowsBuilder( + int index) { + return getRowsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponseOrBuilder getRowsOrBuilder( + int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); } else { + return rowsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getRowsOrBuilderList() { + if (rowsBuilder_ != null) { + return rowsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(rows_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder addRowsBuilder() { + return getRowsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder addRowsBuilder( + int index) { + return getRowsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.getDefaultInstance()); + } + public java.util.List + getRowsBuilderList() { + return getRowsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponseOrBuilder> + getRowsFieldBuilder() { + if (rowsBuilder_ == null) { + rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponseOrBuilder>( + rows_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + rows_ = null; + } + return rowsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowResponse) + } + + static { + defaultInstance = new TableInBatchWriteRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowResponse) + } + + public interface BatchWriteRowResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowResponse tables = 1; + java.util.List + getTablesList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse getTables(int index); + int getTablesCount(); + java.util.List + getTablesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponseOrBuilder getTablesOrBuilder( + int index); + } + public static final class BatchWriteRowResponse extends + com.google.protobuf.GeneratedMessage + implements BatchWriteRowResponseOrBuilder { + // Use BatchWriteRowResponse.newBuilder() to construct. + private BatchWriteRowResponse(Builder builder) { + super(builder); + } + private BatchWriteRowResponse(boolean noInit) {} + + private static final BatchWriteRowResponse defaultInstance; + public static BatchWriteRowResponse getDefaultInstance() { + return defaultInstance; + } + + public BatchWriteRowResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowResponse tables = 1; + public static final int TABLES_FIELD_NUMBER = 1; + private java.util.List tables_; + public java.util.List getTablesList() { + return tables_; + } + public java.util.List + getTablesOrBuilderList() { + return tables_; + } + public int getTablesCount() { + return tables_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse getTables(int index) { + return tables_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponseOrBuilder getTablesOrBuilder( + int index) { + return tables_.get(index); + } + + private void initFields() { + tables_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < tables_.size(); i++) { + output.writeMessage(1, tables_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < tables_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tables_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTablesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + tablesBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse(this); + int from_bitField0_ = bitField0_; + if (tablesBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = java.util.Collections.unmodifiableList(tables_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tables_ = tables_; + } else { + result.tables_ = tablesBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse.getDefaultInstance()) return this; + if (tablesBuilder_ == null) { + if (!other.tables_.isEmpty()) { + if (tables_.isEmpty()) { + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTablesIsMutable(); + tables_.addAll(other.tables_); + } + onChanged(); + } + } else { + if (!other.tables_.isEmpty()) { + if (tablesBuilder_.isEmpty()) { + tablesBuilder_.dispose(); + tablesBuilder_ = null; + tables_ = other.tables_; + bitField0_ = (bitField0_ & ~0x00000001); + tablesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getTablesFieldBuilder() : null; + } else { + tablesBuilder_.addAllMessages(other.tables_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getTablesCount(); i++) { + if (!getTables(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addTables(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TableInBatchWriteRowResponse tables = 1; + private java.util.List tables_ = + java.util.Collections.emptyList(); + private void ensureTablesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + tables_ = new java.util.ArrayList(tables_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponseOrBuilder> tablesBuilder_; + + public java.util.List getTablesList() { + if (tablesBuilder_ == null) { + return java.util.Collections.unmodifiableList(tables_); + } else { + return tablesBuilder_.getMessageList(); + } + } + public int getTablesCount() { + if (tablesBuilder_ == null) { + return tables_.size(); + } else { + return tablesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse getTables(int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); + } else { + return tablesBuilder_.getMessage(index); + } + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.set(index, value); + onChanged(); + } else { + tablesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.set(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addTables(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(value); + onChanged(); + } else { + tablesBuilder_.addMessage(value); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse value) { + if (tablesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTablesIsMutable(); + tables_.add(index, value); + onChanged(); + } else { + tablesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addTables( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addTables( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder builderForValue) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.add(index, builderForValue.build()); + onChanged(); + } else { + tablesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllTables( + java.lang.Iterable values) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + super.addAll(values, tables_); + onChanged(); + } else { + tablesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearTables() { + if (tablesBuilder_ == null) { + tables_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + tablesBuilder_.clear(); + } + return this; + } + public Builder removeTables(int index) { + if (tablesBuilder_ == null) { + ensureTablesIsMutable(); + tables_.remove(index); + onChanged(); + } else { + tablesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder getTablesBuilder( + int index) { + return getTablesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponseOrBuilder getTablesOrBuilder( + int index) { + if (tablesBuilder_ == null) { + return tables_.get(index); } else { + return tablesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getTablesOrBuilderList() { + if (tablesBuilder_ != null) { + return tablesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tables_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder addTablesBuilder() { + return getTablesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder addTablesBuilder( + int index) { + return getTablesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.getDefaultInstance()); + } + public java.util.List + getTablesBuilderList() { + return getTablesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponseOrBuilder> + getTablesFieldBuilder() { + if (tablesBuilder_ == null) { + tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponseOrBuilder>( + tables_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + tables_ = null; + } + return tablesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.BatchWriteRowResponse) + } + + static { + defaultInstance = new BatchWriteRowResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.BatchWriteRowResponse) + } + + public interface GetRangeRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required .com.alicloud.openservices.tablestore.core.protocol.Direction direction = 2; + boolean hasDirection(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction getDirection(); + + // repeated string columns_to_get = 3; + java.util.List getColumnsToGetList(); + int getColumnsToGetCount(); + String getColumnsToGet(int index); + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 4; + boolean hasTimeRange(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder(); + + // optional int32 max_versions = 5; + boolean hasMaxVersions(); + int getMaxVersions(); + + // optional int32 limit = 6; + boolean hasLimit(); + int getLimit(); + + // required bytes inclusive_start_primary_key = 7; + boolean hasInclusiveStartPrimaryKey(); + com.google.protobuf.ByteString getInclusiveStartPrimaryKey(); + + // required bytes exclusive_end_primary_key = 8; + boolean hasExclusiveEndPrimaryKey(); + com.google.protobuf.ByteString getExclusiveEndPrimaryKey(); + + // optional bytes filter = 10; + boolean hasFilter(); + com.google.protobuf.ByteString getFilter(); + + // optional string start_column = 11; + boolean hasStartColumn(); + String getStartColumn(); + + // optional string end_column = 12; + boolean hasEndColumn(); + String getEndColumn(); + + // optional bytes token = 13; + boolean hasToken(); + com.google.protobuf.ByteString getToken(); + + // optional string transaction_id = 14; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class GetRangeRequest extends + com.google.protobuf.GeneratedMessage + implements GetRangeRequestOrBuilder { + // Use GetRangeRequest.newBuilder() to construct. + private GetRangeRequest(Builder builder) { + super(builder); + } + private GetRangeRequest(boolean noInit) {} + + private static final GetRangeRequest defaultInstance; + public static GetRangeRequest getDefaultInstance() { + return defaultInstance; + } + + public GetRangeRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Direction direction = 2; + public static final int DIRECTION_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction direction_; + public boolean hasDirection() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction getDirection() { + return direction_; + } + + // repeated string columns_to_get = 3; + public static final int COLUMNS_TO_GET_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList columnsToGet_; + public java.util.List + getColumnsToGetList() { + return columnsToGet_; + } + public int getColumnsToGetCount() { + return columnsToGet_.size(); + } + public String getColumnsToGet(int index) { + return columnsToGet_.get(index); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 4; + public static final int TIME_RANGE_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange timeRange_; + public boolean hasTimeRange() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange() { + return timeRange_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder() { + return timeRange_; + } + + // optional int32 max_versions = 5; + public static final int MAX_VERSIONS_FIELD_NUMBER = 5; + private int maxVersions_; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public int getMaxVersions() { + return maxVersions_; + } + + // optional int32 limit = 6; + public static final int LIMIT_FIELD_NUMBER = 6; + private int limit_; + public boolean hasLimit() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public int getLimit() { + return limit_; + } + + // required bytes inclusive_start_primary_key = 7; + public static final int INCLUSIVE_START_PRIMARY_KEY_FIELD_NUMBER = 7; + private com.google.protobuf.ByteString inclusiveStartPrimaryKey_; + public boolean hasInclusiveStartPrimaryKey() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public com.google.protobuf.ByteString getInclusiveStartPrimaryKey() { + return inclusiveStartPrimaryKey_; + } + + // required bytes exclusive_end_primary_key = 8; + public static final int EXCLUSIVE_END_PRIMARY_KEY_FIELD_NUMBER = 8; + private com.google.protobuf.ByteString exclusiveEndPrimaryKey_; + public boolean hasExclusiveEndPrimaryKey() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public com.google.protobuf.ByteString getExclusiveEndPrimaryKey() { + return exclusiveEndPrimaryKey_; + } + + // optional bytes filter = 10; + public static final int FILTER_FIELD_NUMBER = 10; + private com.google.protobuf.ByteString filter_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + + // optional string start_column = 11; + public static final int START_COLUMN_FIELD_NUMBER = 11; + private java.lang.Object startColumn_; + public boolean hasStartColumn() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public String getStartColumn() { + java.lang.Object ref = startColumn_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + startColumn_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStartColumnBytes() { + java.lang.Object ref = startColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + startColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string end_column = 12; + public static final int END_COLUMN_FIELD_NUMBER = 12; + private java.lang.Object endColumn_; + public boolean hasEndColumn() { + return ((bitField0_ & 0x00000200) == 0x00000200); + } + public String getEndColumn() { + java.lang.Object ref = endColumn_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + endColumn_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getEndColumnBytes() { + java.lang.Object ref = endColumn_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + endColumn_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bytes token = 13; + public static final int TOKEN_FIELD_NUMBER = 13; + private com.google.protobuf.ByteString token_; + public boolean hasToken() { + return ((bitField0_ & 0x00000400) == 0x00000400); + } + public com.google.protobuf.ByteString getToken() { + return token_; + } + + // optional string transaction_id = 14; + public static final int TRANSACTION_ID_FIELD_NUMBER = 14; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000800) == 0x00000800); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + direction_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction.FORWARD; + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + maxVersions_ = 0; + limit_ = 0; + inclusiveStartPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + exclusiveEndPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + filter_ = com.google.protobuf.ByteString.EMPTY; + startColumn_ = ""; + endColumn_ = ""; + token_ = com.google.protobuf.ByteString.EMPTY; + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasDirection()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasInclusiveStartPrimaryKey()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasExclusiveEndPrimaryKey()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(2, direction_.getNumber()); + } + for (int i = 0; i < columnsToGet_.size(); i++) { + output.writeBytes(3, columnsToGet_.getByteString(i)); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(4, timeRange_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(5, maxVersions_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(6, limit_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(7, inclusiveStartPrimaryKey_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBytes(8, exclusiveEndPrimaryKey_); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeBytes(10, filter_); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + output.writeBytes(11, getStartColumnBytes()); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + output.writeBytes(12, getEndColumnBytes()); + } + if (((bitField0_ & 0x00000400) == 0x00000400)) { + output.writeBytes(13, token_); + } + if (((bitField0_ & 0x00000800) == 0x00000800)) { + output.writeBytes(14, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, direction_.getNumber()); + } + { + int dataSize = 0; + for (int i = 0; i < columnsToGet_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(columnsToGet_.getByteString(i)); + } + size += dataSize; + size += 1 * getColumnsToGetList().size(); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, timeRange_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, maxVersions_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, limit_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(7, inclusiveStartPrimaryKey_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(8, exclusiveEndPrimaryKey_); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(10, filter_); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(11, getStartColumnBytes()); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(12, getEndColumnBytes()); + } + if (((bitField0_ & 0x00000400) == 0x00000400)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(13, token_); + } + if (((bitField0_ & 0x00000800) == 0x00000800)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(14, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTimeRangeFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + direction_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction.FORWARD; + bitField0_ = (bitField0_ & ~0x00000002); + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + if (timeRangeBuilder_ == null) { + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + } else { + timeRangeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + maxVersions_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + limit_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + inclusiveStartPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + exclusiveEndPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000080); + filter_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000100); + startColumn_ = ""; + bitField0_ = (bitField0_ & ~0x00000200); + endColumn_ = ""; + bitField0_ = (bitField0_ & ~0x00000400); + token_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000800); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00001000); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.direction_ = direction_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + columnsToGet_ = new com.google.protobuf.UnmodifiableLazyStringList( + columnsToGet_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.columnsToGet_ = columnsToGet_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000004; + } + if (timeRangeBuilder_ == null) { + result.timeRange_ = timeRange_; + } else { + result.timeRange_ = timeRangeBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000008; + } + result.maxVersions_ = maxVersions_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000010; + } + result.limit_ = limit_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000020; + } + result.inclusiveStartPrimaryKey_ = inclusiveStartPrimaryKey_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000040; + } + result.exclusiveEndPrimaryKey_ = exclusiveEndPrimaryKey_; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000080; + } + result.filter_ = filter_; + if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + to_bitField0_ |= 0x00000100; + } + result.startColumn_ = startColumn_; + if (((from_bitField0_ & 0x00000400) == 0x00000400)) { + to_bitField0_ |= 0x00000200; + } + result.endColumn_ = endColumn_; + if (((from_bitField0_ & 0x00000800) == 0x00000800)) { + to_bitField0_ |= 0x00000400; + } + result.token_ = token_; + if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + to_bitField0_ |= 0x00000800; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasDirection()) { + setDirection(other.getDirection()); + } + if (!other.columnsToGet_.isEmpty()) { + if (columnsToGet_.isEmpty()) { + columnsToGet_ = other.columnsToGet_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureColumnsToGetIsMutable(); + columnsToGet_.addAll(other.columnsToGet_); + } + onChanged(); + } + if (other.hasTimeRange()) { + mergeTimeRange(other.getTimeRange()); + } + if (other.hasMaxVersions()) { + setMaxVersions(other.getMaxVersions()); + } + if (other.hasLimit()) { + setLimit(other.getLimit()); + } + if (other.hasInclusiveStartPrimaryKey()) { + setInclusiveStartPrimaryKey(other.getInclusiveStartPrimaryKey()); + } + if (other.hasExclusiveEndPrimaryKey()) { + setExclusiveEndPrimaryKey(other.getExclusiveEndPrimaryKey()); + } + if (other.hasFilter()) { + setFilter(other.getFilter()); + } + if (other.hasStartColumn()) { + setStartColumn(other.getStartColumn()); + } + if (other.hasEndColumn()) { + setEndColumn(other.getEndColumn()); + } + if (other.hasToken()) { + setToken(other.getToken()); + } + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasDirection()) { + + return false; + } + if (!hasInclusiveStartPrimaryKey()) { + + return false; + } + if (!hasExclusiveEndPrimaryKey()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 16: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + direction_ = value; + } + break; + } + case 26: { + ensureColumnsToGetIsMutable(); + columnsToGet_.add(input.readBytes()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.newBuilder(); + if (hasTimeRange()) { + subBuilder.mergeFrom(getTimeRange()); + } + input.readMessage(subBuilder, extensionRegistry); + setTimeRange(subBuilder.buildPartial()); + break; + } + case 40: { + bitField0_ |= 0x00000010; + maxVersions_ = input.readInt32(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + limit_ = input.readInt32(); + break; + } + case 58: { + bitField0_ |= 0x00000040; + inclusiveStartPrimaryKey_ = input.readBytes(); + break; + } + case 66: { + bitField0_ |= 0x00000080; + exclusiveEndPrimaryKey_ = input.readBytes(); + break; + } + case 82: { + bitField0_ |= 0x00000100; + filter_ = input.readBytes(); + break; + } + case 90: { + bitField0_ |= 0x00000200; + startColumn_ = input.readBytes(); + break; + } + case 98: { + bitField0_ |= 0x00000400; + endColumn_ = input.readBytes(); + break; + } + case 106: { + bitField0_ |= 0x00000800; + token_ = input.readBytes(); + break; + } + case 114: { + bitField0_ |= 0x00001000; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required .com.alicloud.openservices.tablestore.core.protocol.Direction direction = 2; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction direction_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction.FORWARD; + public boolean hasDirection() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction getDirection() { + return direction_; + } + public Builder setDirection(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + direction_ = value; + onChanged(); + return this; + } + public Builder clearDirection() { + bitField0_ = (bitField0_ & ~0x00000002); + direction_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Direction.FORWARD; + onChanged(); + return this; + } + + // repeated string columns_to_get = 3; + private com.google.protobuf.LazyStringList columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureColumnsToGetIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + columnsToGet_ = new com.google.protobuf.LazyStringArrayList(columnsToGet_); + bitField0_ |= 0x00000004; + } + } + public java.util.List + getColumnsToGetList() { + return java.util.Collections.unmodifiableList(columnsToGet_); + } + public int getColumnsToGetCount() { + return columnsToGet_.size(); + } + public String getColumnsToGet(int index) { + return columnsToGet_.get(index); + } + public Builder setColumnsToGet( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsToGetIsMutable(); + columnsToGet_.set(index, value); + onChanged(); + return this; + } + public Builder addColumnsToGet(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsToGetIsMutable(); + columnsToGet_.add(value); + onChanged(); + return this; + } + public Builder addAllColumnsToGet( + java.lang.Iterable values) { + ensureColumnsToGetIsMutable(); + super.addAll(values, columnsToGet_); + onChanged(); + return this; + } + public Builder clearColumnsToGet() { + columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + void addColumnsToGet(com.google.protobuf.ByteString value) { + ensureColumnsToGetIsMutable(); + columnsToGet_.add(value); + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.TimeRange time_range = 4; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder> timeRangeBuilder_; + public boolean hasTimeRange() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange getTimeRange() { + if (timeRangeBuilder_ == null) { + return timeRange_; + } else { + return timeRangeBuilder_.getMessage(); + } + } + public Builder setTimeRange(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange value) { + if (timeRangeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timeRange_ = value; + onChanged(); + } else { + timeRangeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setTimeRange( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder builderForValue) { + if (timeRangeBuilder_ == null) { + timeRange_ = builderForValue.build(); + onChanged(); + } else { + timeRangeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeTimeRange(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange value) { + if (timeRangeBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + timeRange_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance()) { + timeRange_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.newBuilder(timeRange_).mergeFrom(value).buildPartial(); + } else { + timeRange_ = value; + } + onChanged(); + } else { + timeRangeBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearTimeRange() { + if (timeRangeBuilder_ == null) { + timeRange_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.getDefaultInstance(); + onChanged(); + } else { + timeRangeBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder getTimeRangeBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getTimeRangeFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder getTimeRangeOrBuilder() { + if (timeRangeBuilder_ != null) { + return timeRangeBuilder_.getMessageOrBuilder(); + } else { + return timeRange_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder> + getTimeRangeFieldBuilder() { + if (timeRangeBuilder_ == null) { + timeRangeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRangeOrBuilder>( + timeRange_, + getParentForChildren(), + isClean()); + timeRange_ = null; + } + return timeRangeBuilder_; + } + + // optional int32 max_versions = 5; + private int maxVersions_ ; + public boolean hasMaxVersions() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public int getMaxVersions() { + return maxVersions_; + } + public Builder setMaxVersions(int value) { + bitField0_ |= 0x00000010; + maxVersions_ = value; + onChanged(); + return this; + } + public Builder clearMaxVersions() { + bitField0_ = (bitField0_ & ~0x00000010); + maxVersions_ = 0; + onChanged(); + return this; + } + + // optional int32 limit = 6; + private int limit_ ; + public boolean hasLimit() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public int getLimit() { + return limit_; + } + public Builder setLimit(int value) { + bitField0_ |= 0x00000020; + limit_ = value; + onChanged(); + return this; + } + public Builder clearLimit() { + bitField0_ = (bitField0_ & ~0x00000020); + limit_ = 0; + onChanged(); + return this; + } + + // required bytes inclusive_start_primary_key = 7; + private com.google.protobuf.ByteString inclusiveStartPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasInclusiveStartPrimaryKey() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public com.google.protobuf.ByteString getInclusiveStartPrimaryKey() { + return inclusiveStartPrimaryKey_; + } + public Builder setInclusiveStartPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + inclusiveStartPrimaryKey_ = value; + onChanged(); + return this; + } + public Builder clearInclusiveStartPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000040); + inclusiveStartPrimaryKey_ = getDefaultInstance().getInclusiveStartPrimaryKey(); + onChanged(); + return this; + } + + // required bytes exclusive_end_primary_key = 8; + private com.google.protobuf.ByteString exclusiveEndPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasExclusiveEndPrimaryKey() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public com.google.protobuf.ByteString getExclusiveEndPrimaryKey() { + return exclusiveEndPrimaryKey_; + } + public Builder setExclusiveEndPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000080; + exclusiveEndPrimaryKey_ = value; + onChanged(); + return this; + } + public Builder clearExclusiveEndPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000080); + exclusiveEndPrimaryKey_ = getDefaultInstance().getExclusiveEndPrimaryKey(); + onChanged(); + return this; + } + + // optional bytes filter = 10; + private com.google.protobuf.ByteString filter_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasFilter() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public com.google.protobuf.ByteString getFilter() { + return filter_; + } + public Builder setFilter(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000100; + filter_ = value; + onChanged(); + return this; + } + public Builder clearFilter() { + bitField0_ = (bitField0_ & ~0x00000100); + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + + // optional string start_column = 11; + private java.lang.Object startColumn_ = ""; + public boolean hasStartColumn() { + return ((bitField0_ & 0x00000200) == 0x00000200); + } + public String getStartColumn() { + java.lang.Object ref = startColumn_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + startColumn_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStartColumn(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000200; + startColumn_ = value; + onChanged(); + return this; + } + public Builder clearStartColumn() { + bitField0_ = (bitField0_ & ~0x00000200); + startColumn_ = getDefaultInstance().getStartColumn(); + onChanged(); + return this; + } + void setStartColumn(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000200; + startColumn_ = value; + onChanged(); + } + + // optional string end_column = 12; + private java.lang.Object endColumn_ = ""; + public boolean hasEndColumn() { + return ((bitField0_ & 0x00000400) == 0x00000400); + } + public String getEndColumn() { + java.lang.Object ref = endColumn_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + endColumn_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setEndColumn(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000400; + endColumn_ = value; + onChanged(); + return this; + } + public Builder clearEndColumn() { + bitField0_ = (bitField0_ & ~0x00000400); + endColumn_ = getDefaultInstance().getEndColumn(); + onChanged(); + return this; + } + void setEndColumn(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000400; + endColumn_ = value; + onChanged(); + } + + // optional bytes token = 13; + private com.google.protobuf.ByteString token_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasToken() { + return ((bitField0_ & 0x00000800) == 0x00000800); + } + public com.google.protobuf.ByteString getToken() { + return token_; + } + public Builder setToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000800; + token_ = value; + onChanged(); + return this; + } + public Builder clearToken() { + bitField0_ = (bitField0_ & ~0x00000800); + token_ = getDefaultInstance().getToken(); + onChanged(); + return this; + } + + // optional string transaction_id = 14; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00001000; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00001000); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00001000; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetRangeRequest) + } + + static { + defaultInstance = new GetRangeRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetRangeRequest) + } + + public interface GetRangeResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // required bytes rows = 2; + boolean hasRows(); + com.google.protobuf.ByteString getRows(); + + // optional bytes next_start_primary_key = 3; + boolean hasNextStartPrimaryKey(); + com.google.protobuf.ByteString getNextStartPrimaryKey(); + + // optional bytes next_token = 4; + boolean hasNextToken(); + com.google.protobuf.ByteString getNextToken(); + } + public static final class GetRangeResponse extends + com.google.protobuf.GeneratedMessage + implements GetRangeResponseOrBuilder { + // Use GetRangeResponse.newBuilder() to construct. + private GetRangeResponse(Builder builder) { + super(builder); + } + private GetRangeResponse(boolean noInit) {} + + private static final GetRangeResponse defaultInstance; + public static GetRangeResponse getDefaultInstance() { + return defaultInstance; + } + + public GetRangeResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + public static final int CONSUMED_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // required bytes rows = 2; + public static final int ROWS_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString rows_; + public boolean hasRows() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRows() { + return rows_; + } + + // optional bytes next_start_primary_key = 3; + public static final int NEXT_START_PRIMARY_KEY_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString nextStartPrimaryKey_; + public boolean hasNextStartPrimaryKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getNextStartPrimaryKey() { + return nextStartPrimaryKey_; + } + + // optional bytes next_token = 4; + public static final int NEXT_TOKEN_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString nextToken_; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + + private void initFields() { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + rows_ = com.google.protobuf.ByteString.EMPTY; + nextStartPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + nextToken_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasConsumed()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRows()) { + memoizedIsInitialized = 0; + return false; + } + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, rows_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, nextStartPrimaryKey_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, nextToken_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, consumed_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, rows_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, nextStartPrimaryKey_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, nextToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConsumedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + rows_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + nextStartPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + nextToken_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.rows_ = rows_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.nextStartPrimaryKey_ = nextStartPrimaryKey_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.nextToken_ = nextToken_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse.getDefaultInstance()) return this; + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (other.hasRows()) { + setRows(other.getRows()); + } + if (other.hasNextStartPrimaryKey()) { + setNextStartPrimaryKey(other.getNextStartPrimaryKey()); + } + if (other.hasNextToken()) { + setNextToken(other.getNextToken()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasConsumed()) { + + return false; + } + if (!hasRows()) { + + return false; + } + if (!getConsumed().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + rows_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + nextStartPrimaryKey_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + nextToken_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // required bytes rows = 2; + private com.google.protobuf.ByteString rows_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRows() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRows() { + return rows_; + } + public Builder setRows(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + rows_ = value; + onChanged(); + return this; + } + public Builder clearRows() { + bitField0_ = (bitField0_ & ~0x00000002); + rows_ = getDefaultInstance().getRows(); + onChanged(); + return this; + } + + // optional bytes next_start_primary_key = 3; + private com.google.protobuf.ByteString nextStartPrimaryKey_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasNextStartPrimaryKey() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getNextStartPrimaryKey() { + return nextStartPrimaryKey_; + } + public Builder setNextStartPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + nextStartPrimaryKey_ = value; + onChanged(); + return this; + } + public Builder clearNextStartPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000004); + nextStartPrimaryKey_ = getDefaultInstance().getNextStartPrimaryKey(); + onChanged(); + return this; + } + + // optional bytes next_token = 4; + private com.google.protobuf.ByteString nextToken_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + public Builder setNextToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + nextToken_ = value; + onChanged(); + return this; + } + public Builder clearNextToken() { + bitField0_ = (bitField0_ & ~0x00000008); + nextToken_ = getDefaultInstance().getNextToken(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetRangeResponse) + } + + static { + defaultInstance = new GetRangeResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetRangeResponse) + } + + public interface StartLocalTransactionRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required bytes key = 2; + boolean hasKey(); + com.google.protobuf.ByteString getKey(); + } + public static final class StartLocalTransactionRequest extends + com.google.protobuf.GeneratedMessage + implements StartLocalTransactionRequestOrBuilder { + // Use StartLocalTransactionRequest.newBuilder() to construct. + private StartLocalTransactionRequest(Builder builder) { + super(builder); + } + private StartLocalTransactionRequest(boolean noInit) {} + + private static final StartLocalTransactionRequest defaultInstance; + public static StartLocalTransactionRequest getDefaultInstance() { + return defaultInstance; + } + + public StartLocalTransactionRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required bytes key = 2; + public static final int KEY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString key_; + public boolean hasKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getKey() { + return key_; + } + + private void initFields() { + tableName_ = ""; + key_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasKey()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, key_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, key_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + key_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.key_ = key_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasKey()) { + setKey(other.getKey()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasKey()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + key_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required bytes key = 2; + private com.google.protobuf.ByteString key_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasKey() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getKey() { + return key_; + } + public Builder setKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + key_ = value; + onChanged(); + return this; + } + public Builder clearKey() { + bitField0_ = (bitField0_ & ~0x00000002); + key_ = getDefaultInstance().getKey(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.StartLocalTransactionRequest) + } + + static { + defaultInstance = new StartLocalTransactionRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.StartLocalTransactionRequest) + } + + public interface StartLocalTransactionResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string transaction_id = 1; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class StartLocalTransactionResponse extends + com.google.protobuf.GeneratedMessage + implements StartLocalTransactionResponseOrBuilder { + // Use StartLocalTransactionResponse.newBuilder() to construct. + private StartLocalTransactionResponse(Builder builder) { + super(builder); + } + private StartLocalTransactionResponse(boolean noInit) {} + + private static final StartLocalTransactionResponse defaultInstance; + public static StartLocalTransactionResponse getDefaultInstance() { + return defaultInstance; + } + + public StartLocalTransactionResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string transaction_id = 1; + public static final int TRANSACTION_ID_FIELD_NUMBER = 1; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTransactionId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse.getDefaultInstance()) return this; + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTransactionId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string transaction_id = 1; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000001); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.StartLocalTransactionResponse) + } + + static { + defaultInstance = new StartLocalTransactionResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.StartLocalTransactionResponse) + } + + public interface CommitTransactionRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string transaction_id = 1; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class CommitTransactionRequest extends + com.google.protobuf.GeneratedMessage + implements CommitTransactionRequestOrBuilder { + // Use CommitTransactionRequest.newBuilder() to construct. + private CommitTransactionRequest(Builder builder) { + super(builder); + } + private CommitTransactionRequest(boolean noInit) {} + + private static final CommitTransactionRequest defaultInstance; + public static CommitTransactionRequest getDefaultInstance() { + return defaultInstance; + } + + public CommitTransactionRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string transaction_id = 1; + public static final int TRANSACTION_ID_FIELD_NUMBER = 1; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTransactionId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest.getDefaultInstance()) return this; + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTransactionId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string transaction_id = 1; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000001); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CommitTransactionRequest) + } + + static { + defaultInstance = new CommitTransactionRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CommitTransactionRequest) + } + + public interface CommitTransactionResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class CommitTransactionResponse extends + com.google.protobuf.GeneratedMessage + implements CommitTransactionResponseOrBuilder { + // Use CommitTransactionResponse.newBuilder() to construct. + private CommitTransactionResponse(Builder builder) { + super(builder); + } + private CommitTransactionResponse(boolean noInit) {} + + private static final CommitTransactionResponse defaultInstance; + public static CommitTransactionResponse getDefaultInstance() { + return defaultInstance; + } + + public CommitTransactionResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CommitTransactionResponse) + } + + static { + defaultInstance = new CommitTransactionResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CommitTransactionResponse) + } + + public interface AbortTransactionRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string transaction_id = 1; + boolean hasTransactionId(); + String getTransactionId(); + } + public static final class AbortTransactionRequest extends + com.google.protobuf.GeneratedMessage + implements AbortTransactionRequestOrBuilder { + // Use AbortTransactionRequest.newBuilder() to construct. + private AbortTransactionRequest(Builder builder) { + super(builder); + } + private AbortTransactionRequest(boolean noInit) {} + + private static final AbortTransactionRequest defaultInstance; + public static AbortTransactionRequest getDefaultInstance() { + return defaultInstance; + } + + public AbortTransactionRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string transaction_id = 1; + public static final int TRANSACTION_ID_FIELD_NUMBER = 1; + private java.lang.Object transactionId_; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + transactionId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTransactionIdBytes() { + java.lang.Object ref = transactionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + transactionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + transactionId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTransactionId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTransactionIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTransactionIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + transactionId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.transactionId_ = transactionId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest.getDefaultInstance()) return this; + if (other.hasTransactionId()) { + setTransactionId(other.getTransactionId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTransactionId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + transactionId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string transaction_id = 1; + private java.lang.Object transactionId_ = ""; + public boolean hasTransactionId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTransactionId() { + java.lang.Object ref = transactionId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + transactionId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTransactionId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + return this; + } + public Builder clearTransactionId() { + bitField0_ = (bitField0_ & ~0x00000001); + transactionId_ = getDefaultInstance().getTransactionId(); + onChanged(); + return this; + } + void setTransactionId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + transactionId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.AbortTransactionRequest) + } + + static { + defaultInstance = new AbortTransactionRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.AbortTransactionRequest) + } + + public interface AbortTransactionResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class AbortTransactionResponse extends + com.google.protobuf.GeneratedMessage + implements AbortTransactionResponseOrBuilder { + // Use AbortTransactionResponse.newBuilder() to construct. + private AbortTransactionResponse(Builder builder) { + super(builder); + } + private AbortTransactionResponse(boolean noInit) {} + + private static final AbortTransactionResponse defaultInstance; + public static AbortTransactionResponse getDefaultInstance() { + return defaultInstance; + } + + public AbortTransactionResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.AbortTransactionResponse) + } + + static { + defaultInstance = new AbortTransactionResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.AbortTransactionResponse) + } + + public interface ListStreamRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string table_name = 1; + boolean hasTableName(); + String getTableName(); + } + public static final class ListStreamRequest extends + com.google.protobuf.GeneratedMessage + implements ListStreamRequestOrBuilder { + // Use ListStreamRequest.newBuilder() to construct. + private ListStreamRequest(Builder builder) { + super(builder); + } + private ListStreamRequest(boolean noInit) {} + + private static final ListStreamRequest defaultInstance; + public static ListStreamRequest getDefaultInstance() { + return defaultInstance; + } + + public ListStreamRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_fieldAccessorTable; + } + + private int bitField0_; + // optional string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListStreamRequest) + } + + static { + defaultInstance = new ListStreamRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListStreamRequest) + } + + public interface StreamOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string stream_id = 1; + boolean hasStreamId(); + String getStreamId(); + + // required string table_name = 2; + boolean hasTableName(); + String getTableName(); + + // required int64 creation_time = 3; + boolean hasCreationTime(); + long getCreationTime(); + } + public static final class Stream extends + com.google.protobuf.GeneratedMessage + implements StreamOrBuilder { + // Use Stream.newBuilder() to construct. + private Stream(Builder builder) { + super(builder); + } + private Stream(boolean noInit) {} + + private static final Stream defaultInstance; + public static Stream getDefaultInstance() { + return defaultInstance; + } + + public Stream getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_fieldAccessorTable; + } + + private int bitField0_; + // required string stream_id = 1; + public static final int STREAM_ID_FIELD_NUMBER = 1; + private java.lang.Object streamId_; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + streamId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStreamIdBytes() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + streamId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string table_name = 2; + public static final int TABLE_NAME_FIELD_NUMBER = 2; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int64 creation_time = 3; + public static final int CREATION_TIME_FIELD_NUMBER = 3; + private long creationTime_; + public boolean hasCreationTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getCreationTime() { + return creationTime_; + } + + private void initFields() { + streamId_ = ""; + tableName_ = ""; + creationTime_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasStreamId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCreationTime()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTableNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, creationTime_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTableNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, creationTime_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + streamId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + creationTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.streamId_ = streamId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.creationTime_ = creationTime_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.getDefaultInstance()) return this; + if (other.hasStreamId()) { + setStreamId(other.getStreamId()); + } + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasCreationTime()) { + setCreationTime(other.getCreationTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasStreamId()) { + + return false; + } + if (!hasTableName()) { + + return false; + } + if (!hasCreationTime()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + streamId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + tableName_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + creationTime_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required string stream_id = 1; + private java.lang.Object streamId_ = ""; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + streamId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStreamId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + return this; + } + public Builder clearStreamId() { + bitField0_ = (bitField0_ & ~0x00000001); + streamId_ = getDefaultInstance().getStreamId(); + onChanged(); + return this; + } + void setStreamId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + } + + // required string table_name = 2; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000002); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + tableName_ = value; + onChanged(); + } + + // required int64 creation_time = 3; + private long creationTime_ ; + public boolean hasCreationTime() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getCreationTime() { + return creationTime_; + } + public Builder setCreationTime(long value) { + bitField0_ |= 0x00000004; + creationTime_ = value; + onChanged(); + return this; + } + public Builder clearCreationTime() { + bitField0_ = (bitField0_ & ~0x00000004); + creationTime_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Stream) + } + + static { + defaultInstance = new Stream(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Stream) + } + + public interface ListStreamResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Stream streams = 1; + java.util.List + getStreamsList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream getStreams(int index); + int getStreamsCount(); + java.util.List + getStreamsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamOrBuilder getStreamsOrBuilder( + int index); + } + public static final class ListStreamResponse extends + com.google.protobuf.GeneratedMessage + implements ListStreamResponseOrBuilder { + // Use ListStreamResponse.newBuilder() to construct. + private ListStreamResponse(Builder builder) { + super(builder); + } + private ListStreamResponse(boolean noInit) {} + + private static final ListStreamResponse defaultInstance; + public static ListStreamResponse getDefaultInstance() { + return defaultInstance; + } + + public ListStreamResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Stream streams = 1; + public static final int STREAMS_FIELD_NUMBER = 1; + private java.util.List streams_; + public java.util.List getStreamsList() { + return streams_; + } + public java.util.List + getStreamsOrBuilderList() { + return streams_; + } + public int getStreamsCount() { + return streams_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream getStreams(int index) { + return streams_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamOrBuilder getStreamsOrBuilder( + int index) { + return streams_.get(index); + } + + private void initFields() { + streams_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getStreamsCount(); i++) { + if (!getStreams(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < streams_.size(); i++) { + output.writeMessage(1, streams_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < streams_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, streams_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getStreamsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (streamsBuilder_ == null) { + streams_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + streamsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse(this); + int from_bitField0_ = bitField0_; + if (streamsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + streams_ = java.util.Collections.unmodifiableList(streams_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.streams_ = streams_; + } else { + result.streams_ = streamsBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse.getDefaultInstance()) return this; + if (streamsBuilder_ == null) { + if (!other.streams_.isEmpty()) { + if (streams_.isEmpty()) { + streams_ = other.streams_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureStreamsIsMutable(); + streams_.addAll(other.streams_); + } + onChanged(); + } + } else { + if (!other.streams_.isEmpty()) { + if (streamsBuilder_.isEmpty()) { + streamsBuilder_.dispose(); + streamsBuilder_ = null; + streams_ = other.streams_; + bitField0_ = (bitField0_ & ~0x00000001); + streamsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getStreamsFieldBuilder() : null; + } else { + streamsBuilder_.addAllMessages(other.streams_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getStreamsCount(); i++) { + if (!getStreams(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addStreams(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Stream streams = 1; + private java.util.List streams_ = + java.util.Collections.emptyList(); + private void ensureStreamsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + streams_ = new java.util.ArrayList(streams_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamOrBuilder> streamsBuilder_; + + public java.util.List getStreamsList() { + if (streamsBuilder_ == null) { + return java.util.Collections.unmodifiableList(streams_); + } else { + return streamsBuilder_.getMessageList(); + } + } + public int getStreamsCount() { + if (streamsBuilder_ == null) { + return streams_.size(); + } else { + return streamsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream getStreams(int index) { + if (streamsBuilder_ == null) { + return streams_.get(index); + } else { + return streamsBuilder_.getMessage(index); + } + } + public Builder setStreams( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream value) { + if (streamsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStreamsIsMutable(); + streams_.set(index, value); + onChanged(); + } else { + streamsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setStreams( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder builderForValue) { + if (streamsBuilder_ == null) { + ensureStreamsIsMutable(); + streams_.set(index, builderForValue.build()); + onChanged(); + } else { + streamsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addStreams(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream value) { + if (streamsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStreamsIsMutable(); + streams_.add(value); + onChanged(); + } else { + streamsBuilder_.addMessage(value); + } + return this; + } + public Builder addStreams( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream value) { + if (streamsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStreamsIsMutable(); + streams_.add(index, value); + onChanged(); + } else { + streamsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addStreams( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder builderForValue) { + if (streamsBuilder_ == null) { + ensureStreamsIsMutable(); + streams_.add(builderForValue.build()); + onChanged(); + } else { + streamsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addStreams( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder builderForValue) { + if (streamsBuilder_ == null) { + ensureStreamsIsMutable(); + streams_.add(index, builderForValue.build()); + onChanged(); + } else { + streamsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllStreams( + java.lang.Iterable values) { + if (streamsBuilder_ == null) { + ensureStreamsIsMutable(); + super.addAll(values, streams_); + onChanged(); + } else { + streamsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearStreams() { + if (streamsBuilder_ == null) { + streams_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + streamsBuilder_.clear(); + } + return this; + } + public Builder removeStreams(int index) { + if (streamsBuilder_ == null) { + ensureStreamsIsMutable(); + streams_.remove(index); + onChanged(); + } else { + streamsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder getStreamsBuilder( + int index) { + return getStreamsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamOrBuilder getStreamsOrBuilder( + int index) { + if (streamsBuilder_ == null) { + return streams_.get(index); } else { + return streamsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getStreamsOrBuilderList() { + if (streamsBuilder_ != null) { + return streamsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(streams_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder addStreamsBuilder() { + return getStreamsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder addStreamsBuilder( + int index) { + return getStreamsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.getDefaultInstance()); + } + public java.util.List + getStreamsBuilderList() { + return getStreamsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamOrBuilder> + getStreamsFieldBuilder() { + if (streamsBuilder_ == null) { + streamsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamOrBuilder>( + streams_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + streams_ = null; + } + return streamsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListStreamResponse) + } + + static { + defaultInstance = new ListStreamResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListStreamResponse) + } + + public interface StreamShardOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string shard_id = 1; + boolean hasShardId(); + String getShardId(); + + // optional string parent_id = 2; + boolean hasParentId(); + String getParentId(); + + // optional string parent_sibling_id = 3; + boolean hasParentSiblingId(); + String getParentSiblingId(); + } + public static final class StreamShard extends + com.google.protobuf.GeneratedMessage + implements StreamShardOrBuilder { + // Use StreamShard.newBuilder() to construct. + private StreamShard(Builder builder) { + super(builder); + } + private StreamShard(boolean noInit) {} + + private static final StreamShard defaultInstance; + public static StreamShard getDefaultInstance() { + return defaultInstance; + } + + public StreamShard getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_fieldAccessorTable; + } + + private int bitField0_; + // required string shard_id = 1; + public static final int SHARD_ID_FIELD_NUMBER = 1; + private java.lang.Object shardId_; + public boolean hasShardId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getShardId() { + java.lang.Object ref = shardId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + shardId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getShardIdBytes() { + java.lang.Object ref = shardId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + shardId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string parent_id = 2; + public static final int PARENT_ID_FIELD_NUMBER = 2; + private java.lang.Object parentId_; + public boolean hasParentId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getParentId() { + java.lang.Object ref = parentId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + parentId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getParentIdBytes() { + java.lang.Object ref = parentId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + parentId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string parent_sibling_id = 3; + public static final int PARENT_SIBLING_ID_FIELD_NUMBER = 3; + private java.lang.Object parentSiblingId_; + public boolean hasParentSiblingId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getParentSiblingId() { + java.lang.Object ref = parentSiblingId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + parentSiblingId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getParentSiblingIdBytes() { + java.lang.Object ref = parentSiblingId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + parentSiblingId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + shardId_ = ""; + parentId_ = ""; + parentSiblingId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasShardId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getShardIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getParentIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getParentSiblingIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getShardIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getParentIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getParentSiblingIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShardOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + shardId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + parentId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + parentSiblingId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.shardId_ = shardId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.parentId_ = parentId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.parentSiblingId_ = parentSiblingId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.getDefaultInstance()) return this; + if (other.hasShardId()) { + setShardId(other.getShardId()); + } + if (other.hasParentId()) { + setParentId(other.getParentId()); + } + if (other.hasParentSiblingId()) { + setParentSiblingId(other.getParentSiblingId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasShardId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + shardId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + parentId_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + parentSiblingId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string shard_id = 1; + private java.lang.Object shardId_ = ""; + public boolean hasShardId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getShardId() { + java.lang.Object ref = shardId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + shardId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setShardId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + shardId_ = value; + onChanged(); + return this; + } + public Builder clearShardId() { + bitField0_ = (bitField0_ & ~0x00000001); + shardId_ = getDefaultInstance().getShardId(); + onChanged(); + return this; + } + void setShardId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + shardId_ = value; + onChanged(); + } + + // optional string parent_id = 2; + private java.lang.Object parentId_ = ""; + public boolean hasParentId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getParentId() { + java.lang.Object ref = parentId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + parentId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setParentId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + parentId_ = value; + onChanged(); + return this; + } + public Builder clearParentId() { + bitField0_ = (bitField0_ & ~0x00000002); + parentId_ = getDefaultInstance().getParentId(); + onChanged(); + return this; + } + void setParentId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + parentId_ = value; + onChanged(); + } + + // optional string parent_sibling_id = 3; + private java.lang.Object parentSiblingId_ = ""; + public boolean hasParentSiblingId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getParentSiblingId() { + java.lang.Object ref = parentSiblingId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + parentSiblingId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setParentSiblingId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + parentSiblingId_ = value; + onChanged(); + return this; + } + public Builder clearParentSiblingId() { + bitField0_ = (bitField0_ & ~0x00000004); + parentSiblingId_ = getDefaultInstance().getParentSiblingId(); + onChanged(); + return this; + } + void setParentSiblingId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + parentSiblingId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.StreamShard) + } + + static { + defaultInstance = new StreamShard(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.StreamShard) + } + + public interface DescribeStreamRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string stream_id = 1; + boolean hasStreamId(); + String getStreamId(); + + // optional string inclusive_start_shard_id = 2; + boolean hasInclusiveStartShardId(); + String getInclusiveStartShardId(); + + // optional int32 shard_limit = 3; + boolean hasShardLimit(); + int getShardLimit(); + } + public static final class DescribeStreamRequest extends + com.google.protobuf.GeneratedMessage + implements DescribeStreamRequestOrBuilder { + // Use DescribeStreamRequest.newBuilder() to construct. + private DescribeStreamRequest(Builder builder) { + super(builder); + } + private DescribeStreamRequest(boolean noInit) {} + + private static final DescribeStreamRequest defaultInstance; + public static DescribeStreamRequest getDefaultInstance() { + return defaultInstance; + } + + public DescribeStreamRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string stream_id = 1; + public static final int STREAM_ID_FIELD_NUMBER = 1; + private java.lang.Object streamId_; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + streamId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStreamIdBytes() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + streamId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string inclusive_start_shard_id = 2; + public static final int INCLUSIVE_START_SHARD_ID_FIELD_NUMBER = 2; + private java.lang.Object inclusiveStartShardId_; + public boolean hasInclusiveStartShardId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getInclusiveStartShardId() { + java.lang.Object ref = inclusiveStartShardId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + inclusiveStartShardId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getInclusiveStartShardIdBytes() { + java.lang.Object ref = inclusiveStartShardId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + inclusiveStartShardId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int32 shard_limit = 3; + public static final int SHARD_LIMIT_FIELD_NUMBER = 3; + private int shardLimit_; + public boolean hasShardLimit() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getShardLimit() { + return shardLimit_; + } + + private void initFields() { + streamId_ = ""; + inclusiveStartShardId_ = ""; + shardLimit_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasStreamId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getInclusiveStartShardIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(3, shardLimit_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getInclusiveStartShardIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, shardLimit_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + streamId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + inclusiveStartShardId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + shardLimit_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.streamId_ = streamId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.inclusiveStartShardId_ = inclusiveStartShardId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.shardLimit_ = shardLimit_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest.getDefaultInstance()) return this; + if (other.hasStreamId()) { + setStreamId(other.getStreamId()); + } + if (other.hasInclusiveStartShardId()) { + setInclusiveStartShardId(other.getInclusiveStartShardId()); + } + if (other.hasShardLimit()) { + setShardLimit(other.getShardLimit()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasStreamId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + streamId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + inclusiveStartShardId_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + shardLimit_ = input.readInt32(); + break; + } + } + } + } + + private int bitField0_; + + // required string stream_id = 1; + private java.lang.Object streamId_ = ""; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + streamId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStreamId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + return this; + } + public Builder clearStreamId() { + bitField0_ = (bitField0_ & ~0x00000001); + streamId_ = getDefaultInstance().getStreamId(); + onChanged(); + return this; + } + void setStreamId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + } + + // optional string inclusive_start_shard_id = 2; + private java.lang.Object inclusiveStartShardId_ = ""; + public boolean hasInclusiveStartShardId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getInclusiveStartShardId() { + java.lang.Object ref = inclusiveStartShardId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + inclusiveStartShardId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setInclusiveStartShardId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + inclusiveStartShardId_ = value; + onChanged(); + return this; + } + public Builder clearInclusiveStartShardId() { + bitField0_ = (bitField0_ & ~0x00000002); + inclusiveStartShardId_ = getDefaultInstance().getInclusiveStartShardId(); + onChanged(); + return this; + } + void setInclusiveStartShardId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + inclusiveStartShardId_ = value; + onChanged(); + } + + // optional int32 shard_limit = 3; + private int shardLimit_ ; + public boolean hasShardLimit() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getShardLimit() { + return shardLimit_; + } + public Builder setShardLimit(int value) { + bitField0_ |= 0x00000004; + shardLimit_ = value; + onChanged(); + return this; + } + public Builder clearShardLimit() { + bitField0_ = (bitField0_ & ~0x00000004); + shardLimit_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeStreamRequest) + } + + static { + defaultInstance = new DescribeStreamRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeStreamRequest) + } + + public interface DescribeStreamResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string stream_id = 1; + boolean hasStreamId(); + String getStreamId(); + + // required int32 expiration_time = 2; + boolean hasExpirationTime(); + int getExpirationTime(); + + // required string table_name = 3; + boolean hasTableName(); + String getTableName(); + + // required int64 creation_time = 4; + boolean hasCreationTime(); + long getCreationTime(); + + // required .com.alicloud.openservices.tablestore.core.protocol.StreamStatus stream_status = 5; + boolean hasStreamStatus(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus getStreamStatus(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.StreamShard shards = 6; + java.util.List + getShardsList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard getShards(int index); + int getShardsCount(); + java.util.List + getShardsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShardOrBuilder getShardsOrBuilder( + int index); + + // optional string next_shard_id = 7; + boolean hasNextShardId(); + String getNextShardId(); + } + public static final class DescribeStreamResponse extends + com.google.protobuf.GeneratedMessage + implements DescribeStreamResponseOrBuilder { + // Use DescribeStreamResponse.newBuilder() to construct. + private DescribeStreamResponse(Builder builder) { + super(builder); + } + private DescribeStreamResponse(boolean noInit) {} + + private static final DescribeStreamResponse defaultInstance; + public static DescribeStreamResponse getDefaultInstance() { + return defaultInstance; + } + + public DescribeStreamResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string stream_id = 1; + public static final int STREAM_ID_FIELD_NUMBER = 1; + private java.lang.Object streamId_; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + streamId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStreamIdBytes() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + streamId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int32 expiration_time = 2; + public static final int EXPIRATION_TIME_FIELD_NUMBER = 2; + private int expirationTime_; + public boolean hasExpirationTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getExpirationTime() { + return expirationTime_; + } + + // required string table_name = 3; + public static final int TABLE_NAME_FIELD_NUMBER = 3; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int64 creation_time = 4; + public static final int CREATION_TIME_FIELD_NUMBER = 4; + private long creationTime_; + public boolean hasCreationTime() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getCreationTime() { + return creationTime_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.StreamStatus stream_status = 5; + public static final int STREAM_STATUS_FIELD_NUMBER = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus streamStatus_; + public boolean hasStreamStatus() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus getStreamStatus() { + return streamStatus_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.StreamShard shards = 6; + public static final int SHARDS_FIELD_NUMBER = 6; + private java.util.List shards_; + public java.util.List getShardsList() { + return shards_; + } + public java.util.List + getShardsOrBuilderList() { + return shards_; + } + public int getShardsCount() { + return shards_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard getShards(int index) { + return shards_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShardOrBuilder getShardsOrBuilder( + int index) { + return shards_.get(index); + } + + // optional string next_shard_id = 7; + public static final int NEXT_SHARD_ID_FIELD_NUMBER = 7; + private java.lang.Object nextShardId_; + public boolean hasNextShardId() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public String getNextShardId() { + java.lang.Object ref = nextShardId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + nextShardId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNextShardIdBytes() { + java.lang.Object ref = nextShardId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + nextShardId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + streamId_ = ""; + expirationTime_ = 0; + tableName_ = ""; + creationTime_ = 0L; + streamStatus_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus.STREAM_ENABLING; + shards_ = java.util.Collections.emptyList(); + nextShardId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasStreamId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasExpirationTime()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCreationTime()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasStreamStatus()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getShardsCount(); i++) { + if (!getShards(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(2, expirationTime_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTableNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt64(4, creationTime_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeEnum(5, streamStatus_.getNumber()); + } + for (int i = 0; i < shards_.size(); i++) { + output.writeMessage(6, shards_.get(i)); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(7, getNextShardIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, expirationTime_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTableNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(4, creationTime_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(5, streamStatus_.getNumber()); + } + for (int i = 0; i < shards_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, shards_.get(i)); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(7, getNextShardIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getShardsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + streamId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + expirationTime_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + creationTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000008); + streamStatus_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus.STREAM_ENABLING; + bitField0_ = (bitField0_ & ~0x00000010); + if (shardsBuilder_ == null) { + shards_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + } else { + shardsBuilder_.clear(); + } + nextShardId_ = ""; + bitField0_ = (bitField0_ & ~0x00000040); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.streamId_ = streamId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.expirationTime_ = expirationTime_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.creationTime_ = creationTime_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.streamStatus_ = streamStatus_; + if (shardsBuilder_ == null) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { + shards_ = java.util.Collections.unmodifiableList(shards_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.shards_ = shards_; + } else { + result.shards_ = shardsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000020; + } + result.nextShardId_ = nextShardId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse.getDefaultInstance()) return this; + if (other.hasStreamId()) { + setStreamId(other.getStreamId()); + } + if (other.hasExpirationTime()) { + setExpirationTime(other.getExpirationTime()); + } + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasCreationTime()) { + setCreationTime(other.getCreationTime()); + } + if (other.hasStreamStatus()) { + setStreamStatus(other.getStreamStatus()); + } + if (shardsBuilder_ == null) { + if (!other.shards_.isEmpty()) { + if (shards_.isEmpty()) { + shards_ = other.shards_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureShardsIsMutable(); + shards_.addAll(other.shards_); + } + onChanged(); + } + } else { + if (!other.shards_.isEmpty()) { + if (shardsBuilder_.isEmpty()) { + shardsBuilder_.dispose(); + shardsBuilder_ = null; + shards_ = other.shards_; + bitField0_ = (bitField0_ & ~0x00000020); + shardsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getShardsFieldBuilder() : null; + } else { + shardsBuilder_.addAllMessages(other.shards_); + } + } + } + if (other.hasNextShardId()) { + setNextShardId(other.getNextShardId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasStreamId()) { + + return false; + } + if (!hasExpirationTime()) { + + return false; + } + if (!hasTableName()) { + + return false; + } + if (!hasCreationTime()) { + + return false; + } + if (!hasStreamStatus()) { + + return false; + } + for (int i = 0; i < getShardsCount(); i++) { + if (!getShards(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + streamId_ = input.readBytes(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + expirationTime_ = input.readInt32(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + tableName_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + creationTime_ = input.readInt64(); + break; + } + case 40: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(5, rawValue); + } else { + bitField0_ |= 0x00000010; + streamStatus_ = value; + } + break; + } + case 50: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addShards(subBuilder.buildPartial()); + break; + } + case 58: { + bitField0_ |= 0x00000040; + nextShardId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string stream_id = 1; + private java.lang.Object streamId_ = ""; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + streamId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStreamId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + return this; + } + public Builder clearStreamId() { + bitField0_ = (bitField0_ & ~0x00000001); + streamId_ = getDefaultInstance().getStreamId(); + onChanged(); + return this; + } + void setStreamId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + } + + // required int32 expiration_time = 2; + private int expirationTime_ ; + public boolean hasExpirationTime() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getExpirationTime() { + return expirationTime_; + } + public Builder setExpirationTime(int value) { + bitField0_ |= 0x00000002; + expirationTime_ = value; + onChanged(); + return this; + } + public Builder clearExpirationTime() { + bitField0_ = (bitField0_ & ~0x00000002); + expirationTime_ = 0; + onChanged(); + return this; + } + + // required string table_name = 3; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000004); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + tableName_ = value; + onChanged(); + } + + // required int64 creation_time = 4; + private long creationTime_ ; + public boolean hasCreationTime() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getCreationTime() { + return creationTime_; + } + public Builder setCreationTime(long value) { + bitField0_ |= 0x00000008; + creationTime_ = value; + onChanged(); + return this; + } + public Builder clearCreationTime() { + bitField0_ = (bitField0_ & ~0x00000008); + creationTime_ = 0L; + onChanged(); + return this; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.StreamStatus stream_status = 5; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus streamStatus_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus.STREAM_ENABLING; + public boolean hasStreamStatus() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus getStreamStatus() { + return streamStatus_; + } + public Builder setStreamStatus(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + streamStatus_ = value; + onChanged(); + return this; + } + public Builder clearStreamStatus() { + bitField0_ = (bitField0_ & ~0x00000010); + streamStatus_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamStatus.STREAM_ENABLING; + onChanged(); + return this; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.StreamShard shards = 6; + private java.util.List shards_ = + java.util.Collections.emptyList(); + private void ensureShardsIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + shards_ = new java.util.ArrayList(shards_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShardOrBuilder> shardsBuilder_; + + public java.util.List getShardsList() { + if (shardsBuilder_ == null) { + return java.util.Collections.unmodifiableList(shards_); + } else { + return shardsBuilder_.getMessageList(); + } + } + public int getShardsCount() { + if (shardsBuilder_ == null) { + return shards_.size(); + } else { + return shardsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard getShards(int index) { + if (shardsBuilder_ == null) { + return shards_.get(index); + } else { + return shardsBuilder_.getMessage(index); + } + } + public Builder setShards( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard value) { + if (shardsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureShardsIsMutable(); + shards_.set(index, value); + onChanged(); + } else { + shardsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setShards( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder builderForValue) { + if (shardsBuilder_ == null) { + ensureShardsIsMutable(); + shards_.set(index, builderForValue.build()); + onChanged(); + } else { + shardsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addShards(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard value) { + if (shardsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureShardsIsMutable(); + shards_.add(value); + onChanged(); + } else { + shardsBuilder_.addMessage(value); + } + return this; + } + public Builder addShards( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard value) { + if (shardsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureShardsIsMutable(); + shards_.add(index, value); + onChanged(); + } else { + shardsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addShards( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder builderForValue) { + if (shardsBuilder_ == null) { + ensureShardsIsMutable(); + shards_.add(builderForValue.build()); + onChanged(); + } else { + shardsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addShards( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder builderForValue) { + if (shardsBuilder_ == null) { + ensureShardsIsMutable(); + shards_.add(index, builderForValue.build()); + onChanged(); + } else { + shardsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllShards( + java.lang.Iterable values) { + if (shardsBuilder_ == null) { + ensureShardsIsMutable(); + super.addAll(values, shards_); + onChanged(); + } else { + shardsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearShards() { + if (shardsBuilder_ == null) { + shards_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + shardsBuilder_.clear(); + } + return this; + } + public Builder removeShards(int index) { + if (shardsBuilder_ == null) { + ensureShardsIsMutable(); + shards_.remove(index); + onChanged(); + } else { + shardsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder getShardsBuilder( + int index) { + return getShardsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShardOrBuilder getShardsOrBuilder( + int index) { + if (shardsBuilder_ == null) { + return shards_.get(index); } else { + return shardsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getShardsOrBuilderList() { + if (shardsBuilder_ != null) { + return shardsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(shards_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder addShardsBuilder() { + return getShardsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder addShardsBuilder( + int index) { + return getShardsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.getDefaultInstance()); + } + public java.util.List + getShardsBuilderList() { + return getShardsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShardOrBuilder> + getShardsFieldBuilder() { + if (shardsBuilder_ == null) { + shardsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShardOrBuilder>( + shards_, + ((bitField0_ & 0x00000020) == 0x00000020), + getParentForChildren(), + isClean()); + shards_ = null; + } + return shardsBuilder_; + } + + // optional string next_shard_id = 7; + private java.lang.Object nextShardId_ = ""; + public boolean hasNextShardId() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public String getNextShardId() { + java.lang.Object ref = nextShardId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + nextShardId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setNextShardId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + nextShardId_ = value; + onChanged(); + return this; + } + public Builder clearNextShardId() { + bitField0_ = (bitField0_ & ~0x00000040); + nextShardId_ = getDefaultInstance().getNextShardId(); + onChanged(); + return this; + } + void setNextShardId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000040; + nextShardId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeStreamResponse) + } + + static { + defaultInstance = new DescribeStreamResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeStreamResponse) + } + + public interface GetShardIteratorRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string stream_id = 1; + boolean hasStreamId(); + String getStreamId(); + + // required string shard_id = 2; + boolean hasShardId(); + String getShardId(); + } + public static final class GetShardIteratorRequest extends + com.google.protobuf.GeneratedMessage + implements GetShardIteratorRequestOrBuilder { + // Use GetShardIteratorRequest.newBuilder() to construct. + private GetShardIteratorRequest(Builder builder) { + super(builder); + } + private GetShardIteratorRequest(boolean noInit) {} + + private static final GetShardIteratorRequest defaultInstance; + public static GetShardIteratorRequest getDefaultInstance() { + return defaultInstance; + } + + public GetShardIteratorRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string stream_id = 1; + public static final int STREAM_ID_FIELD_NUMBER = 1; + private java.lang.Object streamId_; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + streamId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStreamIdBytes() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + streamId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string shard_id = 2; + public static final int SHARD_ID_FIELD_NUMBER = 2; + private java.lang.Object shardId_; + public boolean hasShardId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getShardId() { + java.lang.Object ref = shardId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + shardId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getShardIdBytes() { + java.lang.Object ref = shardId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + shardId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + streamId_ = ""; + shardId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasStreamId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasShardId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getShardIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getShardIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + streamId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + shardId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.streamId_ = streamId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.shardId_ = shardId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest.getDefaultInstance()) return this; + if (other.hasStreamId()) { + setStreamId(other.getStreamId()); + } + if (other.hasShardId()) { + setShardId(other.getShardId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasStreamId()) { + + return false; + } + if (!hasShardId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + streamId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + shardId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string stream_id = 1; + private java.lang.Object streamId_ = ""; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + streamId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStreamId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + return this; + } + public Builder clearStreamId() { + bitField0_ = (bitField0_ & ~0x00000001); + streamId_ = getDefaultInstance().getStreamId(); + onChanged(); + return this; + } + void setStreamId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + streamId_ = value; + onChanged(); + } + + // required string shard_id = 2; + private java.lang.Object shardId_ = ""; + public boolean hasShardId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getShardId() { + java.lang.Object ref = shardId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + shardId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setShardId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + shardId_ = value; + onChanged(); + return this; + } + public Builder clearShardId() { + bitField0_ = (bitField0_ & ~0x00000002); + shardId_ = getDefaultInstance().getShardId(); + onChanged(); + return this; + } + void setShardId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + shardId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetShardIteratorRequest) + } + + static { + defaultInstance = new GetShardIteratorRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetShardIteratorRequest) + } + + public interface GetShardIteratorResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string shard_iterator = 1; + boolean hasShardIterator(); + String getShardIterator(); + } + public static final class GetShardIteratorResponse extends + com.google.protobuf.GeneratedMessage + implements GetShardIteratorResponseOrBuilder { + // Use GetShardIteratorResponse.newBuilder() to construct. + private GetShardIteratorResponse(Builder builder) { + super(builder); + } + private GetShardIteratorResponse(boolean noInit) {} + + private static final GetShardIteratorResponse defaultInstance; + public static GetShardIteratorResponse getDefaultInstance() { + return defaultInstance; + } + + public GetShardIteratorResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string shard_iterator = 1; + public static final int SHARD_ITERATOR_FIELD_NUMBER = 1; + private java.lang.Object shardIterator_; + public boolean hasShardIterator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getShardIterator() { + java.lang.Object ref = shardIterator_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + shardIterator_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getShardIteratorBytes() { + java.lang.Object ref = shardIterator_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + shardIterator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + shardIterator_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasShardIterator()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getShardIteratorBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getShardIteratorBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + shardIterator_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.shardIterator_ = shardIterator_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse.getDefaultInstance()) return this; + if (other.hasShardIterator()) { + setShardIterator(other.getShardIterator()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasShardIterator()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + shardIterator_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string shard_iterator = 1; + private java.lang.Object shardIterator_ = ""; + public boolean hasShardIterator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getShardIterator() { + java.lang.Object ref = shardIterator_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + shardIterator_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setShardIterator(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + shardIterator_ = value; + onChanged(); + return this; + } + public Builder clearShardIterator() { + bitField0_ = (bitField0_ & ~0x00000001); + shardIterator_ = getDefaultInstance().getShardIterator(); + onChanged(); + return this; + } + void setShardIterator(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + shardIterator_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetShardIteratorResponse) + } + + static { + defaultInstance = new GetShardIteratorResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetShardIteratorResponse) + } + + public interface GetStreamRecordRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string shard_iterator = 1; + boolean hasShardIterator(); + String getShardIterator(); + + // optional int32 limit = 2; + boolean hasLimit(); + int getLimit(); + } + public static final class GetStreamRecordRequest extends + com.google.protobuf.GeneratedMessage + implements GetStreamRecordRequestOrBuilder { + // Use GetStreamRecordRequest.newBuilder() to construct. + private GetStreamRecordRequest(Builder builder) { + super(builder); + } + private GetStreamRecordRequest(boolean noInit) {} + + private static final GetStreamRecordRequest defaultInstance; + public static GetStreamRecordRequest getDefaultInstance() { + return defaultInstance; + } + + public GetStreamRecordRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string shard_iterator = 1; + public static final int SHARD_ITERATOR_FIELD_NUMBER = 1; + private java.lang.Object shardIterator_; + public boolean hasShardIterator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getShardIterator() { + java.lang.Object ref = shardIterator_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + shardIterator_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getShardIteratorBytes() { + java.lang.Object ref = shardIterator_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + shardIterator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int32 limit = 2; + public static final int LIMIT_FIELD_NUMBER = 2; + private int limit_; + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getLimit() { + return limit_; + } + + private void initFields() { + shardIterator_ = ""; + limit_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasShardIterator()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getShardIteratorBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(2, limit_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getShardIteratorBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, limit_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + shardIterator_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + limit_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.shardIterator_ = shardIterator_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.limit_ = limit_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest.getDefaultInstance()) return this; + if (other.hasShardIterator()) { + setShardIterator(other.getShardIterator()); + } + if (other.hasLimit()) { + setLimit(other.getLimit()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasShardIterator()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + shardIterator_ = input.readBytes(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + limit_ = input.readInt32(); + break; + } + } + } + } + + private int bitField0_; + + // required string shard_iterator = 1; + private java.lang.Object shardIterator_ = ""; + public boolean hasShardIterator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getShardIterator() { + java.lang.Object ref = shardIterator_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + shardIterator_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setShardIterator(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + shardIterator_ = value; + onChanged(); + return this; + } + public Builder clearShardIterator() { + bitField0_ = (bitField0_ & ~0x00000001); + shardIterator_ = getDefaultInstance().getShardIterator(); + onChanged(); + return this; + } + void setShardIterator(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + shardIterator_ = value; + onChanged(); + } + + // optional int32 limit = 2; + private int limit_ ; + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getLimit() { + return limit_; + } + public Builder setLimit(int value) { + bitField0_ |= 0x00000002; + limit_ = value; + onChanged(); + return this; + } + public Builder clearLimit() { + bitField0_ = (bitField0_ & ~0x00000002); + limit_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordRequest) + } + + static { + defaultInstance = new GetStreamRecordRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordRequest) + } + + public interface GetStreamRecordResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordResponse.StreamRecord stream_records = 1; + java.util.List + getStreamRecordsList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord getStreamRecords(int index); + int getStreamRecordsCount(); + java.util.List + getStreamRecordsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecordOrBuilder getStreamRecordsOrBuilder( + int index); + + // optional string next_shard_iterator = 2; + boolean hasNextShardIterator(); + String getNextShardIterator(); + } + public static final class GetStreamRecordResponse extends + com.google.protobuf.GeneratedMessage + implements GetStreamRecordResponseOrBuilder { + // Use GetStreamRecordResponse.newBuilder() to construct. + private GetStreamRecordResponse(Builder builder) { + super(builder); + } + private GetStreamRecordResponse(boolean noInit) {} + + private static final GetStreamRecordResponse defaultInstance; + public static GetStreamRecordResponse getDefaultInstance() { + return defaultInstance; + } + + public GetStreamRecordResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_fieldAccessorTable; + } + + public interface StreamRecordOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ActionType action_type = 1; + boolean hasActionType(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType getActionType(); + + // required bytes record = 2; + boolean hasRecord(); + com.google.protobuf.ByteString getRecord(); + } + public static final class StreamRecord extends + com.google.protobuf.GeneratedMessage + implements StreamRecordOrBuilder { + // Use StreamRecord.newBuilder() to construct. + private StreamRecord(Builder builder) { + super(builder); + } + private StreamRecord(boolean noInit) {} + + private static final StreamRecord defaultInstance; + public static StreamRecord getDefaultInstance() { + return defaultInstance; + } + + public StreamRecord getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ActionType action_type = 1; + public static final int ACTION_TYPE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType actionType_; + public boolean hasActionType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType getActionType() { + return actionType_; + } + + // required bytes record = 2; + public static final int RECORD_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString record_; + public boolean hasRecord() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRecord() { + return record_; + } + + private void initFields() { + actionType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType.PUT_ROW; + record_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasActionType()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRecord()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, actionType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, record_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, actionType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, record_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecordOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + actionType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType.PUT_ROW; + bitField0_ = (bitField0_ & ~0x00000001); + record_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.actionType_ = actionType_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.record_ = record_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.getDefaultInstance()) return this; + if (other.hasActionType()) { + setActionType(other.getActionType()); + } + if (other.hasRecord()) { + setRecord(other.getRecord()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasActionType()) { + + return false; + } + if (!hasRecord()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType value = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + actionType_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + record_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ActionType action_type = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType actionType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType.PUT_ROW; + public boolean hasActionType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType getActionType() { + return actionType_; + } + public Builder setActionType(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + actionType_ = value; + onChanged(); + return this; + } + public Builder clearActionType() { + bitField0_ = (bitField0_ & ~0x00000001); + actionType_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType.PUT_ROW; + onChanged(); + return this; + } + + // required bytes record = 2; + private com.google.protobuf.ByteString record_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRecord() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRecord() { + return record_; + } + public Builder setRecord(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + record_ = value; + onChanged(); + return this; + } + public Builder clearRecord() { + bitField0_ = (bitField0_ & ~0x00000002); + record_ = getDefaultInstance().getRecord(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordResponse.StreamRecord) + } + + static { + defaultInstance = new StreamRecord(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordResponse.StreamRecord) + } + + private int bitField0_; + // repeated .com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordResponse.StreamRecord stream_records = 1; + public static final int STREAM_RECORDS_FIELD_NUMBER = 1; + private java.util.List streamRecords_; + public java.util.List getStreamRecordsList() { + return streamRecords_; + } + public java.util.List + getStreamRecordsOrBuilderList() { + return streamRecords_; + } + public int getStreamRecordsCount() { + return streamRecords_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord getStreamRecords(int index) { + return streamRecords_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecordOrBuilder getStreamRecordsOrBuilder( + int index) { + return streamRecords_.get(index); + } + + // optional string next_shard_iterator = 2; + public static final int NEXT_SHARD_ITERATOR_FIELD_NUMBER = 2; + private java.lang.Object nextShardIterator_; + public boolean hasNextShardIterator() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getNextShardIterator() { + java.lang.Object ref = nextShardIterator_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + nextShardIterator_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNextShardIteratorBytes() { + java.lang.Object ref = nextShardIterator_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + nextShardIterator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + streamRecords_ = java.util.Collections.emptyList(); + nextShardIterator_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getStreamRecordsCount(); i++) { + if (!getStreamRecords(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < streamRecords_.size(); i++) { + output.writeMessage(1, streamRecords_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(2, getNextShardIteratorBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < streamRecords_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, streamRecords_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getNextShardIteratorBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getStreamRecordsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (streamRecordsBuilder_ == null) { + streamRecords_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + streamRecordsBuilder_.clear(); + } + nextShardIterator_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (streamRecordsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + streamRecords_ = java.util.Collections.unmodifiableList(streamRecords_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.streamRecords_ = streamRecords_; + } else { + result.streamRecords_ = streamRecordsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000001; + } + result.nextShardIterator_ = nextShardIterator_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.getDefaultInstance()) return this; + if (streamRecordsBuilder_ == null) { + if (!other.streamRecords_.isEmpty()) { + if (streamRecords_.isEmpty()) { + streamRecords_ = other.streamRecords_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureStreamRecordsIsMutable(); + streamRecords_.addAll(other.streamRecords_); + } + onChanged(); + } + } else { + if (!other.streamRecords_.isEmpty()) { + if (streamRecordsBuilder_.isEmpty()) { + streamRecordsBuilder_.dispose(); + streamRecordsBuilder_ = null; + streamRecords_ = other.streamRecords_; + bitField0_ = (bitField0_ & ~0x00000001); + streamRecordsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getStreamRecordsFieldBuilder() : null; + } else { + streamRecordsBuilder_.addAllMessages(other.streamRecords_); + } + } + } + if (other.hasNextShardIterator()) { + setNextShardIterator(other.getNextShardIterator()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getStreamRecordsCount(); i++) { + if (!getStreamRecords(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addStreamRecords(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + nextShardIterator_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordResponse.StreamRecord stream_records = 1; + private java.util.List streamRecords_ = + java.util.Collections.emptyList(); + private void ensureStreamRecordsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + streamRecords_ = new java.util.ArrayList(streamRecords_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecordOrBuilder> streamRecordsBuilder_; + + public java.util.List getStreamRecordsList() { + if (streamRecordsBuilder_ == null) { + return java.util.Collections.unmodifiableList(streamRecords_); + } else { + return streamRecordsBuilder_.getMessageList(); + } + } + public int getStreamRecordsCount() { + if (streamRecordsBuilder_ == null) { + return streamRecords_.size(); + } else { + return streamRecordsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord getStreamRecords(int index) { + if (streamRecordsBuilder_ == null) { + return streamRecords_.get(index); + } else { + return streamRecordsBuilder_.getMessage(index); + } + } + public Builder setStreamRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord value) { + if (streamRecordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStreamRecordsIsMutable(); + streamRecords_.set(index, value); + onChanged(); + } else { + streamRecordsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setStreamRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder builderForValue) { + if (streamRecordsBuilder_ == null) { + ensureStreamRecordsIsMutable(); + streamRecords_.set(index, builderForValue.build()); + onChanged(); + } else { + streamRecordsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addStreamRecords(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord value) { + if (streamRecordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStreamRecordsIsMutable(); + streamRecords_.add(value); + onChanged(); + } else { + streamRecordsBuilder_.addMessage(value); + } + return this; + } + public Builder addStreamRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord value) { + if (streamRecordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureStreamRecordsIsMutable(); + streamRecords_.add(index, value); + onChanged(); + } else { + streamRecordsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addStreamRecords( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder builderForValue) { + if (streamRecordsBuilder_ == null) { + ensureStreamRecordsIsMutable(); + streamRecords_.add(builderForValue.build()); + onChanged(); + } else { + streamRecordsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addStreamRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder builderForValue) { + if (streamRecordsBuilder_ == null) { + ensureStreamRecordsIsMutable(); + streamRecords_.add(index, builderForValue.build()); + onChanged(); + } else { + streamRecordsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllStreamRecords( + java.lang.Iterable values) { + if (streamRecordsBuilder_ == null) { + ensureStreamRecordsIsMutable(); + super.addAll(values, streamRecords_); + onChanged(); + } else { + streamRecordsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearStreamRecords() { + if (streamRecordsBuilder_ == null) { + streamRecords_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + streamRecordsBuilder_.clear(); + } + return this; + } + public Builder removeStreamRecords(int index) { + if (streamRecordsBuilder_ == null) { + ensureStreamRecordsIsMutable(); + streamRecords_.remove(index); + onChanged(); + } else { + streamRecordsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder getStreamRecordsBuilder( + int index) { + return getStreamRecordsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecordOrBuilder getStreamRecordsOrBuilder( + int index) { + if (streamRecordsBuilder_ == null) { + return streamRecords_.get(index); } else { + return streamRecordsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getStreamRecordsOrBuilderList() { + if (streamRecordsBuilder_ != null) { + return streamRecordsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(streamRecords_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder addStreamRecordsBuilder() { + return getStreamRecordsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder addStreamRecordsBuilder( + int index) { + return getStreamRecordsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.getDefaultInstance()); + } + public java.util.List + getStreamRecordsBuilderList() { + return getStreamRecordsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecordOrBuilder> + getStreamRecordsFieldBuilder() { + if (streamRecordsBuilder_ == null) { + streamRecordsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecordOrBuilder>( + streamRecords_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + streamRecords_ = null; + } + return streamRecordsBuilder_; + } + + // optional string next_shard_iterator = 2; + private java.lang.Object nextShardIterator_ = ""; + public boolean hasNextShardIterator() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getNextShardIterator() { + java.lang.Object ref = nextShardIterator_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + nextShardIterator_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setNextShardIterator(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + nextShardIterator_ = value; + onChanged(); + return this; + } + public Builder clearNextShardIterator() { + bitField0_ = (bitField0_ & ~0x00000002); + nextShardIterator_ = getDefaultInstance().getNextShardIterator(); + onChanged(); + return this; + } + void setNextShardIterator(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + nextShardIterator_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordResponse) + } + + static { + defaultInstance = new GetStreamRecordResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetStreamRecordResponse) + } + + public interface ComputeSplitPointsBySizeRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required int64 split_size = 2; + boolean hasSplitSize(); + long getSplitSize(); + + // optional int64 split_size_unit_in_byte = 3; + boolean hasSplitSizeUnitInByte(); + long getSplitSizeUnitInByte(); + } + public static final class ComputeSplitPointsBySizeRequest extends + com.google.protobuf.GeneratedMessage + implements ComputeSplitPointsBySizeRequestOrBuilder { + // Use ComputeSplitPointsBySizeRequest.newBuilder() to construct. + private ComputeSplitPointsBySizeRequest(Builder builder) { + super(builder); + } + private ComputeSplitPointsBySizeRequest(boolean noInit) {} + + private static final ComputeSplitPointsBySizeRequest defaultInstance; + public static ComputeSplitPointsBySizeRequest getDefaultInstance() { + return defaultInstance; + } + + public ComputeSplitPointsBySizeRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int64 split_size = 2; + public static final int SPLIT_SIZE_FIELD_NUMBER = 2; + private long splitSize_; + public boolean hasSplitSize() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getSplitSize() { + return splitSize_; + } + + // optional int64 split_size_unit_in_byte = 3; + public static final int SPLIT_SIZE_UNIT_IN_BYTE_FIELD_NUMBER = 3; + private long splitSizeUnitInByte_; + public boolean hasSplitSizeUnitInByte() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getSplitSizeUnitInByte() { + return splitSizeUnitInByte_; + } + + private void initFields() { + tableName_ = ""; + splitSize_ = 0L; + splitSizeUnitInByte_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasSplitSize()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, splitSize_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, splitSizeUnitInByte_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, splitSize_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, splitSizeUnitInByte_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + splitSize_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + splitSizeUnitInByte_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.splitSize_ = splitSize_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.splitSizeUnitInByte_ = splitSizeUnitInByte_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasSplitSize()) { + setSplitSize(other.getSplitSize()); + } + if (other.hasSplitSizeUnitInByte()) { + setSplitSizeUnitInByte(other.getSplitSizeUnitInByte()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasSplitSize()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + splitSize_ = input.readInt64(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + splitSizeUnitInByte_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required int64 split_size = 2; + private long splitSize_ ; + public boolean hasSplitSize() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getSplitSize() { + return splitSize_; + } + public Builder setSplitSize(long value) { + bitField0_ |= 0x00000002; + splitSize_ = value; + onChanged(); + return this; + } + public Builder clearSplitSize() { + bitField0_ = (bitField0_ & ~0x00000002); + splitSize_ = 0L; + onChanged(); + return this; + } + + // optional int64 split_size_unit_in_byte = 3; + private long splitSizeUnitInByte_ ; + public boolean hasSplitSizeUnitInByte() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getSplitSizeUnitInByte() { + return splitSizeUnitInByte_; + } + public Builder setSplitSizeUnitInByte(long value) { + bitField0_ |= 0x00000004; + splitSizeUnitInByte_ = value; + onChanged(); + return this; + } + public Builder clearSplitSizeUnitInByte() { + bitField0_ = (bitField0_ & ~0x00000004); + splitSizeUnitInByte_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeRequest) + } + + static { + defaultInstance = new ComputeSplitPointsBySizeRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeRequest) + } + + public interface ComputeSplitPointsBySizeResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + boolean hasConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema schema = 2; + java.util.List + getSchemaList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema getSchema(int index); + int getSchemaCount(); + java.util.List + getSchemaOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder getSchemaOrBuilder( + int index); + + // repeated bytes split_points = 3; + java.util.List getSplitPointsList(); + int getSplitPointsCount(); + com.google.protobuf.ByteString getSplitPoints(int index); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeResponse.SplitLocation locations = 4; + java.util.List + getLocationsList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation getLocations(int index); + int getLocationsCount(); + java.util.List + getLocationsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocationOrBuilder getLocationsOrBuilder( + int index); + } + public static final class ComputeSplitPointsBySizeResponse extends + com.google.protobuf.GeneratedMessage + implements ComputeSplitPointsBySizeResponseOrBuilder { + // Use ComputeSplitPointsBySizeResponse.newBuilder() to construct. + private ComputeSplitPointsBySizeResponse(Builder builder) { + super(builder); + } + private ComputeSplitPointsBySizeResponse(boolean noInit) {} + + private static final ComputeSplitPointsBySizeResponse defaultInstance; + public static ComputeSplitPointsBySizeResponse getDefaultInstance() { + return defaultInstance; + } + + public ComputeSplitPointsBySizeResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_fieldAccessorTable; + } + + public interface SplitLocationOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string location = 1; + boolean hasLocation(); + String getLocation(); + + // required sint64 repeat = 2; + boolean hasRepeat(); + long getRepeat(); + } + public static final class SplitLocation extends + com.google.protobuf.GeneratedMessage + implements SplitLocationOrBuilder { + // Use SplitLocation.newBuilder() to construct. + private SplitLocation(Builder builder) { + super(builder); + } + private SplitLocation(boolean noInit) {} + + private static final SplitLocation defaultInstance; + public static SplitLocation getDefaultInstance() { + return defaultInstance; + } + + public SplitLocation getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_fieldAccessorTable; + } + + private int bitField0_; + // required string location = 1; + public static final int LOCATION_FIELD_NUMBER = 1; + private java.lang.Object location_; + public boolean hasLocation() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getLocation() { + java.lang.Object ref = location_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + location_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required sint64 repeat = 2; + public static final int REPEAT_FIELD_NUMBER = 2; + private long repeat_; + public boolean hasRepeat() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getRepeat() { + return repeat_; + } + + private void initFields() { + location_ = ""; + repeat_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasLocation()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRepeat()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getLocationBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeSInt64(2, repeat_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getLocationBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeSInt64Size(2, repeat_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + location_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + repeat_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.location_ = location_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.repeat_ = repeat_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.getDefaultInstance()) return this; + if (other.hasLocation()) { + setLocation(other.getLocation()); + } + if (other.hasRepeat()) { + setRepeat(other.getRepeat()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasLocation()) { + + return false; + } + if (!hasRepeat()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + location_ = input.readBytes(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + repeat_ = input.readSInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required string location = 1; + private java.lang.Object location_ = ""; + public boolean hasLocation() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getLocation() { + java.lang.Object ref = location_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + location_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setLocation(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + location_ = value; + onChanged(); + return this; + } + public Builder clearLocation() { + bitField0_ = (bitField0_ & ~0x00000001); + location_ = getDefaultInstance().getLocation(); + onChanged(); + return this; + } + void setLocation(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + location_ = value; + onChanged(); + } + + // required sint64 repeat = 2; + private long repeat_ ; + public boolean hasRepeat() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getRepeat() { + return repeat_; + } + public Builder setRepeat(long value) { + bitField0_ |= 0x00000002; + repeat_ = value; + onChanged(); + return this; + } + public Builder clearRepeat() { + bitField0_ = (bitField0_ & ~0x00000002); + repeat_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeResponse.SplitLocation) + } + + static { + defaultInstance = new SplitLocation(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeResponse.SplitLocation) + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + public static final int CONSUMED_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + return consumed_; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + return consumed_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema schema = 2; + public static final int SCHEMA_FIELD_NUMBER = 2; + private java.util.List schema_; + public java.util.List getSchemaList() { + return schema_; + } + public java.util.List + getSchemaOrBuilderList() { + return schema_; + } + public int getSchemaCount() { + return schema_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema getSchema(int index) { + return schema_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder getSchemaOrBuilder( + int index) { + return schema_.get(index); + } + + // repeated bytes split_points = 3; + public static final int SPLIT_POINTS_FIELD_NUMBER = 3; + private java.util.List splitPoints_; + public java.util.List + getSplitPointsList() { + return splitPoints_; + } + public int getSplitPointsCount() { + return splitPoints_.size(); + } + public com.google.protobuf.ByteString getSplitPoints(int index) { + return splitPoints_.get(index); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeResponse.SplitLocation locations = 4; + public static final int LOCATIONS_FIELD_NUMBER = 4; + private java.util.List locations_; + public java.util.List getLocationsList() { + return locations_; + } + public java.util.List + getLocationsOrBuilderList() { + return locations_; + } + public int getLocationsCount() { + return locations_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation getLocations(int index) { + return locations_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocationOrBuilder getLocationsOrBuilder( + int index) { + return locations_.get(index); + } + + private void initFields() { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + schema_ = java.util.Collections.emptyList(); + splitPoints_ = java.util.Collections.emptyList();; + locations_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasConsumed()) { + memoizedIsInitialized = 0; + return false; + } + if (!getConsumed().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getSchemaCount(); i++) { + if (!getSchema(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + for (int i = 0; i < getLocationsCount(); i++) { + if (!getLocations(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, consumed_); + } + for (int i = 0; i < schema_.size(); i++) { + output.writeMessage(2, schema_.get(i)); + } + for (int i = 0; i < splitPoints_.size(); i++) { + output.writeBytes(3, splitPoints_.get(i)); + } + for (int i = 0; i < locations_.size(); i++) { + output.writeMessage(4, locations_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, consumed_); + } + for (int i = 0; i < schema_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, schema_.get(i)); + } + { + int dataSize = 0; + for (int i = 0; i < splitPoints_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(splitPoints_.get(i)); + } + size += dataSize; + size += 1 * getSplitPointsList().size(); + } + for (int i = 0; i < locations_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, locations_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getConsumedFieldBuilder(); + getSchemaFieldBuilder(); + getLocationsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (schemaBuilder_ == null) { + schema_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + schemaBuilder_.clear(); + } + splitPoints_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000004); + if (locationsBuilder_ == null) { + locations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + } else { + locationsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse build() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse result = new com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (consumedBuilder_ == null) { + result.consumed_ = consumed_; + } else { + result.consumed_ = consumedBuilder_.build(); + } + if (schemaBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + schema_ = java.util.Collections.unmodifiableList(schema_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.schema_ = schema_; + } else { + result.schema_ = schemaBuilder_.build(); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + splitPoints_ = java.util.Collections.unmodifiableList(splitPoints_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.splitPoints_ = splitPoints_; + if (locationsBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { + locations_ = java.util.Collections.unmodifiableList(locations_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.locations_ = locations_; + } else { + result.locations_ = locationsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.getDefaultInstance()) return this; + if (other.hasConsumed()) { + mergeConsumed(other.getConsumed()); + } + if (schemaBuilder_ == null) { + if (!other.schema_.isEmpty()) { + if (schema_.isEmpty()) { + schema_ = other.schema_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureSchemaIsMutable(); + schema_.addAll(other.schema_); + } + onChanged(); + } + } else { + if (!other.schema_.isEmpty()) { + if (schemaBuilder_.isEmpty()) { + schemaBuilder_.dispose(); + schemaBuilder_ = null; + schema_ = other.schema_; + bitField0_ = (bitField0_ & ~0x00000002); + schemaBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getSchemaFieldBuilder() : null; + } else { + schemaBuilder_.addAllMessages(other.schema_); + } + } + } + if (!other.splitPoints_.isEmpty()) { + if (splitPoints_.isEmpty()) { + splitPoints_ = other.splitPoints_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureSplitPointsIsMutable(); + splitPoints_.addAll(other.splitPoints_); + } + onChanged(); + } + if (locationsBuilder_ == null) { + if (!other.locations_.isEmpty()) { + if (locations_.isEmpty()) { + locations_ = other.locations_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureLocationsIsMutable(); + locations_.addAll(other.locations_); + } + onChanged(); + } + } else { + if (!other.locations_.isEmpty()) { + if (locationsBuilder_.isEmpty()) { + locationsBuilder_.dispose(); + locationsBuilder_ = null; + locations_ = other.locations_; + bitField0_ = (bitField0_ & ~0x00000008); + locationsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getLocationsFieldBuilder() : null; + } else { + locationsBuilder_.addAllMessages(other.locations_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasConsumed()) { + + return false; + } + if (!getConsumed().isInitialized()) { + + return false; + } + for (int i = 0; i < getSchemaCount(); i++) { + if (!getSchema(i).isInitialized()) { + + return false; + } + } + for (int i = 0; i < getLocationsCount(); i++) { + if (!getLocations(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(); + if (hasConsumed()) { + subBuilder.mergeFrom(getConsumed()); + } + input.readMessage(subBuilder, extensionRegistry); + setConsumed(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addSchema(subBuilder.buildPartial()); + break; + } + case 26: { + ensureSplitPointsIsMutable(); + splitPoints_.add(input.readBytes()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addLocations(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ConsumedCapacity consumed = 1; + private com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> consumedBuilder_; + public boolean hasConsumed() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity getConsumed() { + if (consumedBuilder_ == null) { + return consumed_; + } else { + return consumedBuilder_.getMessage(); + } + } + public Builder setConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumed_ = value; + onChanged(); + } else { + consumedBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setConsumed( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder builderForValue) { + if (consumedBuilder_ == null) { + consumed_ = builderForValue.build(); + onChanged(); + } else { + consumedBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeConsumed(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity value) { + if (consumedBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + consumed_ != com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance()) { + consumed_ = + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); + } else { + consumed_ = value; + } + onChanged(); + } else { + consumedBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearConsumed() { + if (consumedBuilder_ == null) { + consumed_ = com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.getDefaultInstance(); + onChanged(); + } else { + consumedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder getConsumedBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumedFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder getConsumedOrBuilder() { + if (consumedBuilder_ != null) { + return consumedBuilder_.getMessageOrBuilder(); + } else { + return consumed_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder> + getConsumedFieldBuilder() { + if (consumedBuilder_ == null) { + consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacityOrBuilder>( + consumed_, + getParentForChildren(), + isClean()); + consumed_ = null; + } + return consumedBuilder_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySchema schema = 2; + private java.util.List schema_ = + java.util.Collections.emptyList(); + private void ensureSchemaIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + schema_ = new java.util.ArrayList(schema_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder> schemaBuilder_; + + public java.util.List getSchemaList() { + if (schemaBuilder_ == null) { + return java.util.Collections.unmodifiableList(schema_); + } else { + return schemaBuilder_.getMessageList(); + } + } + public int getSchemaCount() { + if (schemaBuilder_ == null) { + return schema_.size(); + } else { + return schemaBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema getSchema(int index) { + if (schemaBuilder_ == null) { + return schema_.get(index); + } else { + return schemaBuilder_.getMessage(index); + } + } + public Builder setSchema( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema value) { + if (schemaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchemaIsMutable(); + schema_.set(index, value); + onChanged(); + } else { + schemaBuilder_.setMessage(index, value); + } + return this; + } + public Builder setSchema( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder builderForValue) { + if (schemaBuilder_ == null) { + ensureSchemaIsMutable(); + schema_.set(index, builderForValue.build()); + onChanged(); + } else { + schemaBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addSchema(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema value) { + if (schemaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchemaIsMutable(); + schema_.add(value); + onChanged(); + } else { + schemaBuilder_.addMessage(value); + } + return this; + } + public Builder addSchema( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema value) { + if (schemaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSchemaIsMutable(); + schema_.add(index, value); + onChanged(); + } else { + schemaBuilder_.addMessage(index, value); + } + return this; + } + public Builder addSchema( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder builderForValue) { + if (schemaBuilder_ == null) { + ensureSchemaIsMutable(); + schema_.add(builderForValue.build()); + onChanged(); + } else { + schemaBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addSchema( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder builderForValue) { + if (schemaBuilder_ == null) { + ensureSchemaIsMutable(); + schema_.add(index, builderForValue.build()); + onChanged(); + } else { + schemaBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllSchema( + java.lang.Iterable values) { + if (schemaBuilder_ == null) { + ensureSchemaIsMutable(); + super.addAll(values, schema_); + onChanged(); + } else { + schemaBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearSchema() { + if (schemaBuilder_ == null) { + schema_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + schemaBuilder_.clear(); + } + return this; + } + public Builder removeSchema(int index) { + if (schemaBuilder_ == null) { + ensureSchemaIsMutable(); + schema_.remove(index); + onChanged(); + } else { + schemaBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder getSchemaBuilder( + int index) { + return getSchemaFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder getSchemaOrBuilder( + int index) { + if (schemaBuilder_ == null) { + return schema_.get(index); } else { + return schemaBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getSchemaOrBuilderList() { + if (schemaBuilder_ != null) { + return schemaBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(schema_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder addSchemaBuilder() { + return getSchemaFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder addSchemaBuilder( + int index) { + return getSchemaFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.getDefaultInstance()); + } + public java.util.List + getSchemaBuilderList() { + return getSchemaFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder> + getSchemaFieldBuilder() { + if (schemaBuilder_ == null) { + schemaBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchemaOrBuilder>( + schema_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + schema_ = null; + } + return schemaBuilder_; + } + + // repeated bytes split_points = 3; + private java.util.List splitPoints_ = java.util.Collections.emptyList();; + private void ensureSplitPointsIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + splitPoints_ = new java.util.ArrayList(splitPoints_); + bitField0_ |= 0x00000004; + } + } + public java.util.List + getSplitPointsList() { + return java.util.Collections.unmodifiableList(splitPoints_); + } + public int getSplitPointsCount() { + return splitPoints_.size(); + } + public com.google.protobuf.ByteString getSplitPoints(int index) { + return splitPoints_.get(index); + } + public Builder setSplitPoints( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSplitPointsIsMutable(); + splitPoints_.set(index, value); + onChanged(); + return this; + } + public Builder addSplitPoints(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSplitPointsIsMutable(); + splitPoints_.add(value); + onChanged(); + return this; + } + public Builder addAllSplitPoints( + java.lang.Iterable values) { + ensureSplitPointsIsMutable(); + super.addAll(values, splitPoints_); + onChanged(); + return this; + } + public Builder clearSplitPoints() { + splitPoints_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeResponse.SplitLocation locations = 4; + private java.util.List locations_ = + java.util.Collections.emptyList(); + private void ensureLocationsIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + locations_ = new java.util.ArrayList(locations_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocationOrBuilder> locationsBuilder_; + + public java.util.List getLocationsList() { + if (locationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(locations_); + } else { + return locationsBuilder_.getMessageList(); + } + } + public int getLocationsCount() { + if (locationsBuilder_ == null) { + return locations_.size(); + } else { + return locationsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation getLocations(int index) { + if (locationsBuilder_ == null) { + return locations_.get(index); + } else { + return locationsBuilder_.getMessage(index); + } + } + public Builder setLocations( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation value) { + if (locationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocationsIsMutable(); + locations_.set(index, value); + onChanged(); + } else { + locationsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setLocations( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder builderForValue) { + if (locationsBuilder_ == null) { + ensureLocationsIsMutable(); + locations_.set(index, builderForValue.build()); + onChanged(); + } else { + locationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addLocations(com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation value) { + if (locationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocationsIsMutable(); + locations_.add(value); + onChanged(); + } else { + locationsBuilder_.addMessage(value); + } + return this; + } + public Builder addLocations( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation value) { + if (locationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureLocationsIsMutable(); + locations_.add(index, value); + onChanged(); + } else { + locationsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addLocations( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder builderForValue) { + if (locationsBuilder_ == null) { + ensureLocationsIsMutable(); + locations_.add(builderForValue.build()); + onChanged(); + } else { + locationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addLocations( + int index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder builderForValue) { + if (locationsBuilder_ == null) { + ensureLocationsIsMutable(); + locations_.add(index, builderForValue.build()); + onChanged(); + } else { + locationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllLocations( + java.lang.Iterable values) { + if (locationsBuilder_ == null) { + ensureLocationsIsMutable(); + super.addAll(values, locations_); + onChanged(); + } else { + locationsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearLocations() { + if (locationsBuilder_ == null) { + locations_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + locationsBuilder_.clear(); + } + return this; + } + public Builder removeLocations(int index) { + if (locationsBuilder_ == null) { + ensureLocationsIsMutable(); + locations_.remove(index); + onChanged(); + } else { + locationsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder getLocationsBuilder( + int index) { + return getLocationsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocationOrBuilder getLocationsOrBuilder( + int index) { + if (locationsBuilder_ == null) { + return locations_.get(index); } else { + return locationsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getLocationsOrBuilderList() { + if (locationsBuilder_ != null) { + return locationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(locations_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder addLocationsBuilder() { + return getLocationsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder addLocationsBuilder( + int index) { + return getLocationsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.getDefaultInstance()); + } + public java.util.List + getLocationsBuilderList() { + return getLocationsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocationOrBuilder> + getLocationsFieldBuilder() { + if (locationsBuilder_ == null) { + locationsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder, com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocationOrBuilder>( + locations_, + ((bitField0_ & 0x00000008) == 0x00000008), + getParentForChildren(), + isClean()); + locations_ = null; + } + return locationsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeResponse) + } + + static { + defaultInstance = new ComputeSplitPointsBySizeResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ComputeSplitPointsBySizeResponse) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\026ots_internal_api.proto\0222com.alicloud.o" + + "penservices.tablestore.core.protocol\"&\n\005" + + "Error\022\014\n\004code\030\001 \002(\t\022\017\n\007message\030\002 \001(\t\"\310\001\n" + + "\020PrimaryKeySchema\022\014\n\004name\030\001 \002(\t\022P\n\004type\030" + + "\002 \002(\0162B.com.alicloud.openservices.tables" + + "tore.core.protocol.PrimaryKeyType\022T\n\006opt" + + "ion\030\003 \001(\0162D.com.alicloud.openservices.ta" + + "blestore.core.protocol.PrimaryKeyOption\"" + + "x\n\023DefinedColumnSchema\022\014\n\004name\030\001 \002(\t\022S\n\004" + + "type\030\002 \002(\0162E.com.alicloud.openservices.t", + "ablestore.core.protocol.DefinedColumnTyp" + + "e\"a\n\014TableOptions\022\024\n\014time_to_live\030\001 \001(\005\022" + + "\024\n\014max_versions\030\002 \001(\005\022%\n\035deviation_cell_" + + "version_in_sec\030\005 \001(\003\"\371\001\n\tIndexMeta\022\014\n\004na" + + "me\030\001 \002(\t\022\023\n\013primary_key\030\002 \003(\t\022\026\n\016defined" + + "_column\030\003 \003(\t\022^\n\021index_update_mode\030\004 \002(\016" + + "2C.com.alicloud.openservices.tablestore." + + "core.protocol.IndexUpdateMode\022Q\n\nindex_t" + + "ype\030\005 \002(\0162=.com.alicloud.openservices.ta" + + "blestore.core.protocol.IndexType\"\333\001\n\tTab", + "leMeta\022\022\n\ntable_name\030\001 \002(\t\022Y\n\013primary_ke" + + "y\030\002 \003(\0132D.com.alicloud.openservices.tabl" + + "estore.core.protocol.PrimaryKeySchema\022_\n" + + "\016defined_column\030\003 \003(\0132G.com.alicloud.ope" + + "nservices.tablestore.core.protocol.Defin" + + "edColumnSchema\"\211\001\n\tCondition\022b\n\rrow_exis" + + "tence\030\001 \002(\0162K.com.alicloud.openservices." + + "tablestore.core.protocol.RowExistenceExp" + + "ectation\022\030\n\020column_condition\030\002 \001(\014\"+\n\014Ca" + + "pacityUnit\022\014\n\004read\030\001 \001(\005\022\r\n\005write\030\002 \001(\005\"", + "\254\001\n\031ReservedThroughputDetails\022W\n\rcapacit" + + "y_unit\030\001 \002(\0132@.com.alicloud.openservices" + + ".tablestore.core.protocol.CapacityUnit\022\032" + + "\n\022last_increase_time\030\002 \002(\003\022\032\n\022last_decre" + + "ase_time\030\003 \001(\003\"m\n\022ReservedThroughput\022W\n\r" + + "capacity_unit\030\001 \002(\0132@.com.alicloud.opens" + + "ervices.tablestore.core.protocol.Capacit" + + "yUnit\"k\n\020ConsumedCapacity\022W\n\rcapacity_un" + + "it\030\001 \002(\0132@.com.alicloud.openservices.tab" + + "lestore.core.protocol.CapacityUnit\"E\n\023St", + "reamSpecification\022\025\n\renable_stream\030\001 \002(\010" + + "\022\027\n\017expiration_time\030\002 \001(\005\"l\n\rStreamDetai" + + "ls\022\025\n\renable_stream\030\001 \002(\010\022\021\n\tstream_id\030\002" + + " \001(\t\022\027\n\017expiration_time\030\003 \001(\005\022\030\n\020last_en" + + "able_time\030\004 \001(\003\"\327\003\n\022CreateTableRequest\022Q" + + "\n\ntable_meta\030\001 \002(\0132=.com.alicloud.opense" + + "rvices.tablestore.core.protocol.TableMet" + + "a\022c\n\023reserved_throughput\030\002 \002(\0132F.com.ali" + + "cloud.openservices.tablestore.core.proto" + + "col.ReservedThroughput\022W\n\rtable_options\030", + "\003 \001(\0132@.com.alicloud.openservices.tables" + + "tore.core.protocol.TableOptions\022\\\n\013strea" + + "m_spec\030\005 \001(\0132G.com.alicloud.openservices" + + ".tablestore.core.protocol.StreamSpecific" + + "ation\022R\n\013index_metas\030\007 \003(\0132=.com.aliclou" + + "d.openservices.tablestore.core.protocol." + + "IndexMeta\"\025\n\023CreateTableResponse\"\233\001\n\022Cre" + + "ateIndexRequest\022\027\n\017main_table_name\030\001 \002(\t" + + "\022Q\n\nindex_meta\030\002 \002(\0132=.com.alicloud.open" + + "services.tablestore.core.protocol.IndexM", + "eta\022\031\n\021include_base_data\030\003 \001(\010\"\025\n\023Create" + + "IndexResponse\"?\n\020DropIndexRequest\022\027\n\017mai" + + "n_table_name\030\001 \002(\t\022\022\n\nindex_name\030\002 \002(\t\"\023" + + "\n\021DropIndexResponse\"\304\002\n\022UpdateTableReque" + + "st\022\022\n\ntable_name\030\001 \002(\t\022c\n\023reserved_throu" + + "ghput\030\002 \001(\0132F.com.alicloud.openservices." + + "tablestore.core.protocol.ReservedThrough" + + "put\022W\n\rtable_options\030\003 \001(\0132@.com.aliclou" + + "d.openservices.tablestore.core.protocol." + + "TableOptions\022\\\n\013stream_spec\030\004 \001(\0132G.com.", + "alicloud.openservices.tablestore.core.pr" + + "otocol.StreamSpecification\"\275\002\n\023UpdateTab" + + "leResponse\022r\n\033reserved_throughput_detail" + + "s\030\001 \002(\0132M.com.alicloud.openservices.tabl" + + "estore.core.protocol.ReservedThroughputD" + + "etails\022W\n\rtable_options\030\002 \002(\0132@.com.alic" + + "loud.openservices.tablestore.core.protoc" + + "ol.TableOptions\022Y\n\016stream_details\030\003 \001(\0132" + + "A.com.alicloud.openservices.tablestore.c" + + "ore.protocol.StreamDetails\"*\n\024DescribeTa", + "bleRequest\022\022\n\ntable_name\030\001 \002(\t\"\374\003\n\025Descr" + + "ibeTableResponse\022Q\n\ntable_meta\030\001 \002(\0132=.c" + + "om.alicloud.openservices.tablestore.core" + + ".protocol.TableMeta\022r\n\033reserved_throughp" + + "ut_details\030\002 \002(\0132M.com.alicloud.openserv" + + "ices.tablestore.core.protocol.ReservedTh" + + "roughputDetails\022W\n\rtable_options\030\003 \002(\0132@" + + ".com.alicloud.openservices.tablestore.co" + + "re.protocol.TableOptions\022Y\n\016stream_detai" + + "ls\030\005 \001(\0132A.com.alicloud.openservices.tab", + "lestore.core.protocol.StreamDetails\022\024\n\014s" + + "hard_splits\030\006 \003(\014\022R\n\013index_metas\030\010 \003(\0132=" + + ".com.alicloud.openservices.tablestore.co" + + "re.protocol.IndexMeta\"\022\n\020ListTableReques" + + "t\"(\n\021ListTableResponse\022\023\n\013table_names\030\001 " + + "\003(\t\"(\n\022DeleteTableRequest\022\022\n\ntable_name\030" + + "\001 \002(\t\"\025\n\023DeleteTableResponse\"&\n\020LoadTabl" + + "eRequest\022\022\n\ntable_name\030\001 \002(\t\"\023\n\021LoadTabl" + + "eResponse\"(\n\022UnloadTableRequest\022\022\n\ntable" + + "_name\030\001 \002(\t\"\025\n\023UnloadTableResponse\"H\n\tTi", + "meRange\022\022\n\nstart_time\030\001 \001(\003\022\020\n\010end_time\030" + + "\002 \001(\003\022\025\n\rspecific_time\030\003 \001(\003\"\201\001\n\rReturnC" + + "ontent\022S\n\013return_type\030\001 \001(\0162>.com.aliclo" + + "ud.openservices.tablestore.core.protocol" + + ".ReturnType\022\033\n\023return_column_names\030\002 \003(\t" + + "\"\232\002\n\rGetRowRequest\022\022\n\ntable_name\030\001 \002(\t\022\023" + + "\n\013primary_key\030\002 \002(\014\022\026\n\016columns_to_get\030\003 " + + "\003(\t\022Q\n\ntime_range\030\004 \001(\0132=.com.alicloud.o" + + "penservices.tablestore.core.protocol.Tim" + + "eRange\022\024\n\014max_versions\030\005 \001(\005\022\016\n\006filter\030\007", + " \001(\014\022\024\n\014start_column\030\010 \001(\t\022\022\n\nend_column" + + "\030\t \001(\t\022\r\n\005token\030\n \001(\014\022\026\n\016transaction_id\030" + + "\013 \001(\t\"\211\001\n\016GetRowResponse\022V\n\010consumed\030\001 \002" + + "(\0132D.com.alicloud.openservices.tablestor" + + "e.core.protocol.ConsumedCapacity\022\013\n\003row\030" + + "\002 \002(\014\022\022\n\nnext_token\030\003 \001(\014\"\377\001\n\020UpdateRowR" + + "equest\022\022\n\ntable_name\030\001 \002(\t\022\022\n\nrow_change" + + "\030\002 \002(\014\022P\n\tcondition\030\003 \002(\0132=.com.alicloud" + + ".openservices.tablestore.core.protocol.C" + + "ondition\022Y\n\016return_content\030\004 \001(\0132A.com.a", + "licloud.openservices.tablestore.core.pro" + + "tocol.ReturnContent\022\026\n\016transaction_id\030\005 " + + "\001(\t\"x\n\021UpdateRowResponse\022V\n\010consumed\030\001 \002" + + "(\0132D.com.alicloud.openservices.tablestor" + + "e.core.protocol.ConsumedCapacity\022\013\n\003row\030" + + "\002 \001(\014\"\365\001\n\rPutRowRequest\022\022\n\ntable_name\030\001 " + + "\002(\t\022\013\n\003row\030\002 \002(\014\022P\n\tcondition\030\003 \002(\0132=.co" + + "m.alicloud.openservices.tablestore.core." + + "protocol.Condition\022Y\n\016return_content\030\004 \001" + + "(\0132A.com.alicloud.openservices.tablestor", + "e.core.protocol.ReturnContent\022\026\n\016transac" + + "tion_id\030\005 \001(\t\"u\n\016PutRowResponse\022V\n\010consu" + + "med\030\001 \002(\0132D.com.alicloud.openservices.ta" + + "blestore.core.protocol.ConsumedCapacity\022" + + "\013\n\003row\030\002 \001(\014\"\200\002\n\020DeleteRowRequest\022\022\n\ntab" + + "le_name\030\001 \002(\t\022\023\n\013primary_key\030\002 \002(\014\022P\n\tco" + + "ndition\030\003 \002(\0132=.com.alicloud.openservice" + + "s.tablestore.core.protocol.Condition\022Y\n\016" + + "return_content\030\004 \001(\0132A.com.alicloud.open" + + "services.tablestore.core.protocol.Return", + "Content\022\026\n\016transaction_id\030\005 \001(\t\"x\n\021Delet" + + "eRowResponse\022V\n\010consumed\030\001 \002(\0132D.com.ali" + + "cloud.openservices.tablestore.core.proto" + + "col.ConsumedCapacity\022\013\n\003row\030\002 \001(\014\"\216\002\n\031Ta" + + "bleInBatchGetRowRequest\022\022\n\ntable_name\030\001 " + + "\002(\t\022\023\n\013primary_key\030\002 \003(\014\022\r\n\005token\030\003 \003(\014\022" + + "\026\n\016columns_to_get\030\004 \003(\t\022Q\n\ntime_range\030\005 " + + "\001(\0132=.com.alicloud.openservices.tablesto" + + "re.core.protocol.TimeRange\022\024\n\014max_versio" + + "ns\030\006 \001(\005\022\016\n\006filter\030\010 \001(\014\022\024\n\014start_column", + "\030\t \001(\t\022\022\n\nend_column\030\n \001(\t\"s\n\022BatchGetRo" + + "wRequest\022]\n\006tables\030\001 \003(\0132M.com.alicloud." + + "openservices.tablestore.core.protocol.Ta" + + "bleInBatchGetRowRequest\"\354\001\n\030RowInBatchGe" + + "tRowResponse\022\r\n\005is_ok\030\001 \002(\010\022H\n\005error\030\002 \001" + + "(\01329.com.alicloud.openservices.tablestor" + + "e.core.protocol.Error\022V\n\010consumed\030\003 \001(\0132" + + "D.com.alicloud.openservices.tablestore.c" + + "ore.protocol.ConsumedCapacity\022\013\n\003row\030\004 \001" + + "(\014\022\022\n\nnext_token\030\005 \001(\014\"\214\001\n\032TableInBatchG", + "etRowResponse\022\022\n\ntable_name\030\001 \002(\t\022Z\n\004row" + + "s\030\002 \003(\0132L.com.alicloud.openservices.tabl" + + "estore.core.protocol.RowInBatchGetRowRes" + + "ponse\"u\n\023BatchGetRowResponse\022^\n\006tables\030\001" + + " \003(\0132N.com.alicloud.openservices.tablest" + + "ore.core.protocol.TableInBatchGetRowResp" + + "onse\"\255\002\n\031RowInBatchWriteRowRequest\022O\n\004ty" + + "pe\030\001 \002(\0162A.com.alicloud.openservices.tab" + + "lestore.core.protocol.OperationType\022\022\n\nr" + + "ow_change\030\002 \002(\014\022P\n\tcondition\030\003 \002(\0132=.com", + ".alicloud.openservices.tablestore.core.p" + + "rotocol.Condition\022Y\n\016return_content\030\004 \001(" + + "\0132A.com.alicloud.openservices.tablestore" + + ".core.protocol.ReturnContent\"\216\001\n\033TableIn" + + "BatchWriteRowRequest\022\022\n\ntable_name\030\001 \002(\t" + + "\022[\n\004rows\030\002 \003(\0132M.com.alicloud.openservic" + + "es.tablestore.core.protocol.RowInBatchWr" + + "iteRowRequest\"\217\001\n\024BatchWriteRowRequest\022_" + + "\n\006tables\030\001 \003(\0132O.com.alicloud.openservic" + + "es.tablestore.core.protocol.TableInBatch", + "WriteRowRequest\022\026\n\016transaction_id\030\002 \001(\t\"" + + "\332\001\n\032RowInBatchWriteRowResponse\022\r\n\005is_ok\030" + + "\001 \002(\010\022H\n\005error\030\002 \001(\01329.com.alicloud.open" + + "services.tablestore.core.protocol.Error\022" + + "V\n\010consumed\030\003 \001(\0132D.com.alicloud.openser" + + "vices.tablestore.core.protocol.ConsumedC" + + "apacity\022\013\n\003row\030\004 \001(\014\"\220\001\n\034TableInBatchWri" + + "teRowResponse\022\022\n\ntable_name\030\001 \002(\t\022\\\n\004row" + + "s\030\002 \003(\0132N.com.alicloud.openservices.tabl" + + "estore.core.protocol.RowInBatchWriteRowR", + "esponse\"y\n\025BatchWriteRowResponse\022`\n\006tabl" + + "es\030\001 \003(\0132P.com.alicloud.openservices.tab" + + "lestore.core.protocol.TableInBatchWriteR" + + "owResponse\"\260\003\n\017GetRangeRequest\022\022\n\ntable_" + + "name\030\001 \002(\t\022P\n\tdirection\030\002 \002(\0162=.com.alic" + + "loud.openservices.tablestore.core.protoc" + + "ol.Direction\022\026\n\016columns_to_get\030\003 \003(\t\022Q\n\n" + + "time_range\030\004 \001(\0132=.com.alicloud.openserv" + + "ices.tablestore.core.protocol.TimeRange\022" + + "\024\n\014max_versions\030\005 \001(\005\022\r\n\005limit\030\006 \001(\005\022#\n\033", + "inclusive_start_primary_key\030\007 \002(\014\022!\n\031exc" + + "lusive_end_primary_key\030\010 \002(\014\022\016\n\006filter\030\n" + + " \001(\014\022\024\n\014start_column\030\013 \001(\t\022\022\n\nend_column" + + "\030\014 \001(\t\022\r\n\005token\030\r \001(\014\022\026\n\016transaction_id\030" + + "\016 \001(\t\"\254\001\n\020GetRangeResponse\022V\n\010consumed\030\001" + + " \002(\0132D.com.alicloud.openservices.tablest" + + "ore.core.protocol.ConsumedCapacity\022\014\n\004ro" + + "ws\030\002 \002(\014\022\036\n\026next_start_primary_key\030\003 \001(\014" + + "\022\022\n\nnext_token\030\004 \001(\014\"?\n\034StartLocalTransa" + + "ctionRequest\022\022\n\ntable_name\030\001 \002(\t\022\013\n\003key\030", + "\002 \002(\014\"7\n\035StartLocalTransactionResponse\022\026" + + "\n\016transaction_id\030\001 \002(\t\"2\n\030CommitTransact" + + "ionRequest\022\026\n\016transaction_id\030\001 \002(\t\"\033\n\031Co" + + "mmitTransactionResponse\"1\n\027AbortTransact" + + "ionRequest\022\026\n\016transaction_id\030\001 \002(\t\"\032\n\030Ab" + + "ortTransactionResponse\"\'\n\021ListStreamRequ" + + "est\022\022\n\ntable_name\030\001 \001(\t\"F\n\006Stream\022\021\n\tstr" + + "eam_id\030\001 \002(\t\022\022\n\ntable_name\030\002 \002(\t\022\025\n\rcrea" + + "tion_time\030\003 \002(\003\"a\n\022ListStreamResponse\022K\n" + + "\007streams\030\001 \003(\0132:.com.alicloud.openservic", + "es.tablestore.core.protocol.Stream\"M\n\013St" + + "reamShard\022\020\n\010shard_id\030\001 \002(\t\022\021\n\tparent_id" + + "\030\002 \001(\t\022\031\n\021parent_sibling_id\030\003 \001(\t\"a\n\025Des" + + "cribeStreamRequest\022\021\n\tstream_id\030\001 \002(\t\022 \n" + + "\030inclusive_start_shard_id\030\002 \001(\t\022\023\n\013shard" + + "_limit\030\003 \001(\005\"\260\002\n\026DescribeStreamResponse\022" + + "\021\n\tstream_id\030\001 \002(\t\022\027\n\017expiration_time\030\002 " + + "\002(\005\022\022\n\ntable_name\030\003 \002(\t\022\025\n\rcreation_time" + + "\030\004 \002(\003\022W\n\rstream_status\030\005 \002(\0162@.com.alic" + + "loud.openservices.tablestore.core.protoc", + "ol.StreamStatus\022O\n\006shards\030\006 \003(\0132?.com.al" + + "icloud.openservices.tablestore.core.prot" + + "ocol.StreamShard\022\025\n\rnext_shard_id\030\007 \001(\t\"" + + ">\n\027GetShardIteratorRequest\022\021\n\tstream_id\030" + + "\001 \002(\t\022\020\n\010shard_id\030\002 \002(\t\"2\n\030GetShardItera" + + "torResponse\022\026\n\016shard_iterator\030\001 \002(\t\"?\n\026G" + + "etStreamRecordRequest\022\026\n\016shard_iterator\030" + + "\001 \002(\t\022\r\n\005limit\030\002 \001(\005\"\235\002\n\027GetStreamRecord" + + "Response\022p\n\016stream_records\030\001 \003(\0132X.com.a" + + "licloud.openservices.tablestore.core.pro", + "tocol.GetStreamRecordResponse.StreamReco" + + "rd\022\033\n\023next_shard_iterator\030\002 \001(\t\032s\n\014Strea" + + "mRecord\022S\n\013action_type\030\001 \002(\0162>.com.alicl" + + "oud.openservices.tablestore.core.protoco" + + "l.ActionType\022\016\n\006record\030\002 \002(\014\"j\n\037ComputeS" + + "plitPointsBySizeRequest\022\022\n\ntable_name\030\001 " + + "\002(\t\022\022\n\nsplit_size\030\002 \002(\003\022\037\n\027split_size_un" + + "it_in_byte\030\003 \001(\003\"\220\003\n ComputeSplitPointsB" + + "ySizeResponse\022V\n\010consumed\030\001 \002(\0132D.com.al" + + "icloud.openservices.tablestore.core.prot", + "ocol.ConsumedCapacity\022T\n\006schema\030\002 \003(\0132D." + + "com.alicloud.openservices.tablestore.cor" + + "e.protocol.PrimaryKeySchema\022\024\n\014split_poi" + + "nts\030\003 \003(\014\022u\n\tlocations\030\004 \003(\0132b.com.alicl" + + "oud.openservices.tablestore.core.protoco" + + "l.ComputeSplitPointsBySizeResponse.Split" + + "Location\0321\n\rSplitLocation\022\020\n\010location\030\001 " + + "\002(\t\022\016\n\006repeat\030\002 \002(\022*5\n\016PrimaryKeyType\022\013\n" + + "\007INTEGER\020\001\022\n\n\006STRING\020\002\022\n\n\006BINARY\020\003*c\n\021De" + + "finedColumnType\022\017\n\013DCT_INTEGER\020\001\022\016\n\nDCT_", + "DOUBLE\020\002\022\017\n\013DCT_BOOLEAN\020\003\022\016\n\nDCT_STRING\020" + + "\004\022\014\n\010DCT_BLOB\020\007*&\n\020PrimaryKeyOption\022\022\n\016A" + + "UTO_INCREMENT\020\001*:\n\017IndexUpdateMode\022\023\n\017IU" + + "M_ASYNC_INDEX\020\000\022\022\n\016IUM_SYNC_INDEX\020\001*4\n\tI" + + "ndexType\022\023\n\017IT_GLOBAL_INDEX\020\000\022\022\n\016IT_LOCA" + + "L_INDEX\020\001*M\n\027RowExistenceExpectation\022\n\n\006" + + "IGNORE\020\000\022\020\n\014EXPECT_EXIST\020\001\022\024\n\020EXPECT_NOT" + + "_EXIST\020\002*9\n\nReturnType\022\013\n\007RT_NONE\020\000\022\t\n\005R" + + "T_PK\020\001\022\023\n\017RT_AFTER_MODIFY\020\002*0\n\rOperation" + + "Type\022\007\n\003PUT\020\001\022\n\n\006UPDATE\020\002\022\n\n\006DELETE\020\003*&\n", + "\tDirection\022\013\n\007FORWARD\020\000\022\014\n\010BACKWARD\020\001*6\n" + + "\014StreamStatus\022\023\n\017STREAM_ENABLING\020\001\022\021\n\rST" + + "REAM_ACTIVE\020\002*9\n\nActionType\022\013\n\007PUT_ROW\020\001" + + "\022\016\n\nUPDATE_ROW\020\002\022\016\n\nDELETE_ROW\020\003" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor, + new java.lang.String[] { "Code", "Message", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Error.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySchema_descriptor, + new java.lang.String[] { "Name", "Type", "Option", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DefinedColumnSchema_descriptor, + new java.lang.String[] { "Name", "Type", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DefinedColumnSchema.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableOptions_descriptor, + new java.lang.String[] { "TimeToLive", "MaxVersions", "DeviationCellVersionInSec", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableOptions.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexMeta_descriptor, + new java.lang.String[] { "Name", "PrimaryKey", "DefinedColumn", "IndexUpdateMode", "IndexType", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.IndexMeta.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableMeta_descriptor, + new java.lang.String[] { "TableName", "PrimaryKey", "DefinedColumn", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableMeta.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Condition_descriptor, + new java.lang.String[] { "RowExistence", "ColumnCondition", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Condition.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CapacityUnit_descriptor, + new java.lang.String[] { "Read", "Write", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CapacityUnit.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughputDetails_descriptor, + new java.lang.String[] { "CapacityUnit", "LastIncreaseTime", "LastDecreaseTime", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughputDetails.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReservedThroughput_descriptor, + new java.lang.String[] { "CapacityUnit", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReservedThroughput.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConsumedCapacity_descriptor, + new java.lang.String[] { "CapacityUnit", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ConsumedCapacity.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamSpecification_descriptor, + new java.lang.String[] { "EnableStream", "ExpirationTime", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamSpecification.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamDetails_descriptor, + new java.lang.String[] { "EnableStream", "StreamId", "ExpirationTime", "LastEnableTime", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamDetails.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableRequest_descriptor, + new java.lang.String[] { "TableMeta", "ReservedThroughput", "TableOptions", "StreamSpec", "IndexMetas", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTableResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateTableResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexRequest_descriptor, + new java.lang.String[] { "MainTableName", "IndexMeta", "IncludeBaseData", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateIndexResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CreateIndexResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexRequest_descriptor, + new java.lang.String[] { "MainTableName", "IndexName", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DropIndexResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DropIndexResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableRequest_descriptor, + new java.lang.String[] { "TableName", "ReservedThroughput", "TableOptions", "StreamSpec", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_descriptor = + getDescriptor().getMessageTypes().get(20); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateTableResponse_descriptor, + new java.lang.String[] { "ReservedThroughputDetails", "TableOptions", "StreamDetails", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateTableResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_descriptor = + getDescriptor().getMessageTypes().get(21); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableRequest_descriptor, + new java.lang.String[] { "TableName", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_descriptor = + getDescriptor().getMessageTypes().get(22); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTableResponse_descriptor, + new java.lang.String[] { "TableMeta", "ReservedThroughputDetails", "TableOptions", "StreamDetails", "ShardSplits", "IndexMetas", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeTableResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_descriptor = + getDescriptor().getMessageTypes().get(23); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableRequest_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_descriptor = + getDescriptor().getMessageTypes().get(24); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTableResponse_descriptor, + new java.lang.String[] { "TableNames", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListTableResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_descriptor = + getDescriptor().getMessageTypes().get(25); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableRequest_descriptor, + new java.lang.String[] { "TableName", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_descriptor = + getDescriptor().getMessageTypes().get(26); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTableResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteTableResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_descriptor = + getDescriptor().getMessageTypes().get(27); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableRequest_descriptor, + new java.lang.String[] { "TableName", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_descriptor = + getDescriptor().getMessageTypes().get(28); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_LoadTableResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.LoadTableResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_descriptor = + getDescriptor().getMessageTypes().get(29); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableRequest_descriptor, + new java.lang.String[] { "TableName", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_descriptor = + getDescriptor().getMessageTypes().get(30); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnloadTableResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UnloadTableResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_descriptor = + getDescriptor().getMessageTypes().get(31); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TimeRange_descriptor, + new java.lang.String[] { "StartTime", "EndTime", "SpecificTime", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TimeRange.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_descriptor = + getDescriptor().getMessageTypes().get(32); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReturnContent_descriptor, + new java.lang.String[] { "ReturnType", "ReturnColumnNames", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ReturnContent.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_descriptor = + getDescriptor().getMessageTypes().get(33); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowRequest_descriptor, + new java.lang.String[] { "TableName", "PrimaryKey", "ColumnsToGet", "TimeRange", "MaxVersions", "Filter", "StartColumn", "EndColumn", "Token", "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_descriptor = + getDescriptor().getMessageTypes().get(34); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRowResponse_descriptor, + new java.lang.String[] { "Consumed", "Row", "NextToken", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_descriptor = + getDescriptor().getMessageTypes().get(35); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowRequest_descriptor, + new java.lang.String[] { "TableName", "RowChange", "Condition", "ReturnContent", "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_descriptor = + getDescriptor().getMessageTypes().get(36); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UpdateRowResponse_descriptor, + new java.lang.String[] { "Consumed", "Row", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.UpdateRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_descriptor = + getDescriptor().getMessageTypes().get(37); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowRequest_descriptor, + new java.lang.String[] { "TableName", "Row", "Condition", "ReturnContent", "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_descriptor = + getDescriptor().getMessageTypes().get(38); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_PutRowResponse_descriptor, + new java.lang.String[] { "Consumed", "Row", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PutRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_descriptor = + getDescriptor().getMessageTypes().get(39); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowRequest_descriptor, + new java.lang.String[] { "TableName", "PrimaryKey", "Condition", "ReturnContent", "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_descriptor = + getDescriptor().getMessageTypes().get(40); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteRowResponse_descriptor, + new java.lang.String[] { "Consumed", "Row", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DeleteRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_descriptor = + getDescriptor().getMessageTypes().get(41); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowRequest_descriptor, + new java.lang.String[] { "TableName", "PrimaryKey", "Token", "ColumnsToGet", "TimeRange", "MaxVersions", "Filter", "StartColumn", "EndColumn", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_descriptor = + getDescriptor().getMessageTypes().get(42); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowRequest_descriptor, + new java.lang.String[] { "Tables", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_descriptor = + getDescriptor().getMessageTypes().get(43); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchGetRowResponse_descriptor, + new java.lang.String[] { "IsOk", "Error", "Consumed", "Row", "NextToken", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchGetRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_descriptor = + getDescriptor().getMessageTypes().get(44); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchGetRowResponse_descriptor, + new java.lang.String[] { "TableName", "Rows", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchGetRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_descriptor = + getDescriptor().getMessageTypes().get(45); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchGetRowResponse_descriptor, + new java.lang.String[] { "Tables", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchGetRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_descriptor = + getDescriptor().getMessageTypes().get(46); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowRequest_descriptor, + new java.lang.String[] { "Type", "RowChange", "Condition", "ReturnContent", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_descriptor = + getDescriptor().getMessageTypes().get(47); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowRequest_descriptor, + new java.lang.String[] { "TableName", "Rows", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_descriptor = + getDescriptor().getMessageTypes().get(48); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowRequest_descriptor, + new java.lang.String[] { "Tables", "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_descriptor = + getDescriptor().getMessageTypes().get(49); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_RowInBatchWriteRowResponse_descriptor, + new java.lang.String[] { "IsOk", "Error", "Consumed", "Row", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.RowInBatchWriteRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_descriptor = + getDescriptor().getMessageTypes().get(50); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TableInBatchWriteRowResponse_descriptor, + new java.lang.String[] { "TableName", "Rows", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.TableInBatchWriteRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_descriptor = + getDescriptor().getMessageTypes().get(51); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_BatchWriteRowResponse_descriptor, + new java.lang.String[] { "Tables", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.BatchWriteRowResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_descriptor = + getDescriptor().getMessageTypes().get(52); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeRequest_descriptor, + new java.lang.String[] { "TableName", "Direction", "ColumnsToGet", "TimeRange", "MaxVersions", "Limit", "InclusiveStartPrimaryKey", "ExclusiveEndPrimaryKey", "Filter", "StartColumn", "EndColumn", "Token", "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_descriptor = + getDescriptor().getMessageTypes().get(53); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRangeResponse_descriptor, + new java.lang.String[] { "Consumed", "Rows", "NextStartPrimaryKey", "NextToken", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetRangeResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_descriptor = + getDescriptor().getMessageTypes().get(54); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionRequest_descriptor, + new java.lang.String[] { "TableName", "Key", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_descriptor = + getDescriptor().getMessageTypes().get(55); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_StartLocalTransactionResponse_descriptor, + new java.lang.String[] { "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StartLocalTransactionResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_descriptor = + getDescriptor().getMessageTypes().get(56); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionRequest_descriptor, + new java.lang.String[] { "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_descriptor = + getDescriptor().getMessageTypes().get(57); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CommitTransactionResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.CommitTransactionResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_descriptor = + getDescriptor().getMessageTypes().get(58); + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionRequest_descriptor, + new java.lang.String[] { "TransactionId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_descriptor = + getDescriptor().getMessageTypes().get(59); + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_AbortTransactionResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.AbortTransactionResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_descriptor = + getDescriptor().getMessageTypes().get(60); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamRequest_descriptor, + new java.lang.String[] { "TableName", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_descriptor = + getDescriptor().getMessageTypes().get(61); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Stream_descriptor, + new java.lang.String[] { "StreamId", "TableName", "CreationTime", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.Stream.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_descriptor = + getDescriptor().getMessageTypes().get(62); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListStreamResponse_descriptor, + new java.lang.String[] { "Streams", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ListStreamResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_descriptor = + getDescriptor().getMessageTypes().get(63); + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_StreamShard_descriptor, + new java.lang.String[] { "ShardId", "ParentId", "ParentSiblingId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.StreamShard.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_descriptor = + getDescriptor().getMessageTypes().get(64); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamRequest_descriptor, + new java.lang.String[] { "StreamId", "InclusiveStartShardId", "ShardLimit", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_descriptor = + getDescriptor().getMessageTypes().get(65); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeStreamResponse_descriptor, + new java.lang.String[] { "StreamId", "ExpirationTime", "TableName", "CreationTime", "StreamStatus", "Shards", "NextShardId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.DescribeStreamResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_descriptor = + getDescriptor().getMessageTypes().get(66); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorRequest_descriptor, + new java.lang.String[] { "StreamId", "ShardId", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_descriptor = + getDescriptor().getMessageTypes().get(67); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetShardIteratorResponse_descriptor, + new java.lang.String[] { "ShardIterator", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetShardIteratorResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_descriptor = + getDescriptor().getMessageTypes().get(68); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordRequest_descriptor, + new java.lang.String[] { "ShardIterator", "Limit", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_descriptor = + getDescriptor().getMessageTypes().get(69); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_descriptor, + new java.lang.String[] { "StreamRecords", "NextShardIterator", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_descriptor = + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_descriptor.getNestedTypes().get(0); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetStreamRecordResponse_StreamRecord_descriptor, + new java.lang.String[] { "ActionType", "Record", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.GetStreamRecordResponse.StreamRecord.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_descriptor = + getDescriptor().getMessageTypes().get(70); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeRequest_descriptor, + new java.lang.String[] { "TableName", "SplitSize", "SplitSizeUnitInByte", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_descriptor = + getDescriptor().getMessageTypes().get(71); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_descriptor, + new java.lang.String[] { "Consumed", "Schema", "SplitPoints", "Locations", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_descriptor = + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_descriptor.getNestedTypes().get(0); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ComputeSplitPointsBySizeResponse_SplitLocation_descriptor, + new java.lang.String[] { "Location", "Repeat", }, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.class, + com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation.Builder.class); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferBuilder.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferBuilder.java new file mode 100644 index 0000000..ca1020b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferBuilder.java @@ -0,0 +1,395 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.core.utils.BinaryUtil; +import com.alicloud.openservices.tablestore.core.utils.Pair; + +public class PlainBufferBuilder { + + public static final int computePrimaryKeyValue(PrimaryKeyValue value) throws IOException { + int size = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; + size += computePrimaryKeyValueWithoutLengthPrefix(value); + return size; + } + + public static final int computeColumnValue(ColumnValue value) throws IOException { + int size = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; + size += computeColumnValueWithoutLengthPrefix(value); + return size; + } + + // Bytes Data: value_type + type + public static final int computePrimaryKeyValueWithoutLengthPrefix(PrimaryKeyValue value) throws IOException { + int size = 1; // length + type + value + if (value.isInfMin() || value.isInfMax() || value.isPlaceHolderForAutoIncr()) { + return size; // inf value and AutoIncr only has a type. + } + + switch (value.getType()) { + case STRING: { + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; + size += value.asStringInBytes().length; + break; + } + case INTEGER: { + size += PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE; + break; + } + case BINARY: { + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; + size += value.asBinary().length; + break; + } + default: + throw new IOException("Bug: unsupported primary key type: " + value.getType()); + + } + return size; + } + + // Bytes Data: value_type + type + public static final int computeColumnValueWithoutLengthPrefix(ColumnValue value) throws IOException { + int size = 1; // length + type + value + switch (value.getType()) { + case STRING: { + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; + size += value.asStringInBytes().length; + break; + } + case INTEGER: { + size += PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE; + break; + } + case BINARY: { + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; + size += value.asBinary().length; + break; + } + case DOUBLE: { + size += PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE; + break; + } + case BOOLEAN: { + size += 1; + break; + } + default: + throw new IOException("Bug: unsupported column type: " + value.getType()); + + } + return size; + } + + public static final int computePlainBufferExtension(PlainBufferExtension extension) { + int size = 1; //TAG_EXTENSION + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // Length + if (extension.hasSeq()) { + size += computePlainBufferSequenceInfo(); + } + return size; + } + + public static final int computePlainBufferSequenceInfo() { + int size = 1;//TAG_SEQ_INFO + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // Length + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // TAG_SEQ_INFO_EPOCH + epoch + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE; // TAG_SEQ_INFO_TS + timestamp + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // TAG_SEQ_INFO_ROW_INDEX + rowIndex + return size; + } + + public static final int computePlainBufferCell(PlainBufferCell cell) throws IOException { + int size = 1; // TAG_CELL + if (cell.hasCellName()) { + size += 1; // TAG_CELL_NAME + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // length + size += cell.getNameRawData().length; + } + if (cell.hasCellValue()) { + size += 1; // TAG_CELL_VALUE + if (cell.isPk()) { + size += computePrimaryKeyValue(cell.getPkCellValue()); + } else { + size += computeColumnValue(cell.getCellValue()); + } + } + if (cell.hasCellType()) { + size += 2; // TAG_CELL_OP_TYPE + type + } + if (cell.hasCellTimestamp()) { + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE; // TAG_CELL_TIMESTAMP + timestamp + } + size += 2; // TAG_CELL_CHECKSUM + checksum + return size; + } + + public static final int computePlainBufferRow(PlainBufferRow row) throws IOException { + int size = 0; + size += 1; // TAG_ROW_PK + for (PlainBufferCell cell : row.getPrimaryKey()) { + size += computePlainBufferCell(cell); + } + if (!row.getCells().isEmpty()) { + size += 1; // TAG_ROW_DATA + for (PlainBufferCell cell : row.getCells()) { + size += computePlainBufferCell(cell); + } + } + if (row.hasDeleteMarker()) { + size += 1; // TAG_DELETE_MARKER + } + if (row.hasExtension()) { + size += computePlainBufferExtension(row.getExtension()); + } + size += 2; // TAG_ROW_CHECKSUM + checksum + return size; + } + + public static final int computePlainBufferRowWithHeader(PlainBufferRow row) throws IOException { + int size = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // header + size += computePlainBufferRow(row); + return size; + } + + + public static final int computeSkipLengthForExtensionTag(PlainBufferExtension extension) { + int size = 0; + if (extension.hasSeq()) { + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; //TAG_SEQ_ING + length + size += computeSkipLengthForSequenceInfo(); + } + return size; + } + + public static int computeSkipLengthForSequenceInfo() { + int size = 0; + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // TAG_SEQ_INFO_EPOCH + epoch + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE; // TAG_SEQ_INFO_TS + timestamp + size += 1 + PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // TAG_SEQ_INFO_ROW_INDEX + rowIndex + return size; + } + + public static byte[] buildPrimaryKeyValueWithoutLengthPrefix(PrimaryKeyValue value) throws IOException { + int size = computePrimaryKeyValueWithoutLengthPrefix(value); + PlainBufferOutputStream output = new PlainBufferOutputStream(size); + PlainBufferCodedOutputStream codedOutput = new PlainBufferCodedOutputStream(output); + codedOutput.writePrimaryKeyValueWithoutLengthPrefix(value); + + if (!output.isFull()) { + throw new IOException("Bug: serialize primary key value failed."); + } + return output.getBuffer(); + } + + public static byte[] buildColumnValueWithoutLengthPrefix(ColumnValue value) throws IOException { + int size = computeColumnValueWithoutLengthPrefix(value); + PlainBufferOutputStream output = new PlainBufferOutputStream(size); + PlainBufferCodedOutputStream codedOutput = new PlainBufferCodedOutputStream(output); + codedOutput.writeColumnValueWithoutLengthPrefix(value); + + if (!output.isFull()) { + throw new IOException("Bug: serialize column value failed."); + } + return output.getBuffer(); + } + + public static final int computePrimaryKeyColumn(PrimaryKeyColumn column) throws IOException { + int size = 2; // TAG_CELL + TAG_CELL_NAME; + size += PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; + size += column.getNameRawData().length; + size += 1; // TAG_CELL_VALUE + size += computePrimaryKeyValue(column.getValue()); + size += 2; // TAG_CELL_CHECKSUM + checksum + return size; + } + + // Bytes Data: TAG_ROW_PK + [primary key columns] + public static final int computePrimaryKey(PrimaryKey primaryKey) throws IOException { + int size = 1; // TAG_ROW_PK + for (PrimaryKeyColumn column : primaryKey.getPrimaryKeyColumns()) { + size += computePrimaryKeyColumn(column); + } + return size; + } + + public static final int computePrimaryKeyWithHeader(PrimaryKey primaryKey) throws IOException { + int size = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE; // Header + size += computePrimaryKey(primaryKey); + size += 2; // TAG_ROW_CHECKSUM + checksum + return size; + } + + public static void writePrimaryKeyValue(PrimaryKeyValue value, PlainBufferOutputStream output) throws IOException { + if (value.isInfMin()) { + output.writeRawLittleEndian32(1); + output.writeRawByte(PlainBufferConsts.VT_INF_MIN); + return; + } + + if (value.isInfMax()) { + output.writeRawLittleEndian32(1); + output.writeRawByte(PlainBufferConsts.VT_INF_MAX); + return; + } + + if (value.isPlaceHolderForAutoIncr()) { + output.writeRawLittleEndian32(1); + output.writeRawByte(PlainBufferConsts.VT_AUTO_INCREMENT); + return; + } + + switch (value.getType()) { + case STRING: { + byte[] rawData = value.asStringInBytes(); + final int prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + length + output.writeRawLittleEndian32(prefixLength + rawData.length); // length + type + value + output.writeRawByte(PlainBufferConsts.VT_STRING); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + case INTEGER: { + output.writeRawLittleEndian32(1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE); + output.writeRawByte(PlainBufferConsts.VT_INTEGER); + output.writeRawLittleEndian64(value.asLong()); + break; + } + case BINARY: { + byte[] rawData = value.asBinary(); + final int prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + length + output.writeRawLittleEndian32(prefixLength + rawData.length); // length + type + value + output.writeRawByte(PlainBufferConsts.VT_BLOB); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + default: + throw new IOException("Bug: unsupported primary key type: " + value.getType()); + } + } + + public static void writePrimaryKeyColumn(PrimaryKeyColumn column, PlainBufferOutputStream output, byte checksum) throws IOException { + output.writeRawByte(PlainBufferConsts.TAG_CELL); + output.writeRawByte(PlainBufferConsts.TAG_CELL_NAME); + byte[] rawData = column.getNameRawData(); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + output.writeRawByte(PlainBufferConsts.TAG_CELL_VALUE); + writePrimaryKeyValue(column.getValue(), output); + output.writeRawByte(PlainBufferConsts.TAG_CELL_CHECKSUM); + output.writeRawByte(checksum); + } + + public static byte[] buildPrimaryKeyWithHeader(PrimaryKey primaryKey) throws IOException { + int size = computePrimaryKeyWithHeader(primaryKey); + PlainBufferOutputStream output = new PlainBufferOutputStream(size); + output.writeRawLittleEndian32(PlainBufferConsts.HEADER); + output.writeRawByte(PlainBufferConsts.TAG_ROW_PK); + + byte rowChecksum = (byte)0x0, cellChecksum; + + for (PrimaryKeyColumn column : primaryKey.getPrimaryKeyColumns()) { + cellChecksum = PlainBufferCrc8.crc8((byte)0x0, column.getNameRawData()); + cellChecksum = column.getValue().getChecksum(cellChecksum); + writePrimaryKeyColumn(column, output, cellChecksum); + rowChecksum = PlainBufferCrc8.crc8(rowChecksum, cellChecksum); + } + + // 没有deleteMarker, 要与0x0做crc. + rowChecksum = PlainBufferCrc8.crc8(rowChecksum, (byte)0x0); + + output.writeRawByte(PlainBufferConsts.TAG_ROW_CHECKSUM); + output.writeRawByte(rowChecksum); + + if (!output.isFull()) { + throw new IOException("Bug: serialize primary key failed."); + } + return output.getBuffer(); + } + + public static byte[] buildRowPutChangeWithHeader(RowPutChange rowChange) throws IOException { + + List pkCells = new ArrayList(); + for (PrimaryKeyColumn column : rowChange.getPrimaryKey().getPrimaryKeyColumns()) { + pkCells.add(PlainBufferConversion.toPlainBufferCell(column)); + } + List cells = new ArrayList(); + for (Column column: rowChange.getColumnsToPut()) { + cells.add(PlainBufferConversion.toPlainBufferCell(column, false, false, false, (byte)0x0)); + } + + PlainBufferRow row = new PlainBufferRow(pkCells, cells, false); + + int size = computePlainBufferRowWithHeader(row); + PlainBufferOutputStream output = new PlainBufferOutputStream(size); + PlainBufferCodedOutputStream codedOutput = new PlainBufferCodedOutputStream(output); + codedOutput.writeRowWithHeader(row); + if (!output.isFull()) { + throw new IOException("Bug: serialize row put change failed."); + } + return output.getBuffer(); + } + + public static byte[] buildRowUpdateChangeWithHeader(RowUpdateChange rowChange) throws IOException { + List pkCells = new ArrayList(); + for (PrimaryKeyColumn column : rowChange.getPrimaryKey().getPrimaryKeyColumns()) { + pkCells.add(PlainBufferConversion.toPlainBufferCell(column)); + } + List cells = new ArrayList(); + if (!rowChange.getColumnsToUpdate().isEmpty()) { + for (Pair column : rowChange.getColumnsToUpdate()) { + switch (column.getSecond()) { + case PUT: + cells.add(PlainBufferConversion.toPlainBufferCell(column.getFirst(), false, false, false, (byte) 0x0)); + break; + case DELETE: + cells.add(PlainBufferConversion.toPlainBufferCell(column.getFirst(), true, false, true, PlainBufferConsts.DELETE_ONE_VERSION)); + break; + case DELETE_ALL: + cells.add(PlainBufferConversion.toPlainBufferCell(column.getFirst(), true, true, true, PlainBufferConsts.DELETE_ALL_VERSION)); + break; + case INCREMENT: + cells.add(PlainBufferConversion.toPlainBufferCell(column.getFirst(), false, true, true, PlainBufferConsts.INCREMENT)); + break; + } + } + } + + PlainBufferRow row = new PlainBufferRow(pkCells, cells, false); + + int size = computePlainBufferRowWithHeader(row); + PlainBufferOutputStream output = new PlainBufferOutputStream(size); + PlainBufferCodedOutputStream codedOutput = new PlainBufferCodedOutputStream(output); + codedOutput.writeRowWithHeader(row); + + if (!output.isFull()) { + throw new IOException("Bug: serialize row update change failed."); + } + return output.getBuffer(); + } + + public static byte[] buildRowDeleteChangeWithHeader(RowDeleteChange rowChange) throws IOException { + List pkCells = new ArrayList(); + for (PrimaryKeyColumn column : rowChange.getPrimaryKey().getPrimaryKeyColumns()) { + pkCells.add(PlainBufferConversion.toPlainBufferCell(column)); + } + List cells = new ArrayList(); + + PlainBufferRow row = new PlainBufferRow(pkCells, cells, true); + + int size = computePlainBufferRowWithHeader(row); + PlainBufferOutputStream output = new PlainBufferOutputStream(size); + PlainBufferCodedOutputStream codedOutput = new PlainBufferCodedOutputStream(output); + codedOutput.writeRowWithHeader(row); + + if (!output.isFull()) { + throw new IOException("Bug: serialize row delete change failed."); + } + return output.getBuffer(); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCell.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCell.java new file mode 100644 index 0000000..e289b77 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCell.java @@ -0,0 +1,179 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.PrimaryKeyValue; +import com.alicloud.openservices.tablestore.core.utils.Bytes; + +import java.io.IOException; + +public class PlainBufferCell { + + private String cellName; + private byte[] nameRawData; + private boolean hasCellName = false; + + private ColumnValue cellValue; + private boolean hasCellValue = false; + + private boolean isPk = false; + private PrimaryKeyValue pkCellValue; + + private byte cellType; + private boolean hasCellType = false; + + private long cellTimestamp; + private boolean hasCellTimestamp = false; + + private byte checksum; + private boolean hasChecksum = false; + + public PlainBufferCell() { + + } + + public String getCellName() { + return cellName; + } + + public byte[] getNameRawData() { + if (nameRawData == null) { + nameRawData = Bytes.toBytes(cellName); + } + return nameRawData; + } + + public void setCellName(String cellName) { + this.cellName = cellName; + this.hasCellName = true; + nameRawData = null; + this.hasChecksum = false; + } + + public boolean hasCellName() { + return hasCellName; + } + + public ColumnValue getCellValue() { + return cellValue; + } + + public void setCellValue(ColumnValue cellValue) { + this.cellValue = cellValue; + this.hasCellValue = true; + this.hasChecksum = false; + } + + public boolean hasCellValue() { + return hasCellValue; + } + + public byte getCellType() { + return cellType; + } + + public void setCellType(byte cellType) { + this.cellType = cellType; + this.hasCellType = true; + this.hasChecksum = false; + } + + public boolean hasCellType() { + return hasCellType; + } + + public long getCellTimestamp() { + return cellTimestamp; + } + + public void setCellTimestamp(long cellTimestamp) { + this.cellTimestamp = cellTimestamp; + this.hasCellTimestamp = true; + this.hasChecksum = false; + } + + public boolean hasCellTimestamp() { + return hasCellTimestamp; + } + + /** + * 会自动计算当前的checksum并返回,当没有数据变化时,checksum会缓存在对象中,以减少不必要的计算。 + * @return + * @throws IOException + */ + public byte getChecksum() throws IOException { + if (!this.hasChecksum) { + generateChecksum(); + } + return this.checksum; + } + + private void generateChecksum() throws IOException { + this.checksum = PlainBufferCrc8.getChecksum((byte)0x0, this); + this.hasChecksum = true; + } + + @Override + public boolean equals(Object o) { + if (o == null || ! (o instanceof PlainBufferCell)) { + return false; + } + + try { + if (getChecksum() != ((PlainBufferCell) o).getChecksum()) { + return false; + } + } catch (IOException e) { + throw new ClientException("Error when getChecksum.", e); + } + + if ((hasCellName() != ((PlainBufferCell) o).hasCellName()) + || (hasCellName() && !getCellName().equals(((PlainBufferCell) o).getCellName()))) { + return false; + }; + if ((hasCellValue() != ((PlainBufferCell) o).hasCellValue()) + || (hasCellValue() && !getCellValue().equals(((PlainBufferCell) o).getCellValue()))) { + return false; + } + if ((isPk() != ((PlainBufferCell) o).isPk()) + || (isPk() && !getPkCellValue().equals(((PlainBufferCell) o).getPkCellValue()))) { + return false; + } + if ((hasCellType() != ((PlainBufferCell) o).hasCellType()) + || (hasCellType() && (getCellType() != ((PlainBufferCell) o).getCellType()))) { + return false; + } + if ((hasCellTimestamp() != ((PlainBufferCell) o).hasCellTimestamp()) + || (hasCellTimestamp() && (getCellTimestamp() != ((PlainBufferCell) o).getCellTimestamp()))) { + return false; + } + return true; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("CellName: " + hasCellName() + "|" + cellName); + sb.append(", CellValue: " + hasCellValue() + "|" + cellValue); + sb.append(", CellType: " + hasCellType() + "|" + cellType); + sb.append(", IsPk: " + isPk() + "|" + getPkCellValue()); + sb.append(", CellTimestamp: " + hasCellTimestamp() + "|" + cellTimestamp); + sb.append(", Checksum: " + this.hasChecksum + "|" + checksum); + return sb.toString(); + } + + public boolean isPk() { + return isPk; + } + + public PrimaryKeyValue getPkCellValue() { + return pkCellValue; + } + + public void setPkCellValue(PrimaryKeyValue pkCellValue) { + this.pkCellValue = pkCellValue; + this.hasCellValue = true; + this.hasChecksum = false; + this.isPk = true; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedInputStream.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedInputStream.java new file mode 100644 index 0000000..8a99d80 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedInputStream.java @@ -0,0 +1,258 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.*; + +public class PlainBufferCodedInputStream { + + private static Logger logger = LoggerFactory.getLogger(PlainBufferCodedInputStream.class); + private PlainBufferInputStream input = null; + + public PlainBufferCodedInputStream(PlainBufferInputStream input) { + Preconditions.checkNotNull(input, "The plainBufferInputStream should not be null."); + this.input = input; + } + + public int readTag() throws IOException { + return input.readTag(); + } + + public boolean checkLastTagWas(int tag) { + return input.checkLastTagWas(tag); + } + + public int getLastTag() { + return input.getLastTag(); + } + + public int readHeader() throws IOException { + return input.readUInt32(); + } + + public ColumnValue readCellValue() throws IOException { + if (!checkLastTagWas(TAG_CELL_VALUE)) { + throw new IOException("Expect TAG_CELL_VALUE but it was " + PlainBufferConsts.printTag(getLastTag())); + } + int length = input.readRawLittleEndian32(); + byte type = input.readRawByte(); + ColumnValue columnValue = null; + switch (type) { + case VT_INTEGER: { + columnValue = ColumnValue.fromLong(input.readInt64()); + break; + } + case VT_BLOB: { + columnValue = ColumnValue.fromBinary(input.readBytes(input.readUInt32())); + break; + } + case VT_STRING: { + columnValue = ColumnValue.fromString(input.readUTFString(input.readUInt32())); + break; + } + case VT_BOOLEAN: { + columnValue = ColumnValue.fromBoolean(input.readBoolean()); + break; + } + case VT_DOUBLE: { + columnValue = ColumnValue.fromDouble(input.readDouble()); + break; + } + default: + throw new IOException("Unsupported column type: " + type); + } + readTag(); + return columnValue; + } + + public void skipRawSize(int length) throws IOException { + input.readBytes(length); + } + + public PlainBufferCell readCell() throws IOException { + if (!checkLastTagWas(TAG_CELL)) { + throw new IOException("Expect TAG_CELL but it was " + PlainBufferConsts.printTag(getLastTag())); + } + + PlainBufferCell cell = new PlainBufferCell(); + + readTag(); + if (getLastTag() == TAG_CELL_NAME) { + cell.setCellName(input.readUTFString(input.readRawLittleEndian32())); + readTag(); + } + + if (getLastTag() == TAG_CELL_VALUE) { + cell.setCellValue(readCellValue()); + } + + if (getLastTag() == TAG_CELL_TYPE) { + cell.setCellType(input.readRawByte()); + readTag(); + } + + if (getLastTag() == TAG_CELL_TIMESTAMP) { + long timestamp = input.readInt64(); + if (timestamp < 0) { + throw new IOException("The timestamp is negative."); + } + cell.setCellTimestamp(timestamp); + readTag(); // consume next tag as all read function should consume next tag + } + + if (getLastTag() == TAG_CELL_CHECKSUM) { + byte checksum = input.readRawByte(); + readTag(); + if (cell.getChecksum() != checksum) { + logger.error("Checksum mismatch. Cell: " + cell.toString() + ". Checksum: " + checksum + ". PlainBuffer: " + input.toString()); + throw new IOException("Checksum is mismatch."); + } + } else { + throw new IOException("Expect TAG_CELL_CHECKSUM but it was " + PlainBufferConsts.printTag(getLastTag())); + } + + return cell; + } + + public List readRowPK() throws IOException { + if (!checkLastTagWas(TAG_ROW_PK)) { + throw new IOException("Expect TAG_ROW_PK but it was " + PlainBufferConsts.printTag(getLastTag())); + } + + List primaryKeyColumns = new ArrayList(); + readTag(); + while (checkLastTagWas(TAG_CELL)) { + PlainBufferCell cell = readCell(); + primaryKeyColumns.add(cell); + } + return primaryKeyColumns; + } + + public List readRowData() throws IOException { + if (!checkLastTagWas(TAG_ROW_DATA)) { + throw new IOException("Expect TAG_ROW_DATA but it was " + PlainBufferConsts.printTag(getLastTag())); + } + + List columns = new ArrayList(); + readTag(); + while (checkLastTagWas(TAG_CELL)) { + columns.add(readCell()); + } + + return columns; + } + + public PlainBufferExtension readExtension() throws IOException { + PlainBufferExtension extension = new PlainBufferExtension(); + if (checkLastTagWas(TAG_EXTENSION)) { + input.readUInt32(); // length + readTag(); + while (isTagInExtension(getLastTag())) { + if (checkLastTagWas(TAG_SEQ_INFO)) { + extension.setSequenceInfo(readSequenceInfo()); + } else { + int length = input.readRawLittleEndian32();; + skipRawSize(length); + readTag(); + } + } + } + + return extension; + } + + public PlainBufferRow readRow() throws IOException { + List columns = new ArrayList(); + List primaryKey = new ArrayList(); + boolean hasDeleteMarker = false; + + if (checkLastTagWas(TAG_ROW_PK)) { + primaryKey = readRowPK(); + if (primaryKey.isEmpty()) { + throw new IOException("The primary key of row is empty."); + } + } + + if (checkLastTagWas(TAG_ROW_DATA)) { + columns = readRowData(); + } + + if (checkLastTagWas(TAG_DELETE_ROW_MARKER)) { + hasDeleteMarker = true; + readTag(); + } + + PlainBufferRow row = new PlainBufferRow(primaryKey, columns, hasDeleteMarker); + + row.setExtension(readExtension()); + + if (checkLastTagWas(TAG_ROW_CHECKSUM)) { + byte checksum = input.readRawByte(); + readTag(); + if (row.getChecksum() != checksum) { + logger.error("Checksum mismatch. Row: " + row.toString() + ". Checksum: " + checksum + ". PlainBuffer: " + input.toString()); + throw new IOException("Checksum is mismatch."); + } + } else { + throw new IOException("Expect TAG_ROW_CHECKSUM but it was " + PlainBufferConsts.printTag(getLastTag())); + } + + return row; + } + + public PlainBufferSequenceInfo readSequenceInfo() throws IOException { + if (!checkLastTagWas(TAG_SEQ_INFO)) { + throw new IOException("Expect TAG_SEQ_INFO but it was " + PlainBufferConsts.printTag(getLastTag())); + } + input.readRawLittleEndian32();// length + readTag(); + PlainBufferSequenceInfo seq = new PlainBufferSequenceInfo(); + if (checkLastTagWas(TAG_SEQ_INFO_EPOCH)) { + seq.setEpoch(input.readUInt32()); + readTag(); + } else { + throw new IOException("Expect TAG_SEQ_INFO_EPOCH but it was " + PlainBufferConsts.printTag(getLastTag())); + } + if (checkLastTagWas(TAG_SEQ_INFO_TS)) { + seq.setTimestamp(input.readInt64()); + readTag(); + } else { + throw new IOException("Expect TAG_SEQ_INFO_TS but it was " + PlainBufferConsts.printTag(getLastTag())); + } + if (checkLastTagWas(TAG_SEQ_INFO_ROW_INDEX)) { + seq.setRowIndex(input.readUInt32()); + readTag(); + } else { + throw new IOException("Expect TAG_SEQ_INFO_ROW_INDEX but it was " + PlainBufferConsts.printTag(getLastTag())); + } + + return seq; + } + + public List readRowsWithHeader() throws IOException { + List rows = new ArrayList(); + if (readHeader() != PlainBufferConsts.HEADER) { + logger.error("Invalid header from plain buffer: " + input.toString()); + throw new IOException("Invalid header from plain buffer."); + } + + readTag(); + while (!input.isAtEnd()) { + PlainBufferRow row = readRow(); + rows.add(row); + } + + if (!input.isAtEnd()) { + throw new IOException(""); + } + + return rows; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedOutputStream.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedOutputStream.java new file mode 100644 index 0000000..540a562 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCodedOutputStream.java @@ -0,0 +1,283 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.PrimaryKeyValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.io.IOException; + +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferBuilder.*; +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.*; + +public class PlainBufferCodedOutputStream { + + private PlainBufferOutputStream output = null; + + public PlainBufferCodedOutputStream(PlainBufferOutputStream output) { + Preconditions.checkNotNull(output, "The plainBufferOutputStream should not be null."); + this.output = output; + } + + public void writeHeader() throws IOException { + output.writeRawLittleEndian32(HEADER); + } + + public void writeTag(byte tag) throws IOException { + output.writeRawByte(tag); + } + + public void writeCellName(byte[] name) throws IOException { + writeTag(TAG_CELL_NAME); + output.writeRawLittleEndian32(name.length); + output.writeBytes(name); + } + + public void writeCellValue(PrimaryKeyValue value) throws IOException { + writeTag(TAG_CELL_VALUE); + if (value.isInfMin()) { + output.writeRawLittleEndian32(1); + output.writeRawByte(PlainBufferConsts.VT_INF_MIN); + return; + } + + if (value.isInfMax()) { + output.writeRawLittleEndian32(1); + output.writeRawByte(PlainBufferConsts.VT_INF_MAX); + return; + } + + if (value.isPlaceHolderForAutoIncr()) { + output.writeRawLittleEndian32(1); + output.writeRawByte(PlainBufferConsts.VT_AUTO_INCREMENT); + return; + } + + switch (value.getType()) { + case STRING: { + byte[] rawData = value.asStringInBytes(); + final int prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + length + output.writeRawLittleEndian32(prefixLength + rawData.length); // length + type + value + output.writeRawByte(PlainBufferConsts.VT_STRING); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + case INTEGER: { + output.writeRawLittleEndian32(1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE); + output.writeRawByte(PlainBufferConsts.VT_INTEGER); + output.writeRawLittleEndian64(value.asLong()); + break; + } + case BINARY: { + byte[] rawData = value.asBinary(); + final int prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + length + output.writeRawLittleEndian32(prefixLength + rawData.length); // length + type + value + output.writeRawByte(PlainBufferConsts.VT_BLOB); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + default: + throw new IOException("Bug: unsupported primary key type: " + value.getType()); + } + } + + public void writeCellValue(ColumnValue value) throws IOException { + writeTag(TAG_CELL_VALUE); + switch (value.getType()) { + case STRING: { + byte[] rawData = value.asStringInBytes(); + final int prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + output.writeRawLittleEndian32(prefixLength + rawData.length); // length + type + value + output.writeRawByte(VT_STRING); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + case INTEGER: { + output.writeRawLittleEndian32(1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE); + output.writeRawByte(VT_INTEGER); + output.writeRawLittleEndian64(value.asLong()); + break; + } + case BINARY: { + byte[] rawData = value.asBinary(); + final int prefixLength = PlainBufferOutputStream.LITTLE_ENDIAN_32_SIZE + 1; // length + type + output.writeRawLittleEndian32(prefixLength + rawData.length); // length + type + output.writeRawByte(VT_BLOB); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + case DOUBLE: { + output.writeRawLittleEndian32(1 + PlainBufferOutputStream.LITTLE_ENDIAN_64_SIZE); + output.writeRawByte(VT_DOUBLE); + output.writeDouble(value.asDouble()); + break; + } + case BOOLEAN: { + output.writeRawLittleEndian32(2); + output.writeRawByte(VT_BOOLEAN); + output.writeBoolean(value.asBoolean()); + break; + } + default: + throw new IOException("Bug: unsupported column type: " + value.getType()); + } + } + + public void writeCell(PlainBufferCell cell) throws IOException { + writeTag(TAG_CELL); + if (cell.hasCellName()) { + writeCellName(cell.getNameRawData()); + } + if (cell.hasCellValue()) { + if (cell.isPk()) { + writeCellValue(cell.getPkCellValue()); + } else { + writeCellValue(cell.getCellValue()); + } + } + if (cell.hasCellType()) { + writeTag(TAG_CELL_TYPE); + output.writeRawByte(cell.getCellType()); + } + if (cell.hasCellTimestamp()) { + writeTag(TAG_CELL_TIMESTAMP); + output.writeRawLittleEndian64(cell.getCellTimestamp()); + } + writeTag(TAG_CELL_CHECKSUM); + output.writeRawByte(cell.getChecksum()); + } + + public void writeExtension(PlainBufferExtension extension) throws IOException { + writeTag(TAG_EXTENSION); + output.writeRawLittleEndian32(computeSkipLengthForExtensionTag(extension)); + int extensionCount = 0; + if (extension.hasSeq()) { + writeSequenceInfo(extension.getSequenceInfo()); + extensionCount++; + } + + if (extensionCount == 0) { + throw new IOException("no extension tag is writen."); + } + } + + public void writeSequenceInfo(PlainBufferSequenceInfo sequenceInfo) throws IOException { + writeTag(TAG_SEQ_INFO); + output.writeRawLittleEndian32(computeSkipLengthForSequenceInfo()); + writeTag(TAG_SEQ_INFO_EPOCH); + output.writeRawLittleEndian32(sequenceInfo.getEpoch()); + writeTag(TAG_SEQ_INFO_TS); + output.writeRawLittleEndian64(sequenceInfo.getTimestamp()); + writeTag(TAG_SEQ_INFO_ROW_INDEX); + output.writeRawLittleEndian32(sequenceInfo.getRowIndex()); + } + + public void writeRow(PlainBufferRow row) throws IOException { + writeTag(TAG_ROW_PK); + for (PlainBufferCell cell : row.getPrimaryKey()) { + writeCell(cell); + } + if (!row.getCells().isEmpty()) { + writeTag(TAG_ROW_DATA); + for (PlainBufferCell cell : row.getCells()) { + writeCell(cell); + } + } + if (row.hasDeleteMarker()) { + writeTag(TAG_DELETE_ROW_MARKER); + } + + if (row.hasExtension()) { + writeExtension(row.getExtension()); + } + + writeTag(TAG_ROW_CHECKSUM); + output.writeRawByte(row.getChecksum()); + } + + public void writeRowWithHeader(PlainBufferRow row) throws IOException { + writeHeader(); + writeRow(row); + } + + public void writePrimaryKeyValueWithoutLengthPrefix(PrimaryKeyValue value) throws IOException { + if (value.isInfMin()) { + output.writeRawByte(VT_INF_MIN); + return; + } + + if (value.isInfMax()) { + output.writeRawByte(VT_INF_MAX); + return; + } + + if (value.isPlaceHolderForAutoIncr()) { + output.writeRawByte(VT_AUTO_INCREMENT); + return; + } + + switch (value.getType()) { + case STRING: { + byte[] rawData = value.asStringInBytes(); + output.writeRawByte(VT_STRING); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + case INTEGER: { + output.writeRawByte(VT_INTEGER); + output.writeRawLittleEndian64(value.asLong()); + break; + } + case BINARY: { + byte[] rawData = value.asBinary(); + output.writeRawByte(VT_BLOB); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + default: + throw new IOException("Bug: unsupported primary key type: " + value.getType()); + } + } + + + public void writeColumnValueWithoutLengthPrefix(ColumnValue value) throws IOException { + switch (value.getType()) { + case STRING: { + byte[] rawData = value.asStringInBytes(); + output.writeRawByte(VT_STRING); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + case INTEGER: { + output.writeRawByte(VT_INTEGER); + output.writeRawLittleEndian64(value.asLong()); + break; + } + case BINARY: { + byte[] rawData = value.asBinary(); + output.writeRawByte(VT_BLOB); + output.writeRawLittleEndian32(rawData.length); + output.writeBytes(rawData); + break; + } + case DOUBLE: { + output.writeRawByte(VT_DOUBLE); + output.writeDouble(value.asDouble()); + break; + } + case BOOLEAN: { + output.writeRawByte(VT_BOOLEAN); + output.writeBoolean(value.asBoolean()); + break; + } + default: + throw new IOException("Bug: unsupported column type: " + value.getType()); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConsts.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConsts.java new file mode 100644 index 0000000..50448e5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConsts.java @@ -0,0 +1,108 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +public class PlainBufferConsts { + public final static int HEADER = 0x75; + + // tag type + public final static byte TAG_ROW_PK = 0x1; + public final static byte TAG_ROW_DATA = 0x2; + public final static byte TAG_CELL = 0x3; + public final static byte TAG_CELL_NAME = 0x4; + public final static byte TAG_CELL_VALUE = 0x5; + public final static byte TAG_CELL_TYPE = 0x6; + public final static byte TAG_CELL_TIMESTAMP = 0x7; + public final static byte TAG_DELETE_ROW_MARKER = 0x8; + public final static byte TAG_ROW_CHECKSUM = 0x9; + public final static byte TAG_CELL_CHECKSUM = 0x0A; + public final static byte TAG_EXTENSION = 0x0B; + public final static byte TAG_SEQ_INFO = 0x0C; + public final static byte TAG_SEQ_INFO_EPOCH = 0x0D; + public final static byte TAG_SEQ_INFO_TS = 0x0E; + public final static byte TAG_SEQ_INFO_ROW_INDEX = 0x0F; + + // cell op type + public final static byte DELETE_ALL_VERSION = 0x1; + public final static byte DELETE_ONE_VERSION = 0x3; + public final static byte INCREMENT = 0x4; + + // variant type + public final static byte VT_INTEGER = 0x0; + public final static byte VT_DOUBLE = 0x1; + public final static byte VT_BOOLEAN = 0x2; + public final static byte VT_STRING = 0x3; + //public final static byte VT_NULL = 0x6; + public final static byte VT_BLOB = 0x7; + public final static byte VT_INF_MIN = 0x9; + public final static byte VT_INF_MAX = 0xa; + public final static byte VT_AUTO_INCREMENT = 0xb; + + public static String printTag(int tag) { + switch (tag) { + case TAG_ROW_PK: + return "TAG_ROW_PK"; + case TAG_ROW_DATA: + return "TAG_ROW_DATA"; + case TAG_CELL: + return "TAG_CELL"; + case TAG_CELL_NAME: + return "TAG_CELL_NAME"; + case TAG_CELL_VALUE: + return "TAG_CELL_VALUE"; + case TAG_CELL_TYPE: + return "TAG_CELL_TYPE"; + case TAG_CELL_TIMESTAMP: + return "TAG_CELL_TIMESTAMP"; + case TAG_DELETE_ROW_MARKER: + return "TAG_DELETE_ROW_MARKER"; + case TAG_ROW_CHECKSUM: + return "TAG_ROW_CHECKSUM"; + case TAG_CELL_CHECKSUM: + return "TAG_CELL_CHECKSUM"; + case TAG_SEQ_INFO: + return "TAG_SEQ_INFO"; + case TAG_SEQ_INFO_EPOCH: + return "TAG_SEQ_INFO_EPOCH"; + case TAG_SEQ_INFO_TS: + return "TAG_SEQ_INFO_TS"; + case TAG_SEQ_INFO_ROW_INDEX: + return "TAG_SEQ_INFO_ROW_INDEX"; + case TAG_EXTENSION: + return "TAG_EXTENSION"; + default: + return "UNKNOWN_TAG(" + tag + ")"; + } + } + + public static boolean isUnknownTag(int tag) { + switch (tag) { + case TAG_ROW_PK: + case TAG_ROW_DATA: + case TAG_CELL: + case TAG_CELL_NAME: + case TAG_CELL_VALUE: + case TAG_CELL_TYPE: + case TAG_CELL_TIMESTAMP: + case TAG_DELETE_ROW_MARKER: + case TAG_ROW_CHECKSUM: + case TAG_CELL_CHECKSUM: + case TAG_SEQ_INFO: + case TAG_SEQ_INFO_EPOCH: + case TAG_SEQ_INFO_TS: + case TAG_SEQ_INFO_ROW_INDEX: + case TAG_EXTENSION: + return false; + default: + return true; + } + } + + public static boolean isTagInExtension(int tag) { + if (tag == TAG_SEQ_INFO) { + return true; + } else if (isUnknownTag(tag)) { + return true; + } else { + return false; + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConversion.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConversion.java new file mode 100644 index 0000000..1dd6e17 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferConversion.java @@ -0,0 +1,182 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ActionType; +import com.alicloud.openservices.tablestore.model.*; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class PlainBufferConversion { + public static Row toRow(PlainBufferRow plainBufferRow) throws IOException { + if (plainBufferRow.hasDeleteMarker()) { + throw new IOException("Row could not has delete marker: " + plainBufferRow); + } + + if (plainBufferRow.getPrimaryKey() == null) { + throw new IOException("Row has no primary key: " + plainBufferRow); + } + + List columns = new ArrayList(plainBufferRow.getCells().size()); + + for (PlainBufferCell cell : plainBufferRow.getCells()) { + columns.add(toColumn(cell)); + } + + return new Row(toPrimaryKey(plainBufferRow.getPrimaryKey()), columns); + } + + public static Column toColumn(PlainBufferCell cell) throws IOException { + if (!cell.hasCellName() || !cell.hasCellValue()) { + throw new IOException("The cell has no name or value: " + cell); + } + + if (cell.hasCellType() && + cell.getCellType() != PlainBufferConsts.INCREMENT) { + throw new IOException("The cell should not has type: " + cell); + } + + if (cell.hasCellTimestamp()) { + return new Column(cell.getCellName(), cell.getCellValue(), cell.getCellTimestamp()); + } else { + return new Column(cell.getCellName(), cell.getCellValue()); + } + } + + public static RecordColumn toRecordColumn(PlainBufferCell cell) throws IOException { + if (!cell.hasCellName()) { + throw new IOException("The cell has no name:" + cell); + } + + ColumnValue value = ColumnValue.INTERNAL_NULL_VALUE; + if (cell.hasCellValue()) { + value = cell.getCellValue(); + } + + Column column = null; + + if (cell.hasCellTimestamp()) { + column = new Column(cell.getCellName(), value, cell.getCellTimestamp()); + } else { + column = new Column(cell.getCellName(), value); + } + + RecordColumn.ColumnType columnType = RecordColumn.ColumnType.PUT; + + if (!cell.hasCellType()) { + if (!cell.hasCellValue() || !cell.hasCellTimestamp()) { + throw new IOException("The cell should have both value and timestamp: " + cell); + } + } else { + switch (cell.getCellType()) { + case PlainBufferConsts.DELETE_ONE_VERSION: + if (cell.hasCellValue() || !cell.hasCellTimestamp()) { + throw new IOException( + "The cell with type DELETE_ONE_VERSION should not have value but should have timestamp: " + + cell); + } + columnType = RecordColumn.ColumnType.DELETE_ONE_VERSION; + break; + case PlainBufferConsts.DELETE_ALL_VERSION: + if (cell.hasCellValue() || cell.hasCellTimestamp()) { + throw new IOException( + "The cell with type DELETE_ALL_VERSION should not have value and timestamp: " + cell); + } + columnType = RecordColumn.ColumnType.DELETE_ALL_VERSION; + break; + default: + throw new IOException("Unknown cell type:" + cell.getCellType()); + } + } + + return new RecordColumn(column, columnType); + } + + public static PrimaryKey toPrimaryKey(List pkCells) throws IOException { + List primaryKeyColumns = new ArrayList(); + for (PlainBufferCell cell : pkCells) { + primaryKeyColumns.add( + new PrimaryKeyColumn(cell.getCellName(), PrimaryKeyValue.fromColumn(cell.getCellValue()))); + } + return new PrimaryKey(primaryKeyColumns); + } + + public static PlainBufferCell toPlainBufferCell(PrimaryKeyColumn primaryKeyColumn) throws IOException { + PlainBufferCell cell = new PlainBufferCell(); + cell.setCellName(primaryKeyColumn.getName()); + cell.setPkCellValue(primaryKeyColumn.getValue()); + return cell; + } + + public static PlainBufferCell toPlainBufferCell(Column column, boolean ignoreValue, boolean ignoreTs, + boolean setType, byte type) throws IOException { + PlainBufferCell cell = new PlainBufferCell(); + cell.setCellName(column.getName()); + if (!ignoreValue) { + cell.setCellValue(column.getValue()); + } + if (!ignoreTs) { + if (column.hasSetTimestamp()) { + cell.setCellTimestamp(column.getTimestamp()); + } + } + if (setType) { + cell.setCellType(type); + } + return cell; + } + + public static StreamRecord toStreamRecord(PlainBufferRow pbRow, OtsInternalApi.ActionType actionType) + throws IOException { + StreamRecord record = new StreamRecord(); + switch (actionType) { + case PUT_ROW: + record.setRecordType(StreamRecord.RecordType.PUT); + break; + case UPDATE_ROW: + record.setRecordType(StreamRecord.RecordType.UPDATE); + break; + case DELETE_ROW: + record.setRecordType(StreamRecord.RecordType.DELETE); + break; + default: + throw new IOException("Unknown stream record action type:" + actionType.name()); + } + + record.setPrimaryKey(toPrimaryKey(pbRow.getPrimaryKey())); + + List columns = new ArrayList(); + for (PlainBufferCell cell : pbRow.getCells()) { + columns.add(toRecordColumn(cell)); + } + record.setColumns(columns); + + int epoch = pbRow.getExtension().getSequenceInfo().getEpoch(); + long ts = pbRow.getExtension().getSequenceInfo().getTimestamp(); + int rowIndex = pbRow.getExtension().getSequenceInfo().getRowIndex(); + RecordSequenceInfo seq = new RecordSequenceInfo(epoch, ts, rowIndex); + record.setSequenceInfo(seq); + + return record; + } + + public static StreamRecord toStreamRecord(PlainBufferRow pbRow, TunnelServiceApi.ActionType actionType) + throws IOException { + OtsInternalApi.ActionType atype; + switch (actionType) { + case PUT_ROW: + atype = ActionType.PUT_ROW; + break; + case UPDATE_ROW: + atype = ActionType.UPDATE_ROW; + break; + case DELETE_ROW: + atype = ActionType.DELETE_ROW; + break; + default: + throw new IOException("Unknown stream record action type:" + actionType.name()); + } + + return toStreamRecord(pbRow, atype); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCrc8.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCrc8.java new file mode 100644 index 0000000..2589777 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferCrc8.java @@ -0,0 +1,95 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import java.io.IOException; + +/** + * 采用crc-8-ATM规范 + * 多项式: x^8 + x^2 + x + 1 + * + */ +public class PlainBufferCrc8 { + + private static final int spaceSize = 256; + private static byte[] crc8Table = new byte[spaceSize]; + + static { + for (int i = 0; i < crc8Table.length; ++i) { + byte x = (byte) i; + for (int j = 8; j > 0; --j) { + x = (byte) ((x << 1) ^ (((x & 0x80) != 0) ? 0x07 : 0)); + } + crc8Table[i] = x; + } + } + + public static byte crc8(byte crc, byte in) { + crc = crc8Table[(crc ^ in) & 0xff]; + return crc; + } + + public static byte crc8(byte crc, int in) { + for (int i = 0; i < 4; i++) { + crc = crc8(crc, (byte)(in & 0xff)); + in >>= 8; + } + return crc; + } + + public static byte crc8(byte crc, long in) { + for (int i = 0; i < 8; i++) { + crc = crc8(crc, (byte)(in & 0xff)); + in >>= 8; + } + return crc; + } + + public static byte crc8(byte crc, byte[] in) { + for (int i = 0; i < in.length; i++) { + crc = crc8(crc, in[i]); + } + return crc; + } + + public static byte getChecksum(byte crc, PlainBufferCell cell) throws IOException { + + if (cell.hasCellName()) { + crc = crc8(crc, cell.getNameRawData()); + } + + if (cell.hasCellValue()) { + if (cell.isPk()) { + crc = cell.getPkCellValue().getChecksum(crc); + } else { + crc = cell.getCellValue().getChecksum(crc); + } + } + + if (cell.hasCellTimestamp()) { + crc = crc8(crc, cell.getCellTimestamp()); + } + + if (cell.hasCellType()) { + crc = crc8(crc, cell.getCellType()); + } + + return crc; + } + + public static byte getChecksum(byte crc, PlainBufferRow row) throws IOException { + for (PlainBufferCell cell : row.getPrimaryKey()) { + crc = crc8(crc, cell.getChecksum()); + } + + for (PlainBufferCell cell : row.getCells()) { + crc = crc8(crc, cell.getChecksum()); + } + + byte del = 0; + if (row.hasDeleteMarker()) { + del = (byte)0x1; + } + crc = crc8(crc, del); + + return crc; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferExtension.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferExtension.java new file mode 100644 index 0000000..c540b11 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferExtension.java @@ -0,0 +1,34 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +public class PlainBufferExtension { + + private PlainBufferSequenceInfo sequenceInfo; + + + public PlainBufferExtension() + { + this.sequenceInfo = new PlainBufferSequenceInfo(); + } + public void setSequenceInfo(PlainBufferSequenceInfo sequenceInfo) { + this.sequenceInfo = sequenceInfo; + } + + public PlainBufferSequenceInfo getSequenceInfo() { + return sequenceInfo; + } + + public boolean hasSeq() { + return sequenceInfo.getHasSeq(); + } + + @Override + public String toString(){ + StringBuilder sb = new StringBuilder(); + if (hasSeq()) { + sb.append(" SequenceInfo: {"); + sb.append(getSequenceInfo()); + sb.append("}"); + } + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferInputStream.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferInputStream.java new file mode 100644 index 0000000..d6fa20c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferInputStream.java @@ -0,0 +1,116 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.utils.BinaryUtil; + +import java.io.IOException; +import java.nio.ByteBuffer; + +public class PlainBufferInputStream { + + private ByteBuffer buffer; + private int lastTag; + + public PlainBufferInputStream(ByteBuffer buffer) { + this.buffer = buffer; + this.lastTag = 0; + } + + public PlainBufferInputStream(byte[] buffer) { + this(ByteBuffer.wrap(buffer)); + } + + public boolean isAtEnd() { + return !buffer.hasRemaining(); + } + + public int readTag() throws IOException { + if (isAtEnd()) { + lastTag = 0; + return 0; + } + + lastTag = readRawByte(); + return lastTag; + } + + public boolean checkLastTagWas(int tag) { + return lastTag == tag; + } + + public int getLastTag() { + return lastTag; + } + + public byte readRawByte() throws IOException { + if (isAtEnd()) { + throw new IOException("Read raw byte encountered EOF."); + } + return buffer.get(); + } + + public long readRawLittleEndian64() throws IOException { + final byte b1 = readRawByte(); + final byte b2 = readRawByte(); + final byte b3 = readRawByte(); + final byte b4 = readRawByte(); + final byte b5 = readRawByte(); + final byte b6 = readRawByte(); + final byte b7 = readRawByte(); + final byte b8 = readRawByte(); + return (((long) b1 & 0xff)) | + (((long) b2 & 0xff) << 8) | + (((long) b3 & 0xff) << 16) | + (((long) b4 & 0xff) << 24) | + (((long) b5 & 0xff) << 32) | + (((long) b6 & 0xff) << 40) | + (((long) b7 & 0xff) << 48) | + (((long) b8 & 0xff) << 56); + } + + public int readRawLittleEndian32() throws IOException { + final byte b1 = readRawByte(); + final byte b2 = readRawByte(); + final byte b3 = readRawByte(); + final byte b4 = readRawByte(); + return (((int) b1 & 0xff)) | + (((int) b2 & 0xff) << 8) | + (((int) b3 & 0xff) << 16) | + (((int) b4 & 0xff) << 24); + } + + public boolean readBoolean() throws IOException { + return readRawByte() != 0; + } + + public double readDouble() throws IOException { + return Double.longBitsToDouble(readRawLittleEndian64()); + } + + public int readUInt32() throws IOException { + return readRawLittleEndian32(); + } + + public long readInt64() throws IOException { + return readRawLittleEndian64(); + } + + public byte[] readBytes(int size) throws IOException { + if (buffer.remaining() < size) { + throw new IOException("Read bytes encountered EOF."); + } + + byte[] result = new byte[size]; + buffer.get(result, 0, size); + return result; + } + + public String readUTFString(int size) throws IOException { + return new String(readBytes(size), Constants.UTF8_ENCODING); + } + + @Override + public String toString() { + return BinaryUtil.toString(this.buffer); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferOutputStream.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferOutputStream.java new file mode 100644 index 0000000..f40538a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferOutputStream.java @@ -0,0 +1,92 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.io.IOException; + +public class PlainBufferOutputStream { + + private byte[] buffer; + private int capacity; + private int pos; + + public PlainBufferOutputStream(int capacity) { + Preconditions.checkArgument(capacity > 0, "The capacity of output stream must be greater than 0."); + buffer = new byte[capacity]; + this.capacity = capacity; + } + + public byte[] getBuffer() { + return buffer; + } + + public boolean isFull() { + return pos == capacity; + } + + public int count() { + return pos; + } + + public int remain() { + return capacity - pos; + } + + public void clear() { + this.pos = 0; + } + + public void writeRawByte(final byte value) throws IOException { + if (pos == capacity) { + throw new IOException("The buffer is full."); + } + buffer[pos++] = value; + } + + public void writeRawByte(final int value) throws IOException { + writeRawByte((byte) value); + } + + /** + * Write a little-endian 32-bit integer. + */ + public void writeRawLittleEndian32(final int value) throws IOException { + writeRawByte((value) & 0xFF); + writeRawByte((value >> 8) & 0xFF); + writeRawByte((value >> 16) & 0xFF); + writeRawByte((value >> 24) & 0xFF); + } + + /** + * Write a little-endian 64-bit integer. + */ + public void writeRawLittleEndian64(final long value) throws IOException { + writeRawByte((int) (value) & 0xFF); + writeRawByte((int) (value >> 8) & 0xFF); + writeRawByte((int) (value >> 16) & 0xFF); + writeRawByte((int) (value >> 24) & 0xFF); + writeRawByte((int) (value >> 32) & 0xFF); + writeRawByte((int) (value >> 40) & 0xFF); + writeRawByte((int) (value >> 48) & 0xFF); + writeRawByte((int) (value >> 56) & 0xFF); + } + + public void writeDouble(final double value) throws IOException { + writeRawLittleEndian64(Double.doubleToRawLongBits(value)); + } + + public void writeBoolean(final boolean value) throws IOException { + writeRawByte(value ? 1 : 0); + } + + public void writeBytes(final byte[] bytes) throws IOException { + if (pos + bytes.length > capacity) { + throw new IOException("The buffer is full."); + } + System.arraycopy(bytes, 0, buffer, pos, bytes.length); + pos += bytes.length; + } + + public static final int LITTLE_ENDIAN_32_SIZE = 4; + public static final int LITTLE_ENDIAN_64_SIZE = 8; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferRow.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferRow.java new file mode 100644 index 0000000..de12b41 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferRow.java @@ -0,0 +1,100 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import java.io.IOException; +import java.util.List; + +public class PlainBufferRow { + private List primaryKey; + + private List cells; + + private boolean hasDeleteMarker = false; + + private byte checksum; + private boolean hasChecksum = false; + private PlainBufferExtension extension; + + public PlainBufferRow(List primaryKey, List cells, boolean hasDeleteMarker) { + this.primaryKey = primaryKey; + this.cells = cells; + this.hasDeleteMarker = hasDeleteMarker; + this.extension = new PlainBufferExtension(); + } + + public List getPrimaryKey() { + return primaryKey; + } + + public void setPrimaryKey(List primaryKey) { + this.primaryKey = primaryKey; + this.hasChecksum = false; + } + + public List getCells() { + return cells; + } + + public void addCell(PlainBufferCell cell) { + this.cells.add(cell); + this.hasChecksum = false; + } + + public boolean hasCells() { + return !this.cells.isEmpty(); + } + + public boolean hasDeleteMarker() { + return hasDeleteMarker; + } + + public void setHasDeleteMarker(boolean hasDeleteMarker) { + this.hasDeleteMarker = hasDeleteMarker; + this.hasChecksum = false; + } + + public PlainBufferExtension getExtension() { + return extension; + } + + public void setExtension(PlainBufferExtension extension) { + this.extension = extension; + } + + public boolean hasExtension() { + return extension.hasSeq(); + } + + /** + * 会自动计算当前的checksum并返回,当没有数据变化时,checksum会缓存在对象中,以减少不必要的计算。 + * @return + * @throws IOException + */ + public byte getChecksum() throws IOException { + if (!this.hasChecksum) { + generateChecksum(); + } + return this.checksum; + } + + private void generateChecksum() throws IOException { + this.checksum = PlainBufferCrc8.getChecksum((byte)0x0, this); + this.hasChecksum = true; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("PrimaryKey: ").append(primaryKey); + sb.append("Cells: "); + for (PlainBufferCell cell : cells) { + sb.append("[").append(cell).append("]"); + } + sb.append(" HasDeleteMarker: " + hasDeleteMarker()); + if (hasExtension()) { + sb.append(" Extension: {"); + sb.append(getExtension()); + sb.append("}"); + } + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferSequenceInfo.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferSequenceInfo.java new file mode 100644 index 0000000..2eead6d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/PlainBufferSequenceInfo.java @@ -0,0 +1,47 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +public class PlainBufferSequenceInfo { + + private int epoch = 0; + private long timestamp = 0; + private int rowIndex = 0; + private boolean hasSeq = false; + + public int getEpoch() { + return epoch; + } + + void setEpoch(int epoch) { + this.epoch = epoch; + this.hasSeq = true; + } + public long getTimestamp() { + return timestamp; + } + + void setTimestamp(long timestamp) { + this.timestamp = timestamp; + this.hasSeq = true; + } + public int getRowIndex() { + return rowIndex; + } + + void setRowIndex(int rowIndex) { + this.rowIndex = rowIndex; + this.hasSeq = true; + } + + public boolean getHasSeq() { + return hasSeq; + } + + @Override + public String toString(){ + StringBuilder sb = new StringBuilder(); + sb.append("Epoch: " + epoch); + sb.append(", Timestamp: " + timestamp); + sb.append(", RowIndex: " + rowIndex); + return sb.toString(); + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/ProtocolBufferParser.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ProtocolBufferParser.java old mode 100755 new mode 100644 similarity index 55% rename from src/main/java/com/aliyun/openservices/ots/internal/ProtocolBufferParser.java rename to src/main/java/com/alicloud/openservices/tablestore/core/protocol/ProtocolBufferParser.java index 2f9fc8a..8b76eda --- a/src/main/java/com/aliyun/openservices/ots/internal/ProtocolBufferParser.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ProtocolBufferParser.java @@ -1,21 +1,19 @@ -package com.aliyun.openservices.ots.internal; +package com.alicloud.openservices.tablestore.core.protocol; + +import java.util.Map; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.comm.ResponseMessage; -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.OTSResult; -import com.aliyun.openservices.ots.parser.ResultParseException; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.utils.ResourceManager; -import com.aliyun.openservices.ots.utils.ServiceConstants; -import com.google.protobuf.Message; -import com.google.protobuf.UninitializedMessageException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.protobuf.Message; +import com.google.protobuf.UninitializedMessageException; -import java.util.Map; - -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.OTS_HEADER_REQUEST_ID; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.Response; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.http.ResponseMessage; +import com.alicloud.openservices.tablestore.core.protocol.ResultParseException; +import com.alicloud.openservices.tablestore.core.protocol.ResultParser; public class ProtocolBufferParser implements ResultParser { @@ -31,15 +29,16 @@ public ProtocolBufferParser(Message message, String traceId) { } @Override - public Object getObject(ResponseMessage response) throws ResultParseException { + public Object getObject(ResponseMessage response) + throws ResultParseException { Map headers = response.getHeadersMap(); - String requestId = headers.get(OTS_HEADER_REQUEST_ID); + String requestId = headers.get(Constants.OTS_HEADER_REQUEST_ID); if (requestId == null){ - throw new ClientException("The required header is missing: " + OTS_HEADER_REQUEST_ID); + throw new ClientException("The required header is missing: " + Constants.OTS_HEADER_REQUEST_ID); } - + try { Message result = message.newBuilderForType().mergeFrom(response.getContent()).buildPartial(); if (!result.isInitialized()) { @@ -53,11 +52,9 @@ public Object getObject(ResponseMessage response) throws ResultParseException { return new ResponseContentWithMeta( result, - new OTSResult(headers.get(OTS_HEADER_REQUEST_ID))); + new Response(requestId)); } catch(Exception e) { - throw new ResultParseException( - ResourceManager.getInstance(ServiceConstants.RESOURCE_NAME_COMMON) - .getString("FailedToParseResponse"), e); + throw new ResultParseException("Failed to parse response as protocol buffer message.", e); } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResponseFactory.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResponseFactory.java new file mode 100644 index 0000000..1a151f2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResponseFactory.java @@ -0,0 +1,712 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.ResponseContentWithMeta; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.ComputeSplitPointsBySizeResponse.SplitLocation; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.Split; +import com.alicloud.openservices.tablestore.model.search.*; +import com.alicloud.openservices.tablestore.model.tunnel.ChannelInfo; +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; +import com.alicloud.openservices.tablestore.model.tunnel.ChannelType; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelInfo; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelStage; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelType; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelResponse; +import com.google.protobuf.ByteString; + +public class ResponseFactory { + + public static CreateTableResponse createCreateTableResponse(ResponseContentWithMeta response, + OtsInternalApi.CreateTableResponse + createTableResponse) { + return new CreateTableResponse(response.getMeta()); + } + + public static ListTableResponse createListTableResponse(ResponseContentWithMeta response, + OtsInternalApi.ListTableResponse listTableResponse) { + ListTableResponse result = new ListTableResponse(response.getMeta()); + result.setTableNames(listTableResponse.getTableNamesList()); + return result; + } + + public static DescribeTableResponse createDescribeTableResponse(ResponseContentWithMeta response, + OtsInternalApi.DescribeTableResponse + describeTableResponse) { + try { + DescribeTableResponse result = new DescribeTableResponse(response.getMeta()); + result.setTableMeta(OTSProtocolParser.parseTableMeta(describeTableResponse.getTableMeta())); + result.setTableOptions(OTSProtocolParser.parseTableOptions(describeTableResponse.getTableOptions())); + result.setReservedThroughputDetails(OTSProtocolParser + .parseReservedThroughputDetails(describeTableResponse.getReservedThroughputDetails())); + if (describeTableResponse.hasStreamDetails()) { + result.setStreamDetails(OTSProtocolParser.parseStreamDetails(describeTableResponse.getStreamDetails())); + } + + List shards = new ArrayList(); + for (int i = 0; i < describeTableResponse.getShardSplitsCount(); ++i) { + com.google.protobuf.ByteString bytes = describeTableResponse.getShardSplits(i); + PlainBufferCodedInputStream coded = new PlainBufferCodedInputStream( + new PlainBufferInputStream(bytes.asReadOnlyByteBuffer())); + List rows = coded.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + Row row = PlainBufferConversion.toRow(rows.get(0)); + shards.add(row.getPrimaryKey()); + } + result.setShardSplits(shards); + for (int i = 0; i < describeTableResponse.getIndexMetasCount(); ++i) { + result.addIndexMeta(OTSProtocolParser.parseIndexMeta(describeTableResponse.getIndexMetas(i))); + } + return result; + } catch (Exception e) { + throw new ClientException("Failed to parse describe table response.", e); + } + } + + public static DeleteTableResponse createDeleteTableResponse(ResponseContentWithMeta response, + OtsInternalApi.DeleteTableResponse + deleteTableResponse) { + return new DeleteTableResponse(response.getMeta()); + } + + public static CreateIndexResponse createCreteIndexResponse( + ResponseContentWithMeta response, + OtsInternalApi.CreateIndexResponse createIndexResponse) { + return new CreateIndexResponse(response.getMeta()); + } + + public static DeleteIndexResponse createDeleteIndexResponse( + ResponseContentWithMeta response, + OtsInternalApi.DropIndexResponse dropIndexResponse) { + return new DeleteIndexResponse(response.getMeta()); + } + + public static UpdateTableResponse createUpdateTableResponse(ResponseContentWithMeta response, + OtsInternalApi.UpdateTableResponse + updateTableResponse) { + UpdateTableResponse result = new UpdateTableResponse(response.getMeta()); + result.setReservedThroughputDetails( + OTSProtocolParser.parseReservedThroughputDetails(updateTableResponse.getReservedThroughputDetails())); + + if (updateTableResponse.hasStreamDetails()) { + result.setStreamDetails(OTSProtocolParser.parseStreamDetails(updateTableResponse.getStreamDetails())); + } + return result; + } + + public static GetRowResponse createGetRowResponse(ResponseContentWithMeta response, + OtsInternalApi.GetRowResponse getRowResponse) { + ConsumedCapacity consumedCapacity = new ConsumedCapacity( + OTSProtocolParser.parseCapacityUnit(getRowResponse.getConsumed().getCapacityUnit())); + Row row = null; + if (!getRowResponse.getRow().isEmpty()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(getRowResponse.getRow().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + row = PlainBufferConversion.toRow(rows.get(0)); + } catch (Exception e) { + throw new ClientException("Failed to parse row", e); + } + } + GetRowResponse result = new GetRowResponse(response.getMeta(), row, consumedCapacity); + if (getRowResponse.hasNextToken()) { + result.setNextToken(getRowResponse.getNextToken().toByteArray()); + } + return result; + } + + public static PutRowResponse createPutRowResponse(ResponseContentWithMeta response, + OtsInternalApi.PutRowResponse putRowResponse) { + ConsumedCapacity consumedCapacity = new ConsumedCapacity( + OTSProtocolParser.parseCapacityUnit(putRowResponse.getConsumed().getCapacityUnit())); + Row row = null; + if (!putRowResponse.getRow().isEmpty()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(putRowResponse.getRow().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + row = PlainBufferConversion.toRow(rows.get(0)); + } catch (Exception e) { + throw new ClientException("Failed to parse row", e); + } + } + + PutRowResponse result = new PutRowResponse(response.getMeta(), row, consumedCapacity); + return result; + } + + public static UpdateRowResponse createUpdateRowResponse(ResponseContentWithMeta response, + OtsInternalApi.UpdateRowResponse updateRowResponse) { + ConsumedCapacity consumedCapacity = new ConsumedCapacity( + OTSProtocolParser.parseCapacityUnit(updateRowResponse.getConsumed().getCapacityUnit())); + Row row = null; + if (!updateRowResponse.getRow().isEmpty()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(updateRowResponse.getRow().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + row = PlainBufferConversion.toRow(rows.get(0)); + } catch (Exception e) { + throw new ClientException("Failed to parse row", e); + } + } + + UpdateRowResponse result = new UpdateRowResponse(response.getMeta(), row, consumedCapacity); + return result; + } + + public static DeleteRowResponse createDeleteRowResponse(ResponseContentWithMeta response, + OtsInternalApi.DeleteRowResponse deleteRowResponse) { + ConsumedCapacity consumedCapacity = new ConsumedCapacity( + OTSProtocolParser.parseCapacityUnit(deleteRowResponse.getConsumed().getCapacityUnit())); + Row row = null; + if (!deleteRowResponse.getRow().isEmpty()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(deleteRowResponse.getRow().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + row = PlainBufferConversion.toRow(rows.get(0)); + } catch (Exception e) { + throw new ClientException("Failed to parse row", e); + } + } + + DeleteRowResponse result = new DeleteRowResponse(response.getMeta(), row, consumedCapacity); + return result; + } + + public static GetRangeResponse createGetRangeResponse(ResponseContentWithMeta response, + OtsInternalApi.GetRangeResponse getRangeResponse) { + try { + ConsumedCapacity consumedCapacity = new ConsumedCapacity( + OTSProtocolParser.parseCapacityUnit(getRangeResponse.getConsumed().getCapacityUnit())); + GetRangeResponse result = new GetRangeResponse(response.getMeta(), consumedCapacity); + + if (!getRangeResponse.hasNextStartPrimaryKey()) { + // has no next primary key + result.setNextStartPrimaryKey(null); + } else { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(getRangeResponse.getNextStartPrimaryKey().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + PlainBufferRow row = rows.get(0); + if (row.hasDeleteMarker() || row.hasCells()) { + throw new IOException("The next primary key should only have primary key: " + row); + } + + result.setNextStartPrimaryKey(PlainBufferConversion.toPrimaryKey(row.getPrimaryKey())); + } + + if (!getRangeResponse.getRows().isEmpty()) { + List rows = new ArrayList(); + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(getRangeResponse.getRows().asReadOnlyByteBuffer())); + List pbRows = inputStream.readRowsWithHeader(); + for (PlainBufferRow pbRow : pbRows) { + rows.add(PlainBufferConversion.toRow(pbRow)); + } + result.setRows(rows); + } else { + result.setRows(new ArrayList()); + } + + if (getRangeResponse.hasNextToken()) { + result.setNextToken(getRangeResponse.getNextToken().toByteArray()); + } + + return result; + } catch (Exception e) { + throw new ClientException("Failed to parse get range response.", e); + } + } + + public static ComputeSplitsBySizeResponse createComputeSplitsBySizeResponse(ResponseContentWithMeta response, + OtsInternalApi + .ComputeSplitPointsBySizeResponse + computeSplitPointsBySizeResponse) { + ComputeSplitsBySizeResponse result = new ComputeSplitsBySizeResponse(response.getMeta()); + + ConsumedCapacity consumedCapacity = new ConsumedCapacity( + OTSProtocolParser.parseCapacityUnit(computeSplitPointsBySizeResponse.getConsumed().getCapacityUnit())); + result.setConsumedCapacity(consumedCapacity); + + List schemaList + = computeSplitPointsBySizeResponse + .getSchemaList(); + for (com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi.PrimaryKeySchema pks : schemaList) { + if (pks.hasOption()) { + result.addPrimaryKeySchema(pks.getName(), OTSProtocolParser.toPrimaryKeyType(pks.getType()), + OTSProtocolParser.toPrimaryKeyOption(pks.getOption())); + } else { + result.addPrimaryKeySchema(pks.getName(), OTSProtocolParser.toPrimaryKeyType(pks.getType())); + } + } + + List infStartColumns = new ArrayList(); + List infEndColumns = new ArrayList(); + for (PrimaryKeySchema pks : result.getPrimaryKeySchema()) { + infEndColumns.add(new PrimaryKeyColumn(pks.getName(), PrimaryKeyValue.INF_MAX)); + infStartColumns.add(new PrimaryKeyColumn(pks.getName(), PrimaryKeyValue.INF_MIN)); + } + PrimaryKey infStart = new PrimaryKey(infStartColumns); + PrimaryKey infEnd = new PrimaryKey(infEndColumns); + PrimaryKey lastStartPoint = infStart; + + for (int iter = 0; iter < computeSplitPointsBySizeResponse.getSplitPointsCount(); ++iter) { + Split split = new Split(); + split.setLowerBound(lastStartPoint); + + Row row = null; + try { + ByteString bss = computeSplitPointsBySizeResponse.getSplitPoints(iter); + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(bss.asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() <= 0) { + throw new ClientException("The parsed response rows' length is zero."); + } + row = PlainBufferConversion.toRow(rows.get(0)); + } catch (Exception e) { + throw new ClientException("Failed to parse row data.", e); + } + PrimaryKey primaryKeys = row.getPrimaryKey(); + List pkcl = new ArrayList(); + for (PrimaryKeyColumn pkcc : primaryKeys.getPrimaryKeyColumns()) { + pkcl.add(pkcc); + } + for (int loc = pkcl.size(); loc < result.getPrimaryKeySchema().size(); ++loc) { + pkcl.add(new PrimaryKeyColumn(result.getPrimaryKeySchema().get(loc).getName(), + PrimaryKeyValue.INF_MIN)); + } + primaryKeys = new PrimaryKey(pkcl); + split.setUpperBound(primaryKeys); + lastStartPoint = primaryKeys; + + result.addSplit(split); + } + // To insert the last split element. + Split split = new Split(); + split.setLowerBound(lastStartPoint); + split.setUpperBound(infEnd); + result.addSplit(split); + + int splitPointIter = 0; + for (SplitLocation sl : computeSplitPointsBySizeResponse.getLocationsList()) { + for (long sli = 0; sli < sl.getRepeat(); ++sli) { + if (splitPointIter >= result.getSplits().size()) { + throw new ClientException( + "The location list's length is not correct. Location list size: " + splitPointIter + + ". Split list size: " + result.getSplits().size()); + } + result.getSplits().get(splitPointIter).setLocation(sl.getLocation()); + ++splitPointIter; + } + } + if (splitPointIter != result.getSplits().size()) { + throw new ClientException("The location list's length is not correct. Location list size: " + splitPointIter + + ". Split list size: " + result.getSplits().size()); + } + + return result; + } + + public static BatchGetRowResponse createBatchGetRowResponse(ResponseContentWithMeta response, + OtsInternalApi.BatchGetRowResponse + batchGetRowResponse) { + BatchGetRowResponse result = new BatchGetRowResponse(response.getMeta()); + + for (OtsInternalApi.TableInBatchGetRowResponse table : batchGetRowResponse.getTablesList()) { + String tableName = table.getTableName(); + List rowList = table.getRowsList(); + for (int i = 0; i < rowList.size(); i++) { + result.addResult(OTSProtocolParser.parseBatchGetRowStatus(tableName, rowList.get(i), i)); + } + } + return result; + } + + public static BatchWriteRowResponse createBatchWriteRowResponse(ResponseContentWithMeta response, + OtsInternalApi.BatchWriteRowResponse + batchWriteRowResponse) { + BatchWriteRowResponse result = new BatchWriteRowResponse(response.getMeta()); + + for (OtsInternalApi.TableInBatchWriteRowResponse table : batchWriteRowResponse.getTablesList()) { + String tableName = table.getTableName(); + + List statuses = table.getRowsList(); + for (int i = 0; i < statuses.size(); i++) { + result.addRowResult(OTSProtocolParser.parseBatchWriteRowStatus(tableName, statuses.get(i), i)); + } + } + + return result; + } + + public static ListStreamResponse createListStreamResponse(ResponseContentWithMeta response, + OtsInternalApi.ListStreamResponse listStreamResponse) { + ListStreamResponse result = new ListStreamResponse(response.getMeta()); + List streams = new ArrayList(); + for (OtsInternalApi.Stream stream : listStreamResponse.getStreamsList()) { + streams.add(OTSProtocolParser.parseStream(stream)); + } + result.setStreams(streams); + return result; + } + + public static DescribeStreamResponse createDescribeStreamResponse(ResponseContentWithMeta response, + OtsInternalApi.DescribeStreamResponse + describeStreamResponse) { + DescribeStreamResponse result = new DescribeStreamResponse(response.getMeta()); + result.setStreamId(describeStreamResponse.getStreamId()); + result.setExpirationTime(describeStreamResponse.getExpirationTime()); + result.setTableName(describeStreamResponse.getTableName()); + result.setCreationTime(describeStreamResponse.getCreationTime()); + result.setStatus(OTSProtocolParser.parseStreamStatus(describeStreamResponse.getStreamStatus())); + List shards = new ArrayList(); + for (OtsInternalApi.StreamShard shard : describeStreamResponse.getShardsList()) { + shards.add(OTSProtocolParser.parseStreamShard(shard)); + } + result.setShards(shards); + if (describeStreamResponse.hasNextShardId()) { + result.setNextShardId(describeStreamResponse.getNextShardId()); + } + return result; + } + + public static GetShardIteratorResponse createGetShardIteratorResponse(ResponseContentWithMeta response, + OtsInternalApi.GetShardIteratorResponse + getShardIteratorResponse) { + GetShardIteratorResponse result = new GetShardIteratorResponse(response.getMeta()); + result.setShardIterator(getShardIteratorResponse.getShardIterator()); + return result; + } + + public static GetStreamRecordResponse createGetStreamRecordResponse(ResponseContentWithMeta response, + OtsInternalApi.GetStreamRecordResponse + getStreamRecordResponse) { + GetStreamRecordResponse result = new GetStreamRecordResponse(response.getMeta()); + if (getStreamRecordResponse.hasNextShardIterator()) { + result.setNextShardIterator(getStreamRecordResponse.getNextShardIterator()); + } + + List records = new ArrayList(); + for (OtsInternalApi.GetStreamRecordResponse.StreamRecord respRecord : getStreamRecordResponse + .getStreamRecordsList()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(respRecord.getRecord().asReadOnlyByteBuffer())); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + PlainBufferRow row = rows.get(0); + records.add(PlainBufferConversion.toStreamRecord(row, respRecord.getActionType())); + } catch (Exception e) { + throw new ClientException("Failed to parse row", e); + } + } + + result.setRecords(records); + return result; + } + + public static StartLocalTransactionResponse createStartLocalTransactionResponse(ResponseContentWithMeta response, + OtsInternalApi + .StartLocalTransactionResponse startLocalTransactionResponse) { + StartLocalTransactionResponse result = new StartLocalTransactionResponse(response.getMeta()); + result.setTransactionID(startLocalTransactionResponse.getTransactionId()); + return result; + } + + public static CommitTransactionResponse createCommitTransactionResponse(ResponseContentWithMeta response, + OtsInternalApi.CommitTransactionResponse + commitTransactionResponse) { + return new CommitTransactionResponse(response.getMeta()); + } + + public static AbortTransactionResponse createAbortTransactionResponse(ResponseContentWithMeta response, + OtsInternalApi.AbortTransactionResponse + abortTransactionResponse) { + return new AbortTransactionResponse(response.getMeta()); + } + + public static CreateSearchIndexResponse createCreateSearchIndexResponse(ResponseContentWithMeta response, + Search.CreateSearchIndexResponse + createSearchIndexResponse) { + return new CreateSearchIndexResponse(response.getMeta()); + } + + public static DeleteSearchIndexResponse createDeleteSearchIndexResponse(ResponseContentWithMeta response, + Search.DeleteSearchIndexResponse + deleteSearchIndexResponse) { + return new DeleteSearchIndexResponse(response.getMeta()); + } + + public static ListSearchIndexResponse createListSearchIndexResponse(ResponseContentWithMeta response, + Search.ListSearchIndexResponse + listSearchIndexResponse) { + ListSearchIndexResponse result = new ListSearchIndexResponse(response.getMeta()); + List indexInfos = new ArrayList(); + for (Search.IndexInfo indexInfo : listSearchIndexResponse.getIndicesList()) { + SearchIndexInfo info = new SearchIndexInfo(); + info.setTableName(indexInfo.getTableName()); + info.setIndexName(indexInfo.getIndexName()); + indexInfos.add(info); + } + result.setIndexInfos(indexInfos); + return result; + } + + public static DescribeSearchIndexResponse createDescribeSearchIndexResponse(ResponseContentWithMeta response, + Search.DescribeSearchIndexResponse + describeSearchIndexResponse) { + DescribeSearchIndexResponse result = new DescribeSearchIndexResponse(response.getMeta()); + result.setSchema(SearchProtocolParser.toIndexSchema( + describeSearchIndexResponse.getSchema())); + if (describeSearchIndexResponse.hasSyncStat()) { + result.setSyncStat(SearchProtocolParser.toSyncStat( + describeSearchIndexResponse.getSyncStat())); + } + if (describeSearchIndexResponse.hasMeteringInfo()) { + result.setMeteringInfo(SearchProtocolParser.toMeteringInfo( + describeSearchIndexResponse.getMeteringInfo())); + } + return result; + } + + public static SearchResponse createSearchResponse(ResponseContentWithMeta response, + Search.SearchResponse searchResponse) throws IOException { + SearchResponse result = new SearchResponse(response.getMeta()); + result.setTotalCount(searchResponse.getTotalHits()); + result.setAllSuccess(searchResponse.getIsAllSucceeded()); + List rows = new ArrayList(); + for (int i = 0; i < searchResponse.getRowsCount(); ++i) { + com.google.protobuf.ByteString bytes = searchResponse.getRows(i); + PlainBufferCodedInputStream coded = new PlainBufferCodedInputStream( + new PlainBufferInputStream(bytes.asReadOnlyByteBuffer())); + List plainBufferRows = coded.readRowsWithHeader(); + if (plainBufferRows.size() != 1) { + throw new IOException("Expect only returns one row. Row count: " + rows.size()); + } + Row row = PlainBufferConversion.toRow(plainBufferRows.get(0)); + rows.add(row); + } + if (searchResponse.hasNextToken()) { + result.setNextToken(searchResponse.getNextToken().toByteArray()); + } + result.setRows(rows); + return result; + } + + public static CreateTunnelResponse createCreateTunnelResponse( + ResponseContentWithMeta response, TunnelServiceApi.CreateTunnelResponse tunnelResponse) { + CreateTunnelResponse resp = new CreateTunnelResponse(response.getMeta()); + resp.setTunnelId(tunnelResponse.getTunnelId()); + return resp; + } + + private static TunnelType createTunnelType(String type) { + return TunnelType.valueOf(type); + } + + private static TunnelStage createTunnelStage(String stage) { + return TunnelStage.valueOf(stage); + } + + private static TunnelInfo createTunnelInfo(TunnelServiceApi.TunnelInfo tunnelInfo) { + TunnelInfo actualInfo = new TunnelInfo(); + actualInfo.setTunnelId(tunnelInfo.getTunnelId()); + actualInfo.setTunnelType(createTunnelType(tunnelInfo.getTunnelType())); + actualInfo.setTableName(tunnelInfo.getTableName()); + actualInfo.setInstanceName(tunnelInfo.getInstanceName()); + actualInfo.setStage(createTunnelStage(tunnelInfo.getStage())); + actualInfo.setExpired(tunnelInfo.getExpired()); + actualInfo.setTunnelName(tunnelInfo.getTunnelName()); + return actualInfo; + } + + private static ChannelType createChannelType(String type) { + return ChannelType.valueOf(type); + } + + private static ChannelStatus createChannelStatus(String stage) { + return ChannelStatus.valueOf(stage); + } + + private static ChannelInfo createChannelInfo(TunnelServiceApi.ChannelInfo channelInfo) { + ChannelInfo actualInfo = new ChannelInfo(); + actualInfo.setChannelId(channelInfo.getChannelId()); + actualInfo.setChannelType(createChannelType(channelInfo.getChannelType())); + actualInfo.setChannelStatus(createChannelStatus(channelInfo.getChannelStatus())); + actualInfo.setClientId(channelInfo.getClientId()); + long rpoMillis = channelInfo.getChannelRpo() / 1000000; + actualInfo.setChannelConsumePoint(new Date(rpoMillis)); + actualInfo.setChannelRpo(System.currentTimeMillis() - rpoMillis); + actualInfo.setChannelCount(channelInfo.getChannelCount()); + return actualInfo; + } + + public static ListTunnelResponse createListTunnelResponse( + ResponseContentWithMeta response, TunnelServiceApi.ListTunnelResponse tunnelResponse) { + ListTunnelResponse resp = new ListTunnelResponse(response.getMeta()); + + List actualInfos = new ArrayList(); + for (TunnelServiceApi.TunnelInfo tunnelInfo : tunnelResponse.getTunnelsList()) { + actualInfos.add(createTunnelInfo(tunnelInfo)); + } + resp.setTunnelInfos(actualInfos); + return resp; + } + + public static DescribeTunnelResponse createDescribeTunnelResponse( + ResponseContentWithMeta response, TunnelServiceApi.DescribeTunnelResponse tunnelResponse) { + DescribeTunnelResponse resp = new DescribeTunnelResponse(response.getMeta()); + long rpoMillis = tunnelResponse.getTunnelRpo() / 1000000; + resp.setTunnelConsumePoint(new Date(rpoMillis)); + resp.setTunnelInfo(createTunnelInfo(tunnelResponse.getTunnel())); + List actualInfos = new ArrayList(); + long tunnelRpo = 0; + for (TunnelServiceApi.ChannelInfo channelInfo : tunnelResponse.getChannelsList()) { + ChannelInfo actualChannel = createChannelInfo(channelInfo); + actualInfos.add(createChannelInfo(channelInfo)); + if (actualChannel.getChannelRpo() > tunnelRpo) { + tunnelRpo = actualChannel.getChannelRpo(); + } + } + resp.setTunnelRpo(tunnelRpo != 0 ? tunnelRpo : System.currentTimeMillis()); + resp.setChannelInfos(actualInfos); + return resp; + } + + public static DeleteTunnelResponse createDeleteTunnelResponse( + ResponseContentWithMeta response, TunnelServiceApi.DeleteTunnelResponse tunnelResponse) { + return new DeleteTunnelResponse(response.getMeta()); + } + + public static ConnectTunnelResponse createConnectTunnelResponse( + ResponseContentWithMeta response, TunnelServiceApi.ConnectResponse tunnelResponse) { + ConnectTunnelResponse resp = new ConnectTunnelResponse(response.getMeta()); + resp.setClientId(tunnelResponse.getClientId()); + return resp; + } + + public static ChannelStatus createChannelStatus(TunnelServiceApi.ChannelStatus status) { + switch (status) { + case OPEN: + return ChannelStatus.OPEN; + case CLOSING: + return ChannelStatus.CLOSING; + case CLOSE: + return ChannelStatus.CLOSE; + case TERMINATED: + return ChannelStatus.TERMINATED; + default: + throw new IllegalArgumentException("Unknown channel type: " + status.name()); + } + } + + public static Channel createChannel(TunnelServiceApi.Channel channel) { + Channel actualChannel = new Channel(); + actualChannel.setChannelId(channel.getChannelId()); + actualChannel.setVersion(channel.getVersion()); + actualChannel.setStatus(createChannelStatus(channel.getStatus())); + return actualChannel; + } + + public static HeartbeatResponse createHeartbeatResponse( + ResponseContentWithMeta response, TunnelServiceApi.HeartbeatResponse tunnelResponse) { + HeartbeatResponse resp = new HeartbeatResponse(response.getMeta()); + List channels = new ArrayList(); + for (TunnelServiceApi.Channel channel : tunnelResponse.getChannelsList()) { + channels.add(createChannel(channel)); + } + resp.setChannels(channels); + return resp; + } + + public static ShutdownTunnelResponse createShutdownTunnelResponse( + ResponseContentWithMeta response, TunnelServiceApi.ShutdownResponse tunnelResponse) { + return new ShutdownTunnelResponse(response.getMeta()); + } + + public static GetCheckpointResponse createGetCheckpointResponse( + ResponseContentWithMeta response, TunnelServiceApi.GetCheckpointResponse tunnelResponse) { + GetCheckpointResponse resp = new GetCheckpointResponse(response.getMeta()); + resp.setCheckpoint(tunnelResponse.getCheckpoint()); + resp.setSequenceNumber(tunnelResponse.getSequenceNumber()); + return resp; + } + + public static final String FINISH_TAG = "finished"; + public static ReadRecordsResponse createReadRecordsResponse( + ResponseContentWithMeta response, TunnelServiceApi.ReadRecordsResponse tunnelResponse) { + ReadRecordsResponse resp = new ReadRecordsResponse(response.getMeta()); + resp.setMemoizedSerializedSize(tunnelResponse.getSerializedSize()); + if (tunnelResponse.hasNextToken()) { + if (FINISH_TAG.equals(tunnelResponse.getNextToken())) { + resp.setNextToken(null); + } else { + resp.setNextToken(tunnelResponse.getNextToken()); + } + } + + List records = new ArrayList(); + + for (TunnelServiceApi.Record record : tunnelResponse.getRecordsList()) { + try { + PlainBufferCodedInputStream inputStream = new PlainBufferCodedInputStream( + new PlainBufferInputStream(record.getRecord().asReadOnlyByteBuffer()) + ); + List rows = inputStream.readRowsWithHeader(); + if (rows.size() != 1) { + throw new IOException("Expect only returns one row, Row count: " + rows.size()); + } + PlainBufferRow row = rows.get(0); + records.add(PlainBufferConversion.toStreamRecord(row, record.getActionType())); + } catch (Exception e) { + throw new ClientException("Failed to parse row", e); + } + } + + resp.setRecords(records); + return resp; + } + + public static CheckpointResponse createCheckpointResponse( + ResponseContentWithMeta response, TunnelServiceApi.CheckpointResponse tunnelResponse) { + return new CheckpointResponse(response.getMeta()); + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/parser/ResultParseException.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParseException.java similarity index 86% rename from src/main/java/com/aliyun/openservices/ots/parser/ResultParseException.java rename to src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParseException.java index 6efdf2f..7edc84c 100644 --- a/src/main/java/com/aliyun/openservices/ots/parser/ResultParseException.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParseException.java @@ -1,8 +1,7 @@ -package com.aliyun.openservices.ots.parser; +package com.alicloud.openservices.tablestore.core.protocol; /** * The exception from parsing service result. - * */ public class ResultParseException extends Exception { private static final long serialVersionUID = -6660159156997037589L; diff --git a/src/main/java/com/aliyun/openservices/ots/parser/ResultParser.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParser.java similarity index 66% rename from src/main/java/com/aliyun/openservices/ots/parser/ResultParser.java rename to src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParser.java index f7a6f8e..95d6cf5 100644 --- a/src/main/java/com/aliyun/openservices/ots/parser/ResultParser.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParser.java @@ -1,11 +1,7 @@ -package com.aliyun.openservices.ots.parser; +package com.alicloud.openservices.tablestore.core.protocol; -import com.aliyun.openservices.ots.comm.ResponseMessage; +import com.alicloud.openservices.tablestore.core.http.ResponseMessage; -/** - * Used to convert an result stream to a java object. - * - */ public interface ResultParser { /** * Converts the result from stream to a java object. @@ -14,4 +10,4 @@ public interface ResultParser { * @throws ResultParseException Failed to parse the result. */ public Object getObject(ResponseMessage response) throws ResultParseException; -} \ No newline at end of file +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParserFactory.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParserFactory.java new file mode 100644 index 0000000..b9f0ac5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ResultParserFactory.java @@ -0,0 +1,17 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.google.protobuf.Message; + +public class ResultParserFactory { + + private ResultParserFactory(){ + } + + public static ResultParserFactory createFactory() { + return new ResultParserFactory(); + } + + public ResultParser createProtocolBufferResultParser(Message m, String traceId) { + return new ProtocolBufferParser(m, traceId); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/Search.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/Search.java new file mode 100644 index 0000000..d64c016 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/Search.java @@ -0,0 +1,25478 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: search.proto + +package com.alicloud.openservices.tablestore.core.protocol; + +public final class Search { + private Search() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public enum QueryType + implements com.google.protobuf.ProtocolMessageEnum { + MATCH_QUERY(0, 1), + MATCH_PHRASE_QUERY(1, 2), + TERM_QUERY(2, 3), + RANGE_QUERY(3, 4), + PREFIX_QUERY(4, 5), + BOOL_QUERY(5, 6), + CONST_SCORE_QUERY(6, 7), + FUNCTION_SCORE_QUERY(7, 8), + NESTED_QUERY(8, 9), + WILDCARD_QUERY(9, 10), + MATCH_ALL_QUERY(10, 11), + GEO_BOUNDING_BOX_QUERY(11, 12), + GEO_DISTANCE_QUERY(12, 13), + GEO_POLYGON_QUERY(13, 14), + TERMS_QUERY(14, 15), + ; + + public static final int MATCH_QUERY_VALUE = 1; + public static final int MATCH_PHRASE_QUERY_VALUE = 2; + public static final int TERM_QUERY_VALUE = 3; + public static final int RANGE_QUERY_VALUE = 4; + public static final int PREFIX_QUERY_VALUE = 5; + public static final int BOOL_QUERY_VALUE = 6; + public static final int CONST_SCORE_QUERY_VALUE = 7; + public static final int FUNCTION_SCORE_QUERY_VALUE = 8; + public static final int NESTED_QUERY_VALUE = 9; + public static final int WILDCARD_QUERY_VALUE = 10; + public static final int MATCH_ALL_QUERY_VALUE = 11; + public static final int GEO_BOUNDING_BOX_QUERY_VALUE = 12; + public static final int GEO_DISTANCE_QUERY_VALUE = 13; + public static final int GEO_POLYGON_QUERY_VALUE = 14; + public static final int TERMS_QUERY_VALUE = 15; + + + public final int getNumber() { return value; } + + public static QueryType valueOf(int value) { + switch (value) { + case 1: return MATCH_QUERY; + case 2: return MATCH_PHRASE_QUERY; + case 3: return TERM_QUERY; + case 4: return RANGE_QUERY; + case 5: return PREFIX_QUERY; + case 6: return BOOL_QUERY; + case 7: return CONST_SCORE_QUERY; + case 8: return FUNCTION_SCORE_QUERY; + case 9: return NESTED_QUERY; + case 10: return WILDCARD_QUERY; + case 11: return MATCH_ALL_QUERY; + case 12: return GEO_BOUNDING_BOX_QUERY; + case 13: return GEO_DISTANCE_QUERY; + case 14: return GEO_POLYGON_QUERY; + case 15: return TERMS_QUERY; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public QueryType findValueByNumber(int number) { + return QueryType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(0); + } + + private static final QueryType[] VALUES = { + MATCH_QUERY, MATCH_PHRASE_QUERY, TERM_QUERY, RANGE_QUERY, PREFIX_QUERY, BOOL_QUERY, CONST_SCORE_QUERY, FUNCTION_SCORE_QUERY, NESTED_QUERY, WILDCARD_QUERY, MATCH_ALL_QUERY, GEO_BOUNDING_BOX_QUERY, GEO_DISTANCE_QUERY, GEO_POLYGON_QUERY, TERMS_QUERY, + }; + + public static QueryType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private QueryType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.QueryType) + } + + public enum QueryOperator + implements com.google.protobuf.ProtocolMessageEnum { + OR(0, 1), + AND(1, 2), + ; + + public static final int OR_VALUE = 1; + public static final int AND_VALUE = 2; + + + public final int getNumber() { return value; } + + public static QueryOperator valueOf(int value) { + switch (value) { + case 1: return OR; + case 2: return AND; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public QueryOperator findValueByNumber(int number) { + return QueryOperator.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(1); + } + + private static final QueryOperator[] VALUES = { + OR, AND, + }; + + public static QueryOperator valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private QueryOperator(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.QueryOperator) + } + + public enum ScoreMode + implements com.google.protobuf.ProtocolMessageEnum { + SCORE_MODE_NONE(0, 1), + SCORE_MODE_AVG(1, 2), + SCORE_MODE_MAX(2, 3), + SCORE_MODE_TOTAL(3, 4), + SCORE_MODE_MIN(4, 5), + ; + + public static final int SCORE_MODE_NONE_VALUE = 1; + public static final int SCORE_MODE_AVG_VALUE = 2; + public static final int SCORE_MODE_MAX_VALUE = 3; + public static final int SCORE_MODE_TOTAL_VALUE = 4; + public static final int SCORE_MODE_MIN_VALUE = 5; + + + public final int getNumber() { return value; } + + public static ScoreMode valueOf(int value) { + switch (value) { + case 1: return SCORE_MODE_NONE; + case 2: return SCORE_MODE_AVG; + case 3: return SCORE_MODE_MAX; + case 4: return SCORE_MODE_TOTAL; + case 5: return SCORE_MODE_MIN; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ScoreMode findValueByNumber(int number) { + return ScoreMode.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(2); + } + + private static final ScoreMode[] VALUES = { + SCORE_MODE_NONE, SCORE_MODE_AVG, SCORE_MODE_MAX, SCORE_MODE_TOTAL, SCORE_MODE_MIN, + }; + + public static ScoreMode valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private ScoreMode(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ScoreMode) + } + + public enum SortOrder + implements com.google.protobuf.ProtocolMessageEnum { + SORT_ORDER_ASC(0, 0), + SORT_ORDER_DESC(1, 1), + ; + + public static final int SORT_ORDER_ASC_VALUE = 0; + public static final int SORT_ORDER_DESC_VALUE = 1; + + + public final int getNumber() { return value; } + + public static SortOrder valueOf(int value) { + switch (value) { + case 0: return SORT_ORDER_ASC; + case 1: return SORT_ORDER_DESC; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SortOrder findValueByNumber(int number) { + return SortOrder.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(3); + } + + private static final SortOrder[] VALUES = { + SORT_ORDER_ASC, SORT_ORDER_DESC, + }; + + public static SortOrder valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private SortOrder(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.SortOrder) + } + + public enum SortMode + implements com.google.protobuf.ProtocolMessageEnum { + SORT_MODE_MIN(0, 0), + SORT_MODE_MAX(1, 1), + SORT_MODE_AVG(2, 2), + ; + + public static final int SORT_MODE_MIN_VALUE = 0; + public static final int SORT_MODE_MAX_VALUE = 1; + public static final int SORT_MODE_AVG_VALUE = 2; + + + public final int getNumber() { return value; } + + public static SortMode valueOf(int value) { + switch (value) { + case 0: return SORT_MODE_MIN; + case 1: return SORT_MODE_MAX; + case 2: return SORT_MODE_AVG; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SortMode findValueByNumber(int number) { + return SortMode.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(4); + } + + private static final SortMode[] VALUES = { + SORT_MODE_MIN, SORT_MODE_MAX, SORT_MODE_AVG, + }; + + public static SortMode valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private SortMode(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.SortMode) + } + + public enum GeoDistanceType + implements com.google.protobuf.ProtocolMessageEnum { + GEO_DISTANCE_ARC(0, 0), + GEO_DISTANCE_PLANE(1, 1), + ; + + public static final int GEO_DISTANCE_ARC_VALUE = 0; + public static final int GEO_DISTANCE_PLANE_VALUE = 1; + + + public final int getNumber() { return value; } + + public static GeoDistanceType valueOf(int value) { + switch (value) { + case 0: return GEO_DISTANCE_ARC; + case 1: return GEO_DISTANCE_PLANE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public GeoDistanceType findValueByNumber(int number) { + return GeoDistanceType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(5); + } + + private static final GeoDistanceType[] VALUES = { + GEO_DISTANCE_ARC, GEO_DISTANCE_PLANE, + }; + + public static GeoDistanceType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private GeoDistanceType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.GeoDistanceType) + } + + public enum ColumnReturnType + implements com.google.protobuf.ProtocolMessageEnum { + RETURN_ALL(0, 1), + RETURN_SPECIFIED(1, 2), + RETURN_NONE(2, 3), + ; + + public static final int RETURN_ALL_VALUE = 1; + public static final int RETURN_SPECIFIED_VALUE = 2; + public static final int RETURN_NONE_VALUE = 3; + + + public final int getNumber() { return value; } + + public static ColumnReturnType valueOf(int value) { + switch (value) { + case 1: return RETURN_ALL; + case 2: return RETURN_SPECIFIED; + case 3: return RETURN_NONE; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ColumnReturnType findValueByNumber(int number) { + return ColumnReturnType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(6); + } + + private static final ColumnReturnType[] VALUES = { + RETURN_ALL, RETURN_SPECIFIED, RETURN_NONE, + }; + + public static ColumnReturnType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private ColumnReturnType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ColumnReturnType) + } + + public enum IndexOptions + implements com.google.protobuf.ProtocolMessageEnum { + DOCS(0, 1), + FREQS(1, 2), + POSITIONS(2, 3), + OFFSETS(3, 4), + ; + + public static final int DOCS_VALUE = 1; + public static final int FREQS_VALUE = 2; + public static final int POSITIONS_VALUE = 3; + public static final int OFFSETS_VALUE = 4; + + + public final int getNumber() { return value; } + + public static IndexOptions valueOf(int value) { + switch (value) { + case 1: return DOCS; + case 2: return FREQS; + case 3: return POSITIONS; + case 4: return OFFSETS; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public IndexOptions findValueByNumber(int number) { + return IndexOptions.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(7); + } + + private static final IndexOptions[] VALUES = { + DOCS, FREQS, POSITIONS, OFFSETS, + }; + + public static IndexOptions valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private IndexOptions(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.IndexOptions) + } + + public enum FieldType + implements com.google.protobuf.ProtocolMessageEnum { + LONG(0, 1), + DOUBLE(1, 2), + BOOLEAN(2, 3), + KEYWORD(3, 4), + TEXT(4, 5), + NESTED(5, 6), + GEO_POINT(6, 7), + ; + + public static final int LONG_VALUE = 1; + public static final int DOUBLE_VALUE = 2; + public static final int BOOLEAN_VALUE = 3; + public static final int KEYWORD_VALUE = 4; + public static final int TEXT_VALUE = 5; + public static final int NESTED_VALUE = 6; + public static final int GEO_POINT_VALUE = 7; + + + public final int getNumber() { return value; } + + public static FieldType valueOf(int value) { + switch (value) { + case 1: return LONG; + case 2: return DOUBLE; + case 3: return BOOLEAN; + case 4: return KEYWORD; + case 5: return TEXT; + case 6: return NESTED; + case 7: return GEO_POINT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public FieldType findValueByNumber(int number) { + return FieldType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(8); + } + + private static final FieldType[] VALUES = { + LONG, DOUBLE, BOOLEAN, KEYWORD, TEXT, NESTED, GEO_POINT, + }; + + public static FieldType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private FieldType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.FieldType) + } + + public enum SyncPhase + implements com.google.protobuf.ProtocolMessageEnum { + FULL(0, 1), + INCR(1, 2), + ; + + public static final int FULL_VALUE = 1; + public static final int INCR_VALUE = 2; + + + public final int getNumber() { return value; } + + public static SyncPhase valueOf(int value) { + switch (value) { + case 1: return FULL; + case 2: return INCR; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public SyncPhase findValueByNumber(int number) { + return SyncPhase.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.getDescriptor().getEnumTypes().get(9); + } + + private static final SyncPhase[] VALUES = { + FULL, INCR, + }; + + public static SyncPhase valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private SyncPhase(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.SyncPhase) + } + + public interface MatchQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional string text = 2; + boolean hasText(); + String getText(); + + // optional int32 minimum_should_match = 3; + boolean hasMinimumShouldMatch(); + int getMinimumShouldMatch(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.QueryOperator operator = 4; + boolean hasOperator(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator getOperator(); + } + public static final class MatchQuery extends + com.google.protobuf.GeneratedMessage + implements MatchQueryOrBuilder { + // Use MatchQuery.newBuilder() to construct. + private MatchQuery(Builder builder) { + super(builder); + } + private MatchQuery(boolean noInit) {} + + private static final MatchQuery defaultInstance; + public static MatchQuery getDefaultInstance() { + return defaultInstance; + } + + public MatchQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string text = 2; + public static final int TEXT_FIELD_NUMBER = 2; + private java.lang.Object text_; + public boolean hasText() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getText() { + java.lang.Object ref = text_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + text_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTextBytes() { + java.lang.Object ref = text_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + text_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int32 minimum_should_match = 3; + public static final int MINIMUM_SHOULD_MATCH_FIELD_NUMBER = 3; + private int minimumShouldMatch_; + public boolean hasMinimumShouldMatch() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getMinimumShouldMatch() { + return minimumShouldMatch_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.QueryOperator operator = 4; + public static final int OPERATOR_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator operator_; + public boolean hasOperator() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator getOperator() { + return operator_; + } + + private void initFields() { + fieldName_ = ""; + text_ = ""; + minimumShouldMatch_ = 0; + operator_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator.OR; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTextBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(3, minimumShouldMatch_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeEnum(4, operator_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTextBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, minimumShouldMatch_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, operator_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.MatchQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + text_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + minimumShouldMatch_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + operator_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator.OR; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.text_ = text_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.minimumShouldMatch_ = minimumShouldMatch_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.operator_ = operator_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasText()) { + setText(other.getText()); + } + if (other.hasMinimumShouldMatch()) { + setMinimumShouldMatch(other.getMinimumShouldMatch()); + } + if (other.hasOperator()) { + setOperator(other.getOperator()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + text_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + minimumShouldMatch_ = input.readInt32(); + break; + } + case 32: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator value = com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(4, rawValue); + } else { + bitField0_ |= 0x00000008; + operator_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional string text = 2; + private java.lang.Object text_ = ""; + public boolean hasText() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getText() { + java.lang.Object ref = text_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + text_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setText(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + text_ = value; + onChanged(); + return this; + } + public Builder clearText() { + bitField0_ = (bitField0_ & ~0x00000002); + text_ = getDefaultInstance().getText(); + onChanged(); + return this; + } + void setText(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + text_ = value; + onChanged(); + } + + // optional int32 minimum_should_match = 3; + private int minimumShouldMatch_ ; + public boolean hasMinimumShouldMatch() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getMinimumShouldMatch() { + return minimumShouldMatch_; + } + public Builder setMinimumShouldMatch(int value) { + bitField0_ |= 0x00000004; + minimumShouldMatch_ = value; + onChanged(); + return this; + } + public Builder clearMinimumShouldMatch() { + bitField0_ = (bitField0_ & ~0x00000004); + minimumShouldMatch_ = 0; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.QueryOperator operator = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator operator_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator.OR; + public boolean hasOperator() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator getOperator() { + return operator_; + } + public Builder setOperator(com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + operator_ = value; + onChanged(); + return this; + } + public Builder clearOperator() { + bitField0_ = (bitField0_ & ~0x00000008); + operator_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryOperator.OR; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.MatchQuery) + } + + static { + defaultInstance = new MatchQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.MatchQuery) + } + + public interface MatchPhraseQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional string text = 2; + boolean hasText(); + String getText(); + } + public static final class MatchPhraseQuery extends + com.google.protobuf.GeneratedMessage + implements MatchPhraseQueryOrBuilder { + // Use MatchPhraseQuery.newBuilder() to construct. + private MatchPhraseQuery(Builder builder) { + super(builder); + } + private MatchPhraseQuery(boolean noInit) {} + + private static final MatchPhraseQuery defaultInstance; + public static MatchPhraseQuery getDefaultInstance() { + return defaultInstance; + } + + public MatchPhraseQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string text = 2; + public static final int TEXT_FIELD_NUMBER = 2; + private java.lang.Object text_; + public boolean hasText() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getText() { + java.lang.Object ref = text_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + text_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTextBytes() { + java.lang.Object ref = text_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + text_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + fieldName_ = ""; + text_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTextBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTextBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + text_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.text_ = text_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasText()) { + setText(other.getText()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + text_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional string text = 2; + private java.lang.Object text_ = ""; + public boolean hasText() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getText() { + java.lang.Object ref = text_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + text_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setText(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + text_ = value; + onChanged(); + return this; + } + public Builder clearText() { + bitField0_ = (bitField0_ & ~0x00000002); + text_ = getDefaultInstance().getText(); + onChanged(); + return this; + } + void setText(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + text_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.MatchPhraseQuery) + } + + static { + defaultInstance = new MatchPhraseQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.MatchPhraseQuery) + } + + public interface MatchAllQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class MatchAllQuery extends + com.google.protobuf.GeneratedMessage + implements MatchAllQueryOrBuilder { + // Use MatchAllQuery.newBuilder() to construct. + private MatchAllQuery(Builder builder) { + super(builder); + } + private MatchAllQuery(boolean noInit) {} + + private static final MatchAllQuery defaultInstance; + public static MatchAllQuery getDefaultInstance() { + return defaultInstance; + } + + public MatchAllQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.MatchAllQuery) + } + + static { + defaultInstance = new MatchAllQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.MatchAllQuery) + } + + public interface TermQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional bytes term = 2; + boolean hasTerm(); + com.google.protobuf.ByteString getTerm(); + } + public static final class TermQuery extends + com.google.protobuf.GeneratedMessage + implements TermQueryOrBuilder { + // Use TermQuery.newBuilder() to construct. + private TermQuery(Builder builder) { + super(builder); + } + private TermQuery(boolean noInit) {} + + private static final TermQuery defaultInstance; + public static TermQuery getDefaultInstance() { + return defaultInstance; + } + + public TermQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bytes term = 2; + public static final int TERM_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString term_; + public boolean hasTerm() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getTerm() { + return term_; + } + + private void initFields() { + fieldName_ = ""; + term_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, term_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, term_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.TermQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + term_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.term_ = term_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasTerm()) { + setTerm(other.getTerm()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + term_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional bytes term = 2; + private com.google.protobuf.ByteString term_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasTerm() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getTerm() { + return term_; + } + public Builder setTerm(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + term_ = value; + onChanged(); + return this; + } + public Builder clearTerm() { + bitField0_ = (bitField0_ & ~0x00000002); + term_ = getDefaultInstance().getTerm(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TermQuery) + } + + static { + defaultInstance = new TermQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TermQuery) + } + + public interface TermsQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // repeated bytes terms = 2; + java.util.List getTermsList(); + int getTermsCount(); + com.google.protobuf.ByteString getTerms(int index); + } + public static final class TermsQuery extends + com.google.protobuf.GeneratedMessage + implements TermsQueryOrBuilder { + // Use TermsQuery.newBuilder() to construct. + private TermsQuery(Builder builder) { + super(builder); + } + private TermsQuery(boolean noInit) {} + + private static final TermsQuery defaultInstance; + public static TermsQuery getDefaultInstance() { + return defaultInstance; + } + + public TermsQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated bytes terms = 2; + public static final int TERMS_FIELD_NUMBER = 2; + private java.util.List terms_; + public java.util.List + getTermsList() { + return terms_; + } + public int getTermsCount() { + return terms_.size(); + } + public com.google.protobuf.ByteString getTerms(int index) { + return terms_.get(index); + } + + private void initFields() { + fieldName_ = ""; + terms_ = java.util.Collections.emptyList();; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + for (int i = 0; i < terms_.size(); i++) { + output.writeBytes(2, terms_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < terms_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(terms_.get(i)); + } + size += dataSize; + size += 1 * getTermsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.TermsQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + terms_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + terms_ = java.util.Collections.unmodifiableList(terms_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.terms_ = terms_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (!other.terms_.isEmpty()) { + if (terms_.isEmpty()) { + terms_ = other.terms_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureTermsIsMutable(); + terms_.addAll(other.terms_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + ensureTermsIsMutable(); + terms_.add(input.readBytes()); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // repeated bytes terms = 2; + private java.util.List terms_ = java.util.Collections.emptyList();; + private void ensureTermsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + terms_ = new java.util.ArrayList(terms_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getTermsList() { + return java.util.Collections.unmodifiableList(terms_); + } + public int getTermsCount() { + return terms_.size(); + } + public com.google.protobuf.ByteString getTerms(int index) { + return terms_.get(index); + } + public Builder setTerms( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTermsIsMutable(); + terms_.set(index, value); + onChanged(); + return this; + } + public Builder addTerms(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureTermsIsMutable(); + terms_.add(value); + onChanged(); + return this; + } + public Builder addAllTerms( + java.lang.Iterable values) { + ensureTermsIsMutable(); + super.addAll(values, terms_); + onChanged(); + return this; + } + public Builder clearTerms() { + terms_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TermsQuery) + } + + static { + defaultInstance = new TermsQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TermsQuery) + } + + public interface RangeQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional bytes range_from = 2; + boolean hasRangeFrom(); + com.google.protobuf.ByteString getRangeFrom(); + + // optional bytes range_to = 3; + boolean hasRangeTo(); + com.google.protobuf.ByteString getRangeTo(); + + // optional bool include_lower = 4; + boolean hasIncludeLower(); + boolean getIncludeLower(); + + // optional bool include_upper = 5; + boolean hasIncludeUpper(); + boolean getIncludeUpper(); + } + public static final class RangeQuery extends + com.google.protobuf.GeneratedMessage + implements RangeQueryOrBuilder { + // Use RangeQuery.newBuilder() to construct. + private RangeQuery(Builder builder) { + super(builder); + } + private RangeQuery(boolean noInit) {} + + private static final RangeQuery defaultInstance; + public static RangeQuery getDefaultInstance() { + return defaultInstance; + } + + public RangeQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bytes range_from = 2; + public static final int RANGE_FROM_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString rangeFrom_; + public boolean hasRangeFrom() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRangeFrom() { + return rangeFrom_; + } + + // optional bytes range_to = 3; + public static final int RANGE_TO_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString rangeTo_; + public boolean hasRangeTo() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getRangeTo() { + return rangeTo_; + } + + // optional bool include_lower = 4; + public static final int INCLUDE_LOWER_FIELD_NUMBER = 4; + private boolean includeLower_; + public boolean hasIncludeLower() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public boolean getIncludeLower() { + return includeLower_; + } + + // optional bool include_upper = 5; + public static final int INCLUDE_UPPER_FIELD_NUMBER = 5; + private boolean includeUpper_; + public boolean hasIncludeUpper() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getIncludeUpper() { + return includeUpper_; + } + + private void initFields() { + fieldName_ = ""; + rangeFrom_ = com.google.protobuf.ByteString.EMPTY; + rangeTo_ = com.google.protobuf.ByteString.EMPTY; + includeLower_ = false; + includeUpper_ = false; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, rangeFrom_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, rangeTo_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBool(4, includeLower_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBool(5, includeUpper_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, rangeFrom_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, rangeTo_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, includeLower_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, includeUpper_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.RangeQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + rangeFrom_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + rangeTo_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + includeLower_ = false; + bitField0_ = (bitField0_ & ~0x00000008); + includeUpper_ = false; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.rangeFrom_ = rangeFrom_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.rangeTo_ = rangeTo_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.includeLower_ = includeLower_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.includeUpper_ = includeUpper_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasRangeFrom()) { + setRangeFrom(other.getRangeFrom()); + } + if (other.hasRangeTo()) { + setRangeTo(other.getRangeTo()); + } + if (other.hasIncludeLower()) { + setIncludeLower(other.getIncludeLower()); + } + if (other.hasIncludeUpper()) { + setIncludeUpper(other.getIncludeUpper()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + rangeFrom_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + rangeTo_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + includeLower_ = input.readBool(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + includeUpper_ = input.readBool(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional bytes range_from = 2; + private com.google.protobuf.ByteString rangeFrom_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRangeFrom() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRangeFrom() { + return rangeFrom_; + } + public Builder setRangeFrom(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + rangeFrom_ = value; + onChanged(); + return this; + } + public Builder clearRangeFrom() { + bitField0_ = (bitField0_ & ~0x00000002); + rangeFrom_ = getDefaultInstance().getRangeFrom(); + onChanged(); + return this; + } + + // optional bytes range_to = 3; + private com.google.protobuf.ByteString rangeTo_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRangeTo() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getRangeTo() { + return rangeTo_; + } + public Builder setRangeTo(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + rangeTo_ = value; + onChanged(); + return this; + } + public Builder clearRangeTo() { + bitField0_ = (bitField0_ & ~0x00000004); + rangeTo_ = getDefaultInstance().getRangeTo(); + onChanged(); + return this; + } + + // optional bool include_lower = 4; + private boolean includeLower_ ; + public boolean hasIncludeLower() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public boolean getIncludeLower() { + return includeLower_; + } + public Builder setIncludeLower(boolean value) { + bitField0_ |= 0x00000008; + includeLower_ = value; + onChanged(); + return this; + } + public Builder clearIncludeLower() { + bitField0_ = (bitField0_ & ~0x00000008); + includeLower_ = false; + onChanged(); + return this; + } + + // optional bool include_upper = 5; + private boolean includeUpper_ ; + public boolean hasIncludeUpper() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getIncludeUpper() { + return includeUpper_; + } + public Builder setIncludeUpper(boolean value) { + bitField0_ |= 0x00000010; + includeUpper_ = value; + onChanged(); + return this; + } + public Builder clearIncludeUpper() { + bitField0_ = (bitField0_ & ~0x00000010); + includeUpper_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.RangeQuery) + } + + static { + defaultInstance = new RangeQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.RangeQuery) + } + + public interface PrefixQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional string prefix = 2; + boolean hasPrefix(); + String getPrefix(); + } + public static final class PrefixQuery extends + com.google.protobuf.GeneratedMessage + implements PrefixQueryOrBuilder { + // Use PrefixQuery.newBuilder() to construct. + private PrefixQuery(Builder builder) { + super(builder); + } + private PrefixQuery(boolean noInit) {} + + private static final PrefixQuery defaultInstance; + public static PrefixQuery getDefaultInstance() { + return defaultInstance; + } + + public PrefixQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string prefix = 2; + public static final int PREFIX_FIELD_NUMBER = 2; + private java.lang.Object prefix_; + public boolean hasPrefix() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getPrefix() { + java.lang.Object ref = prefix_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + prefix_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getPrefixBytes() { + java.lang.Object ref = prefix_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + prefix_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + fieldName_ = ""; + prefix_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getPrefixBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getPrefixBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + prefix_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.prefix_ = prefix_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasPrefix()) { + setPrefix(other.getPrefix()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + prefix_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional string prefix = 2; + private java.lang.Object prefix_ = ""; + public boolean hasPrefix() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getPrefix() { + java.lang.Object ref = prefix_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + prefix_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setPrefix(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + prefix_ = value; + onChanged(); + return this; + } + public Builder clearPrefix() { + bitField0_ = (bitField0_ & ~0x00000002); + prefix_ = getDefaultInstance().getPrefix(); + onChanged(); + return this; + } + void setPrefix(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + prefix_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.PrefixQuery) + } + + static { + defaultInstance = new PrefixQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.PrefixQuery) + } + + public interface WildcardQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional string value = 2; + boolean hasValue(); + String getValue(); + } + public static final class WildcardQuery extends + com.google.protobuf.GeneratedMessage + implements WildcardQueryOrBuilder { + // Use WildcardQuery.newBuilder() to construct. + private WildcardQuery(Builder builder) { + super(builder); + } + private WildcardQuery(boolean noInit) {} + + private static final WildcardQuery defaultInstance; + public static WildcardQuery getDefaultInstance() { + return defaultInstance; + } + + public WildcardQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string value = 2; + public static final int VALUE_FIELD_NUMBER = 2; + private java.lang.Object value_; + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getValue() { + java.lang.Object ref = value_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + value_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + fieldName_ = ""; + value_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getValueBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getValueBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + value_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.value_ = value_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasValue()) { + setValue(other.getValue()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + value_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional string value = 2; + private java.lang.Object value_ = ""; + public boolean hasValue() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + value_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setValue(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + value_ = value; + onChanged(); + return this; + } + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000002); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + void setValue(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + value_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.WildcardQuery) + } + + static { + defaultInstance = new WildcardQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.WildcardQuery) + } + + public interface BoolQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query must_queries = 1; + java.util.List + getMustQueriesList(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getMustQueries(int index); + int getMustQueriesCount(); + java.util.List + getMustQueriesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getMustQueriesOrBuilder( + int index); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query must_not_queries = 2; + java.util.List + getMustNotQueriesList(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getMustNotQueries(int index); + int getMustNotQueriesCount(); + java.util.List + getMustNotQueriesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getMustNotQueriesOrBuilder( + int index); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query filter_queries = 3; + java.util.List + getFilterQueriesList(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilterQueries(int index); + int getFilterQueriesCount(); + java.util.List + getFilterQueriesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterQueriesOrBuilder( + int index); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query should_queries = 4; + java.util.List + getShouldQueriesList(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getShouldQueries(int index); + int getShouldQueriesCount(); + java.util.List + getShouldQueriesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getShouldQueriesOrBuilder( + int index); + + // optional int32 minimum_should_match = 5; + boolean hasMinimumShouldMatch(); + int getMinimumShouldMatch(); + } + public static final class BoolQuery extends + com.google.protobuf.GeneratedMessage + implements BoolQueryOrBuilder { + // Use BoolQuery.newBuilder() to construct. + private BoolQuery(Builder builder) { + super(builder); + } + private BoolQuery(boolean noInit) {} + + private static final BoolQuery defaultInstance; + public static BoolQuery getDefaultInstance() { + return defaultInstance; + } + + public BoolQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_fieldAccessorTable; + } + + private int bitField0_; + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query must_queries = 1; + public static final int MUST_QUERIES_FIELD_NUMBER = 1; + private java.util.List mustQueries_; + public java.util.List getMustQueriesList() { + return mustQueries_; + } + public java.util.List + getMustQueriesOrBuilderList() { + return mustQueries_; + } + public int getMustQueriesCount() { + return mustQueries_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getMustQueries(int index) { + return mustQueries_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getMustQueriesOrBuilder( + int index) { + return mustQueries_.get(index); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query must_not_queries = 2; + public static final int MUST_NOT_QUERIES_FIELD_NUMBER = 2; + private java.util.List mustNotQueries_; + public java.util.List getMustNotQueriesList() { + return mustNotQueries_; + } + public java.util.List + getMustNotQueriesOrBuilderList() { + return mustNotQueries_; + } + public int getMustNotQueriesCount() { + return mustNotQueries_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getMustNotQueries(int index) { + return mustNotQueries_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getMustNotQueriesOrBuilder( + int index) { + return mustNotQueries_.get(index); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query filter_queries = 3; + public static final int FILTER_QUERIES_FIELD_NUMBER = 3; + private java.util.List filterQueries_; + public java.util.List getFilterQueriesList() { + return filterQueries_; + } + public java.util.List + getFilterQueriesOrBuilderList() { + return filterQueries_; + } + public int getFilterQueriesCount() { + return filterQueries_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilterQueries(int index) { + return filterQueries_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterQueriesOrBuilder( + int index) { + return filterQueries_.get(index); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query should_queries = 4; + public static final int SHOULD_QUERIES_FIELD_NUMBER = 4; + private java.util.List shouldQueries_; + public java.util.List getShouldQueriesList() { + return shouldQueries_; + } + public java.util.List + getShouldQueriesOrBuilderList() { + return shouldQueries_; + } + public int getShouldQueriesCount() { + return shouldQueries_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getShouldQueries(int index) { + return shouldQueries_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getShouldQueriesOrBuilder( + int index) { + return shouldQueries_.get(index); + } + + // optional int32 minimum_should_match = 5; + public static final int MINIMUM_SHOULD_MATCH_FIELD_NUMBER = 5; + private int minimumShouldMatch_; + public boolean hasMinimumShouldMatch() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getMinimumShouldMatch() { + return minimumShouldMatch_; + } + + private void initFields() { + mustQueries_ = java.util.Collections.emptyList(); + mustNotQueries_ = java.util.Collections.emptyList(); + filterQueries_ = java.util.Collections.emptyList(); + shouldQueries_ = java.util.Collections.emptyList(); + minimumShouldMatch_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < mustQueries_.size(); i++) { + output.writeMessage(1, mustQueries_.get(i)); + } + for (int i = 0; i < mustNotQueries_.size(); i++) { + output.writeMessage(2, mustNotQueries_.get(i)); + } + for (int i = 0; i < filterQueries_.size(); i++) { + output.writeMessage(3, filterQueries_.get(i)); + } + for (int i = 0; i < shouldQueries_.size(); i++) { + output.writeMessage(4, shouldQueries_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(5, minimumShouldMatch_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < mustQueries_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, mustQueries_.get(i)); + } + for (int i = 0; i < mustNotQueries_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, mustNotQueries_.get(i)); + } + for (int i = 0; i < filterQueries_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, filterQueries_.get(i)); + } + for (int i = 0; i < shouldQueries_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, shouldQueries_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, minimumShouldMatch_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.BoolQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getMustQueriesFieldBuilder(); + getMustNotQueriesFieldBuilder(); + getFilterQueriesFieldBuilder(); + getShouldQueriesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (mustQueriesBuilder_ == null) { + mustQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + mustQueriesBuilder_.clear(); + } + if (mustNotQueriesBuilder_ == null) { + mustNotQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + mustNotQueriesBuilder_.clear(); + } + if (filterQueriesBuilder_ == null) { + filterQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + } else { + filterQueriesBuilder_.clear(); + } + if (shouldQueriesBuilder_ == null) { + shouldQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + } else { + shouldQueriesBuilder_.clear(); + } + minimumShouldMatch_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (mustQueriesBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + mustQueries_ = java.util.Collections.unmodifiableList(mustQueries_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.mustQueries_ = mustQueries_; + } else { + result.mustQueries_ = mustQueriesBuilder_.build(); + } + if (mustNotQueriesBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + mustNotQueries_ = java.util.Collections.unmodifiableList(mustNotQueries_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.mustNotQueries_ = mustNotQueries_; + } else { + result.mustNotQueries_ = mustNotQueriesBuilder_.build(); + } + if (filterQueriesBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { + filterQueries_ = java.util.Collections.unmodifiableList(filterQueries_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.filterQueries_ = filterQueries_; + } else { + result.filterQueries_ = filterQueriesBuilder_.build(); + } + if (shouldQueriesBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { + shouldQueries_ = java.util.Collections.unmodifiableList(shouldQueries_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.shouldQueries_ = shouldQueries_; + } else { + result.shouldQueries_ = shouldQueriesBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000001; + } + result.minimumShouldMatch_ = minimumShouldMatch_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery.getDefaultInstance()) return this; + if (mustQueriesBuilder_ == null) { + if (!other.mustQueries_.isEmpty()) { + if (mustQueries_.isEmpty()) { + mustQueries_ = other.mustQueries_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureMustQueriesIsMutable(); + mustQueries_.addAll(other.mustQueries_); + } + onChanged(); + } + } else { + if (!other.mustQueries_.isEmpty()) { + if (mustQueriesBuilder_.isEmpty()) { + mustQueriesBuilder_.dispose(); + mustQueriesBuilder_ = null; + mustQueries_ = other.mustQueries_; + bitField0_ = (bitField0_ & ~0x00000001); + mustQueriesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getMustQueriesFieldBuilder() : null; + } else { + mustQueriesBuilder_.addAllMessages(other.mustQueries_); + } + } + } + if (mustNotQueriesBuilder_ == null) { + if (!other.mustNotQueries_.isEmpty()) { + if (mustNotQueries_.isEmpty()) { + mustNotQueries_ = other.mustNotQueries_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureMustNotQueriesIsMutable(); + mustNotQueries_.addAll(other.mustNotQueries_); + } + onChanged(); + } + } else { + if (!other.mustNotQueries_.isEmpty()) { + if (mustNotQueriesBuilder_.isEmpty()) { + mustNotQueriesBuilder_.dispose(); + mustNotQueriesBuilder_ = null; + mustNotQueries_ = other.mustNotQueries_; + bitField0_ = (bitField0_ & ~0x00000002); + mustNotQueriesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getMustNotQueriesFieldBuilder() : null; + } else { + mustNotQueriesBuilder_.addAllMessages(other.mustNotQueries_); + } + } + } + if (filterQueriesBuilder_ == null) { + if (!other.filterQueries_.isEmpty()) { + if (filterQueries_.isEmpty()) { + filterQueries_ = other.filterQueries_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureFilterQueriesIsMutable(); + filterQueries_.addAll(other.filterQueries_); + } + onChanged(); + } + } else { + if (!other.filterQueries_.isEmpty()) { + if (filterQueriesBuilder_.isEmpty()) { + filterQueriesBuilder_.dispose(); + filterQueriesBuilder_ = null; + filterQueries_ = other.filterQueries_; + bitField0_ = (bitField0_ & ~0x00000004); + filterQueriesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getFilterQueriesFieldBuilder() : null; + } else { + filterQueriesBuilder_.addAllMessages(other.filterQueries_); + } + } + } + if (shouldQueriesBuilder_ == null) { + if (!other.shouldQueries_.isEmpty()) { + if (shouldQueries_.isEmpty()) { + shouldQueries_ = other.shouldQueries_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureShouldQueriesIsMutable(); + shouldQueries_.addAll(other.shouldQueries_); + } + onChanged(); + } + } else { + if (!other.shouldQueries_.isEmpty()) { + if (shouldQueriesBuilder_.isEmpty()) { + shouldQueriesBuilder_.dispose(); + shouldQueriesBuilder_ = null; + shouldQueries_ = other.shouldQueries_; + bitField0_ = (bitField0_ & ~0x00000008); + shouldQueriesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getShouldQueriesFieldBuilder() : null; + } else { + shouldQueriesBuilder_.addAllMessages(other.shouldQueries_); + } + } + } + if (other.hasMinimumShouldMatch()) { + setMinimumShouldMatch(other.getMinimumShouldMatch()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addMustQueries(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addMustNotQueries(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addFilterQueries(subBuilder.buildPartial()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addShouldQueries(subBuilder.buildPartial()); + break; + } + case 40: { + bitField0_ |= 0x00000010; + minimumShouldMatch_ = input.readInt32(); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query must_queries = 1; + private java.util.List mustQueries_ = + java.util.Collections.emptyList(); + private void ensureMustQueriesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + mustQueries_ = new java.util.ArrayList(mustQueries_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> mustQueriesBuilder_; + + public java.util.List getMustQueriesList() { + if (mustQueriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(mustQueries_); + } else { + return mustQueriesBuilder_.getMessageList(); + } + } + public int getMustQueriesCount() { + if (mustQueriesBuilder_ == null) { + return mustQueries_.size(); + } else { + return mustQueriesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getMustQueries(int index) { + if (mustQueriesBuilder_ == null) { + return mustQueries_.get(index); + } else { + return mustQueriesBuilder_.getMessage(index); + } + } + public Builder setMustQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (mustQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMustQueriesIsMutable(); + mustQueries_.set(index, value); + onChanged(); + } else { + mustQueriesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setMustQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (mustQueriesBuilder_ == null) { + ensureMustQueriesIsMutable(); + mustQueries_.set(index, builderForValue.build()); + onChanged(); + } else { + mustQueriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addMustQueries(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (mustQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMustQueriesIsMutable(); + mustQueries_.add(value); + onChanged(); + } else { + mustQueriesBuilder_.addMessage(value); + } + return this; + } + public Builder addMustQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (mustQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMustQueriesIsMutable(); + mustQueries_.add(index, value); + onChanged(); + } else { + mustQueriesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addMustQueries( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (mustQueriesBuilder_ == null) { + ensureMustQueriesIsMutable(); + mustQueries_.add(builderForValue.build()); + onChanged(); + } else { + mustQueriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addMustQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (mustQueriesBuilder_ == null) { + ensureMustQueriesIsMutable(); + mustQueries_.add(index, builderForValue.build()); + onChanged(); + } else { + mustQueriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllMustQueries( + java.lang.Iterable values) { + if (mustQueriesBuilder_ == null) { + ensureMustQueriesIsMutable(); + super.addAll(values, mustQueries_); + onChanged(); + } else { + mustQueriesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearMustQueries() { + if (mustQueriesBuilder_ == null) { + mustQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + mustQueriesBuilder_.clear(); + } + return this; + } + public Builder removeMustQueries(int index) { + if (mustQueriesBuilder_ == null) { + ensureMustQueriesIsMutable(); + mustQueries_.remove(index); + onChanged(); + } else { + mustQueriesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getMustQueriesBuilder( + int index) { + return getMustQueriesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getMustQueriesOrBuilder( + int index) { + if (mustQueriesBuilder_ == null) { + return mustQueries_.get(index); } else { + return mustQueriesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getMustQueriesOrBuilderList() { + if (mustQueriesBuilder_ != null) { + return mustQueriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(mustQueries_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addMustQueriesBuilder() { + return getMustQueriesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addMustQueriesBuilder( + int index) { + return getMustQueriesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public java.util.List + getMustQueriesBuilderList() { + return getMustQueriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getMustQueriesFieldBuilder() { + if (mustQueriesBuilder_ == null) { + mustQueriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + mustQueries_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + mustQueries_ = null; + } + return mustQueriesBuilder_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query must_not_queries = 2; + private java.util.List mustNotQueries_ = + java.util.Collections.emptyList(); + private void ensureMustNotQueriesIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + mustNotQueries_ = new java.util.ArrayList(mustNotQueries_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> mustNotQueriesBuilder_; + + public java.util.List getMustNotQueriesList() { + if (mustNotQueriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(mustNotQueries_); + } else { + return mustNotQueriesBuilder_.getMessageList(); + } + } + public int getMustNotQueriesCount() { + if (mustNotQueriesBuilder_ == null) { + return mustNotQueries_.size(); + } else { + return mustNotQueriesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getMustNotQueries(int index) { + if (mustNotQueriesBuilder_ == null) { + return mustNotQueries_.get(index); + } else { + return mustNotQueriesBuilder_.getMessage(index); + } + } + public Builder setMustNotQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (mustNotQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMustNotQueriesIsMutable(); + mustNotQueries_.set(index, value); + onChanged(); + } else { + mustNotQueriesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setMustNotQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (mustNotQueriesBuilder_ == null) { + ensureMustNotQueriesIsMutable(); + mustNotQueries_.set(index, builderForValue.build()); + onChanged(); + } else { + mustNotQueriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addMustNotQueries(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (mustNotQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMustNotQueriesIsMutable(); + mustNotQueries_.add(value); + onChanged(); + } else { + mustNotQueriesBuilder_.addMessage(value); + } + return this; + } + public Builder addMustNotQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (mustNotQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureMustNotQueriesIsMutable(); + mustNotQueries_.add(index, value); + onChanged(); + } else { + mustNotQueriesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addMustNotQueries( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (mustNotQueriesBuilder_ == null) { + ensureMustNotQueriesIsMutable(); + mustNotQueries_.add(builderForValue.build()); + onChanged(); + } else { + mustNotQueriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addMustNotQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (mustNotQueriesBuilder_ == null) { + ensureMustNotQueriesIsMutable(); + mustNotQueries_.add(index, builderForValue.build()); + onChanged(); + } else { + mustNotQueriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllMustNotQueries( + java.lang.Iterable values) { + if (mustNotQueriesBuilder_ == null) { + ensureMustNotQueriesIsMutable(); + super.addAll(values, mustNotQueries_); + onChanged(); + } else { + mustNotQueriesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearMustNotQueries() { + if (mustNotQueriesBuilder_ == null) { + mustNotQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + mustNotQueriesBuilder_.clear(); + } + return this; + } + public Builder removeMustNotQueries(int index) { + if (mustNotQueriesBuilder_ == null) { + ensureMustNotQueriesIsMutable(); + mustNotQueries_.remove(index); + onChanged(); + } else { + mustNotQueriesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getMustNotQueriesBuilder( + int index) { + return getMustNotQueriesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getMustNotQueriesOrBuilder( + int index) { + if (mustNotQueriesBuilder_ == null) { + return mustNotQueries_.get(index); } else { + return mustNotQueriesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getMustNotQueriesOrBuilderList() { + if (mustNotQueriesBuilder_ != null) { + return mustNotQueriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(mustNotQueries_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addMustNotQueriesBuilder() { + return getMustNotQueriesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addMustNotQueriesBuilder( + int index) { + return getMustNotQueriesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public java.util.List + getMustNotQueriesBuilderList() { + return getMustNotQueriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getMustNotQueriesFieldBuilder() { + if (mustNotQueriesBuilder_ == null) { + mustNotQueriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + mustNotQueries_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + mustNotQueries_ = null; + } + return mustNotQueriesBuilder_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query filter_queries = 3; + private java.util.List filterQueries_ = + java.util.Collections.emptyList(); + private void ensureFilterQueriesIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + filterQueries_ = new java.util.ArrayList(filterQueries_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> filterQueriesBuilder_; + + public java.util.List getFilterQueriesList() { + if (filterQueriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(filterQueries_); + } else { + return filterQueriesBuilder_.getMessageList(); + } + } + public int getFilterQueriesCount() { + if (filterQueriesBuilder_ == null) { + return filterQueries_.size(); + } else { + return filterQueriesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilterQueries(int index) { + if (filterQueriesBuilder_ == null) { + return filterQueries_.get(index); + } else { + return filterQueriesBuilder_.getMessage(index); + } + } + public Builder setFilterQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (filterQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilterQueriesIsMutable(); + filterQueries_.set(index, value); + onChanged(); + } else { + filterQueriesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setFilterQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (filterQueriesBuilder_ == null) { + ensureFilterQueriesIsMutable(); + filterQueries_.set(index, builderForValue.build()); + onChanged(); + } else { + filterQueriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addFilterQueries(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (filterQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilterQueriesIsMutable(); + filterQueries_.add(value); + onChanged(); + } else { + filterQueriesBuilder_.addMessage(value); + } + return this; + } + public Builder addFilterQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (filterQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilterQueriesIsMutable(); + filterQueries_.add(index, value); + onChanged(); + } else { + filterQueriesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addFilterQueries( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (filterQueriesBuilder_ == null) { + ensureFilterQueriesIsMutable(); + filterQueries_.add(builderForValue.build()); + onChanged(); + } else { + filterQueriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addFilterQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (filterQueriesBuilder_ == null) { + ensureFilterQueriesIsMutable(); + filterQueries_.add(index, builderForValue.build()); + onChanged(); + } else { + filterQueriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllFilterQueries( + java.lang.Iterable values) { + if (filterQueriesBuilder_ == null) { + ensureFilterQueriesIsMutable(); + super.addAll(values, filterQueries_); + onChanged(); + } else { + filterQueriesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearFilterQueries() { + if (filterQueriesBuilder_ == null) { + filterQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + filterQueriesBuilder_.clear(); + } + return this; + } + public Builder removeFilterQueries(int index) { + if (filterQueriesBuilder_ == null) { + ensureFilterQueriesIsMutable(); + filterQueries_.remove(index); + onChanged(); + } else { + filterQueriesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getFilterQueriesBuilder( + int index) { + return getFilterQueriesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterQueriesOrBuilder( + int index) { + if (filterQueriesBuilder_ == null) { + return filterQueries_.get(index); } else { + return filterQueriesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getFilterQueriesOrBuilderList() { + if (filterQueriesBuilder_ != null) { + return filterQueriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(filterQueries_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addFilterQueriesBuilder() { + return getFilterQueriesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addFilterQueriesBuilder( + int index) { + return getFilterQueriesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public java.util.List + getFilterQueriesBuilderList() { + return getFilterQueriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getFilterQueriesFieldBuilder() { + if (filterQueriesBuilder_ == null) { + filterQueriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + filterQueries_, + ((bitField0_ & 0x00000004) == 0x00000004), + getParentForChildren(), + isClean()); + filterQueries_ = null; + } + return filterQueriesBuilder_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Query should_queries = 4; + private java.util.List shouldQueries_ = + java.util.Collections.emptyList(); + private void ensureShouldQueriesIsMutable() { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { + shouldQueries_ = new java.util.ArrayList(shouldQueries_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> shouldQueriesBuilder_; + + public java.util.List getShouldQueriesList() { + if (shouldQueriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(shouldQueries_); + } else { + return shouldQueriesBuilder_.getMessageList(); + } + } + public int getShouldQueriesCount() { + if (shouldQueriesBuilder_ == null) { + return shouldQueries_.size(); + } else { + return shouldQueriesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getShouldQueries(int index) { + if (shouldQueriesBuilder_ == null) { + return shouldQueries_.get(index); + } else { + return shouldQueriesBuilder_.getMessage(index); + } + } + public Builder setShouldQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (shouldQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureShouldQueriesIsMutable(); + shouldQueries_.set(index, value); + onChanged(); + } else { + shouldQueriesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setShouldQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (shouldQueriesBuilder_ == null) { + ensureShouldQueriesIsMutable(); + shouldQueries_.set(index, builderForValue.build()); + onChanged(); + } else { + shouldQueriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addShouldQueries(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (shouldQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureShouldQueriesIsMutable(); + shouldQueries_.add(value); + onChanged(); + } else { + shouldQueriesBuilder_.addMessage(value); + } + return this; + } + public Builder addShouldQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (shouldQueriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureShouldQueriesIsMutable(); + shouldQueries_.add(index, value); + onChanged(); + } else { + shouldQueriesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addShouldQueries( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (shouldQueriesBuilder_ == null) { + ensureShouldQueriesIsMutable(); + shouldQueries_.add(builderForValue.build()); + onChanged(); + } else { + shouldQueriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addShouldQueries( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (shouldQueriesBuilder_ == null) { + ensureShouldQueriesIsMutable(); + shouldQueries_.add(index, builderForValue.build()); + onChanged(); + } else { + shouldQueriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllShouldQueries( + java.lang.Iterable values) { + if (shouldQueriesBuilder_ == null) { + ensureShouldQueriesIsMutable(); + super.addAll(values, shouldQueries_); + onChanged(); + } else { + shouldQueriesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearShouldQueries() { + if (shouldQueriesBuilder_ == null) { + shouldQueries_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + shouldQueriesBuilder_.clear(); + } + return this; + } + public Builder removeShouldQueries(int index) { + if (shouldQueriesBuilder_ == null) { + ensureShouldQueriesIsMutable(); + shouldQueries_.remove(index); + onChanged(); + } else { + shouldQueriesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getShouldQueriesBuilder( + int index) { + return getShouldQueriesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getShouldQueriesOrBuilder( + int index) { + if (shouldQueriesBuilder_ == null) { + return shouldQueries_.get(index); } else { + return shouldQueriesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getShouldQueriesOrBuilderList() { + if (shouldQueriesBuilder_ != null) { + return shouldQueriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(shouldQueries_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addShouldQueriesBuilder() { + return getShouldQueriesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder addShouldQueriesBuilder( + int index) { + return getShouldQueriesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()); + } + public java.util.List + getShouldQueriesBuilderList() { + return getShouldQueriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getShouldQueriesFieldBuilder() { + if (shouldQueriesBuilder_ == null) { + shouldQueriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + shouldQueries_, + ((bitField0_ & 0x00000008) == 0x00000008), + getParentForChildren(), + isClean()); + shouldQueries_ = null; + } + return shouldQueriesBuilder_; + } + + // optional int32 minimum_should_match = 5; + private int minimumShouldMatch_ ; + public boolean hasMinimumShouldMatch() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public int getMinimumShouldMatch() { + return minimumShouldMatch_; + } + public Builder setMinimumShouldMatch(int value) { + bitField0_ |= 0x00000010; + minimumShouldMatch_ = value; + onChanged(); + return this; + } + public Builder clearMinimumShouldMatch() { + bitField0_ = (bitField0_ & ~0x00000010); + minimumShouldMatch_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.BoolQuery) + } + + static { + defaultInstance = new BoolQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.BoolQuery) + } + + public interface ConstScoreQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query filter = 1; + boolean hasFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterOrBuilder(); + } + public static final class ConstScoreQuery extends + com.google.protobuf.GeneratedMessage + implements ConstScoreQueryOrBuilder { + // Use ConstScoreQuery.newBuilder() to construct. + private ConstScoreQuery(Builder builder) { + super(builder); + } + private ConstScoreQuery(boolean noInit) {} + + private static final ConstScoreQuery defaultInstance; + public static ConstScoreQuery getDefaultInstance() { + return defaultInstance; + } + + public ConstScoreQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.Query filter = 1; + public static final int FILTER_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query filter_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilter() { + return filter_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterOrBuilder() { + return filter_; + } + + private void initFields() { + filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, filter_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, filter_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getFilterFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (filterBuilder_ == null) { + filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } else { + filterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (filterBuilder_ == null) { + result.filter_ = filter_; + } else { + result.filter_ = filterBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery.getDefaultInstance()) return this; + if (other.hasFilter()) { + mergeFilter(other.getFilter()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + if (hasFilter()) { + subBuilder.mergeFrom(getFilter()); + } + input.readMessage(subBuilder, extensionRegistry); + setFilter(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query filter = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> filterBuilder_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilter() { + if (filterBuilder_ == null) { + return filter_; + } else { + return filterBuilder_.getMessage(); + } + } + public Builder setFilter(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (filterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + filter_ = value; + onChanged(); + } else { + filterBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setFilter( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (filterBuilder_ == null) { + filter_ = builderForValue.build(); + onChanged(); + } else { + filterBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeFilter(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (filterBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + filter_ != com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()) { + filter_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(filter_).mergeFrom(value).buildPartial(); + } else { + filter_ = value; + } + onChanged(); + } else { + filterBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearFilter() { + if (filterBuilder_ == null) { + filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + onChanged(); + } else { + filterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getFilterBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getFilterFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterOrBuilder() { + if (filterBuilder_ != null) { + return filterBuilder_.getMessageOrBuilder(); + } else { + return filter_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getFilterFieldBuilder() { + if (filterBuilder_ == null) { + filterBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + filter_, + getParentForChildren(), + isClean()); + filter_ = null; + } + return filterBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ConstScoreQuery) + } + + static { + defaultInstance = new ConstScoreQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ConstScoreQuery) + } + + public interface FieldValueFactorOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + } + public static final class FieldValueFactor extends + com.google.protobuf.GeneratedMessage + implements FieldValueFactorOrBuilder { + // Use FieldValueFactor.newBuilder() to construct. + private FieldValueFactor(Builder builder) { + super(builder); + } + private FieldValueFactor(boolean noInit) {} + + private static final FieldValueFactor defaultInstance; + public static FieldValueFactor getDefaultInstance() { + return defaultInstance; + } + + public FieldValueFactor getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + fieldName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor build() { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor result = new com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.FieldValueFactor) + } + + static { + defaultInstance = new FieldValueFactor(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.FieldValueFactor) + } + + public interface FunctionScoreQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 1; + boolean hasQuery(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldValueFactor field_value_factor = 2; + boolean hasFieldValueFactor(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor getFieldValueFactor(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactorOrBuilder getFieldValueFactorOrBuilder(); + } + public static final class FunctionScoreQuery extends + com.google.protobuf.GeneratedMessage + implements FunctionScoreQueryOrBuilder { + // Use FunctionScoreQuery.newBuilder() to construct. + private FunctionScoreQuery(Builder builder) { + super(builder); + } + private FunctionScoreQuery(boolean noInit) {} + + private static final FunctionScoreQuery defaultInstance; + public static FunctionScoreQuery getDefaultInstance() { + return defaultInstance; + } + + public FunctionScoreQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 1; + public static final int QUERY_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query query_; + public boolean hasQuery() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery() { + return query_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder() { + return query_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldValueFactor field_value_factor = 2; + public static final int FIELD_VALUE_FACTOR_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor fieldValueFactor_; + public boolean hasFieldValueFactor() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor getFieldValueFactor() { + return fieldValueFactor_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactorOrBuilder getFieldValueFactorOrBuilder() { + return fieldValueFactor_; + } + + private void initFields() { + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + fieldValueFactor_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, query_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, fieldValueFactor_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, query_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, fieldValueFactor_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getQueryFieldBuilder(); + getFieldValueFactorFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (queryBuilder_ == null) { + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } else { + queryBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (fieldValueFactorBuilder_ == null) { + fieldValueFactor_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDefaultInstance(); + } else { + fieldValueFactorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (queryBuilder_ == null) { + result.query_ = query_; + } else { + result.query_ = queryBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (fieldValueFactorBuilder_ == null) { + result.fieldValueFactor_ = fieldValueFactor_; + } else { + result.fieldValueFactor_ = fieldValueFactorBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery.getDefaultInstance()) return this; + if (other.hasQuery()) { + mergeQuery(other.getQuery()); + } + if (other.hasFieldValueFactor()) { + mergeFieldValueFactor(other.getFieldValueFactor()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + if (hasQuery()) { + subBuilder.mergeFrom(getQuery()); + } + input.readMessage(subBuilder, extensionRegistry); + setQuery(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.newBuilder(); + if (hasFieldValueFactor()) { + subBuilder.mergeFrom(getFieldValueFactor()); + } + input.readMessage(subBuilder, extensionRegistry); + setFieldValueFactor(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> queryBuilder_; + public boolean hasQuery() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery() { + if (queryBuilder_ == null) { + return query_; + } else { + return queryBuilder_.getMessage(); + } + } + public Builder setQuery(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (queryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + query_ = value; + onChanged(); + } else { + queryBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setQuery( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (queryBuilder_ == null) { + query_ = builderForValue.build(); + onChanged(); + } else { + queryBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeQuery(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (queryBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + query_ != com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()) { + query_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(query_).mergeFrom(value).buildPartial(); + } else { + query_ = value; + } + onChanged(); + } else { + queryBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearQuery() { + if (queryBuilder_ == null) { + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + onChanged(); + } else { + queryBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getQueryBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getQueryFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder() { + if (queryBuilder_ != null) { + return queryBuilder_.getMessageOrBuilder(); + } else { + return query_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getQueryFieldBuilder() { + if (queryBuilder_ == null) { + queryBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + query_, + getParentForChildren(), + isClean()); + query_ = null; + } + return queryBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldValueFactor field_value_factor = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor fieldValueFactor_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor, com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactorOrBuilder> fieldValueFactorBuilder_; + public boolean hasFieldValueFactor() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor getFieldValueFactor() { + if (fieldValueFactorBuilder_ == null) { + return fieldValueFactor_; + } else { + return fieldValueFactorBuilder_.getMessage(); + } + } + public Builder setFieldValueFactor(com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor value) { + if (fieldValueFactorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fieldValueFactor_ = value; + onChanged(); + } else { + fieldValueFactorBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setFieldValueFactor( + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.Builder builderForValue) { + if (fieldValueFactorBuilder_ == null) { + fieldValueFactor_ = builderForValue.build(); + onChanged(); + } else { + fieldValueFactorBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeFieldValueFactor(com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor value) { + if (fieldValueFactorBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + fieldValueFactor_ != com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDefaultInstance()) { + fieldValueFactor_ = + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.newBuilder(fieldValueFactor_).mergeFrom(value).buildPartial(); + } else { + fieldValueFactor_ = value; + } + onChanged(); + } else { + fieldValueFactorBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearFieldValueFactor() { + if (fieldValueFactorBuilder_ == null) { + fieldValueFactor_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.getDefaultInstance(); + onChanged(); + } else { + fieldValueFactorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.Builder getFieldValueFactorBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getFieldValueFactorFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactorOrBuilder getFieldValueFactorOrBuilder() { + if (fieldValueFactorBuilder_ != null) { + return fieldValueFactorBuilder_.getMessageOrBuilder(); + } else { + return fieldValueFactor_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor, com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactorOrBuilder> + getFieldValueFactorFieldBuilder() { + if (fieldValueFactorBuilder_ == null) { + fieldValueFactorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor, com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactorOrBuilder>( + fieldValueFactor_, + getParentForChildren(), + isClean()); + fieldValueFactor_ = null; + } + return fieldValueFactorBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.FunctionScoreQuery) + } + + static { + defaultInstance = new FunctionScoreQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.FunctionScoreQuery) + } + + public interface NestedQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string path = 1; + boolean hasPath(); + String getPath(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 2; + boolean hasQuery(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ScoreMode score_mode = 3; + boolean hasScoreMode(); + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode getScoreMode(); + } + public static final class NestedQuery extends + com.google.protobuf.GeneratedMessage + implements NestedQueryOrBuilder { + // Use NestedQuery.newBuilder() to construct. + private NestedQuery(Builder builder) { + super(builder); + } + private NestedQuery(boolean noInit) {} + + private static final NestedQuery defaultInstance; + public static NestedQuery getDefaultInstance() { + return defaultInstance; + } + + public NestedQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string path = 1; + public static final int PATH_FIELD_NUMBER = 1; + private java.lang.Object path_; + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getPath() { + java.lang.Object ref = path_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + path_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 2; + public static final int QUERY_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query query_; + public boolean hasQuery() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery() { + return query_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder() { + return query_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ScoreMode score_mode = 3; + public static final int SCORE_MODE_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode scoreMode_; + public boolean hasScoreMode() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode getScoreMode() { + return scoreMode_; + } + + private void initFields() { + path_ = ""; + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + scoreMode_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode.SCORE_MODE_NONE; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, query_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(3, scoreMode_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, query_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, scoreMode_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.NestedQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getQueryFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + path_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (queryBuilder_ == null) { + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } else { + queryBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + scoreMode_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode.SCORE_MODE_NONE; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.path_ = path_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (queryBuilder_ == null) { + result.query_ = query_; + } else { + result.query_ = queryBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.scoreMode_ = scoreMode_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery.getDefaultInstance()) return this; + if (other.hasPath()) { + setPath(other.getPath()); + } + if (other.hasQuery()) { + mergeQuery(other.getQuery()); + } + if (other.hasScoreMode()) { + setScoreMode(other.getScoreMode()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + path_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + if (hasQuery()) { + subBuilder.mergeFrom(getQuery()); + } + input.readMessage(subBuilder, extensionRegistry); + setQuery(subBuilder.buildPartial()); + break; + } + case 24: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode value = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(3, rawValue); + } else { + bitField0_ |= 0x00000004; + scoreMode_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // optional string path = 1; + private java.lang.Object path_ = ""; + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + path_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setPath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + return this; + } + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000001); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + void setPath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> queryBuilder_; + public boolean hasQuery() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery() { + if (queryBuilder_ == null) { + return query_; + } else { + return queryBuilder_.getMessage(); + } + } + public Builder setQuery(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (queryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + query_ = value; + onChanged(); + } else { + queryBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setQuery( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (queryBuilder_ == null) { + query_ = builderForValue.build(); + onChanged(); + } else { + queryBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeQuery(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (queryBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + query_ != com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()) { + query_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(query_).mergeFrom(value).buildPartial(); + } else { + query_ = value; + } + onChanged(); + } else { + queryBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearQuery() { + if (queryBuilder_ == null) { + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + onChanged(); + } else { + queryBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getQueryBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getQueryFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder() { + if (queryBuilder_ != null) { + return queryBuilder_.getMessageOrBuilder(); + } else { + return query_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getQueryFieldBuilder() { + if (queryBuilder_ == null) { + queryBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + query_, + getParentForChildren(), + isClean()); + query_ = null; + } + return queryBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ScoreMode score_mode = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode scoreMode_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode.SCORE_MODE_NONE; + public boolean hasScoreMode() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode getScoreMode() { + return scoreMode_; + } + public Builder setScoreMode(com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + scoreMode_ = value; + onChanged(); + return this; + } + public Builder clearScoreMode() { + bitField0_ = (bitField0_ & ~0x00000004); + scoreMode_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreMode.SCORE_MODE_NONE; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.NestedQuery) + } + + static { + defaultInstance = new NestedQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.NestedQuery) + } + + public interface GeoBoundingBoxQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional string top_left = 2; + boolean hasTopLeft(); + String getTopLeft(); + + // optional string bottom_right = 3; + boolean hasBottomRight(); + String getBottomRight(); + } + public static final class GeoBoundingBoxQuery extends + com.google.protobuf.GeneratedMessage + implements GeoBoundingBoxQueryOrBuilder { + // Use GeoBoundingBoxQuery.newBuilder() to construct. + private GeoBoundingBoxQuery(Builder builder) { + super(builder); + } + private GeoBoundingBoxQuery(boolean noInit) {} + + private static final GeoBoundingBoxQuery defaultInstance; + public static GeoBoundingBoxQuery getDefaultInstance() { + return defaultInstance; + } + + public GeoBoundingBoxQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string top_left = 2; + public static final int TOP_LEFT_FIELD_NUMBER = 2; + private java.lang.Object topLeft_; + public boolean hasTopLeft() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTopLeft() { + java.lang.Object ref = topLeft_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + topLeft_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTopLeftBytes() { + java.lang.Object ref = topLeft_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + topLeft_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string bottom_right = 3; + public static final int BOTTOM_RIGHT_FIELD_NUMBER = 3; + private java.lang.Object bottomRight_; + public boolean hasBottomRight() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getBottomRight() { + java.lang.Object ref = bottomRight_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + bottomRight_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getBottomRightBytes() { + java.lang.Object ref = bottomRight_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + bottomRight_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + fieldName_ = ""; + topLeft_ = ""; + bottomRight_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTopLeftBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getBottomRightBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTopLeftBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getBottomRightBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + topLeft_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + bottomRight_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.topLeft_ = topLeft_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.bottomRight_ = bottomRight_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasTopLeft()) { + setTopLeft(other.getTopLeft()); + } + if (other.hasBottomRight()) { + setBottomRight(other.getBottomRight()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + topLeft_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + bottomRight_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional string top_left = 2; + private java.lang.Object topLeft_ = ""; + public boolean hasTopLeft() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTopLeft() { + java.lang.Object ref = topLeft_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + topLeft_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTopLeft(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + topLeft_ = value; + onChanged(); + return this; + } + public Builder clearTopLeft() { + bitField0_ = (bitField0_ & ~0x00000002); + topLeft_ = getDefaultInstance().getTopLeft(); + onChanged(); + return this; + } + void setTopLeft(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + topLeft_ = value; + onChanged(); + } + + // optional string bottom_right = 3; + private java.lang.Object bottomRight_ = ""; + public boolean hasBottomRight() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getBottomRight() { + java.lang.Object ref = bottomRight_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + bottomRight_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setBottomRight(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + bottomRight_ = value; + onChanged(); + return this; + } + public Builder clearBottomRight() { + bitField0_ = (bitField0_ & ~0x00000004); + bottomRight_ = getDefaultInstance().getBottomRight(); + onChanged(); + return this; + } + void setBottomRight(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + bottomRight_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GeoBoundingBoxQuery) + } + + static { + defaultInstance = new GeoBoundingBoxQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GeoBoundingBoxQuery) + } + + public interface GeoDistanceQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional string center_point = 2; + boolean hasCenterPoint(); + String getCenterPoint(); + + // optional double distance = 3; + boolean hasDistance(); + double getDistance(); + } + public static final class GeoDistanceQuery extends + com.google.protobuf.GeneratedMessage + implements GeoDistanceQueryOrBuilder { + // Use GeoDistanceQuery.newBuilder() to construct. + private GeoDistanceQuery(Builder builder) { + super(builder); + } + private GeoDistanceQuery(boolean noInit) {} + + private static final GeoDistanceQuery defaultInstance; + public static GeoDistanceQuery getDefaultInstance() { + return defaultInstance; + } + + public GeoDistanceQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string center_point = 2; + public static final int CENTER_POINT_FIELD_NUMBER = 2; + private java.lang.Object centerPoint_; + public boolean hasCenterPoint() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getCenterPoint() { + java.lang.Object ref = centerPoint_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + centerPoint_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getCenterPointBytes() { + java.lang.Object ref = centerPoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + centerPoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional double distance = 3; + public static final int DISTANCE_FIELD_NUMBER = 3; + private double distance_; + public boolean hasDistance() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public double getDistance() { + return distance_; + } + + private void initFields() { + fieldName_ = ""; + centerPoint_ = ""; + distance_ = 0D; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getCenterPointBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeDouble(3, distance_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getCenterPointBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(3, distance_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + centerPoint_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + distance_ = 0D; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.centerPoint_ = centerPoint_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.distance_ = distance_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasCenterPoint()) { + setCenterPoint(other.getCenterPoint()); + } + if (other.hasDistance()) { + setDistance(other.getDistance()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + centerPoint_ = input.readBytes(); + break; + } + case 25: { + bitField0_ |= 0x00000004; + distance_ = input.readDouble(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional string center_point = 2; + private java.lang.Object centerPoint_ = ""; + public boolean hasCenterPoint() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getCenterPoint() { + java.lang.Object ref = centerPoint_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + centerPoint_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setCenterPoint(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + centerPoint_ = value; + onChanged(); + return this; + } + public Builder clearCenterPoint() { + bitField0_ = (bitField0_ & ~0x00000002); + centerPoint_ = getDefaultInstance().getCenterPoint(); + onChanged(); + return this; + } + void setCenterPoint(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + centerPoint_ = value; + onChanged(); + } + + // optional double distance = 3; + private double distance_ ; + public boolean hasDistance() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public double getDistance() { + return distance_; + } + public Builder setDistance(double value) { + bitField0_ |= 0x00000004; + distance_ = value; + onChanged(); + return this; + } + public Builder clearDistance() { + bitField0_ = (bitField0_ & ~0x00000004); + distance_ = 0D; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GeoDistanceQuery) + } + + static { + defaultInstance = new GeoDistanceQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GeoDistanceQuery) + } + + public interface GeoPolygonQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // repeated string points = 2; + java.util.List getPointsList(); + int getPointsCount(); + String getPoints(int index); + } + public static final class GeoPolygonQuery extends + com.google.protobuf.GeneratedMessage + implements GeoPolygonQueryOrBuilder { + // Use GeoPolygonQuery.newBuilder() to construct. + private GeoPolygonQuery(Builder builder) { + super(builder); + } + private GeoPolygonQuery(boolean noInit) {} + + private static final GeoPolygonQuery defaultInstance; + public static GeoPolygonQuery getDefaultInstance() { + return defaultInstance; + } + + public GeoPolygonQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated string points = 2; + public static final int POINTS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList points_; + public java.util.List + getPointsList() { + return points_; + } + public int getPointsCount() { + return points_.size(); + } + public String getPoints(int index) { + return points_.get(index); + } + + private void initFields() { + fieldName_ = ""; + points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + for (int i = 0; i < points_.size(); i++) { + output.writeBytes(2, points_.getByteString(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < points_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(points_.getByteString(i)); + } + size += dataSize; + size += 1 * getPointsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + points_ = new com.google.protobuf.UnmodifiableLazyStringList( + points_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.points_ = points_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (!other.points_.isEmpty()) { + if (points_.isEmpty()) { + points_ = other.points_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensurePointsIsMutable(); + points_.addAll(other.points_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + ensurePointsIsMutable(); + points_.add(input.readBytes()); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // repeated string points = 2; + private com.google.protobuf.LazyStringList points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensurePointsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + points_ = new com.google.protobuf.LazyStringArrayList(points_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getPointsList() { + return java.util.Collections.unmodifiableList(points_); + } + public int getPointsCount() { + return points_.size(); + } + public String getPoints(int index) { + return points_.get(index); + } + public Builder setPoints( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePointsIsMutable(); + points_.set(index, value); + onChanged(); + return this; + } + public Builder addPoints(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePointsIsMutable(); + points_.add(value); + onChanged(); + return this; + } + public Builder addAllPoints( + java.lang.Iterable values) { + ensurePointsIsMutable(); + super.addAll(values, points_); + onChanged(); + return this; + } + public Builder clearPoints() { + points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + void addPoints(com.google.protobuf.ByteString value) { + ensurePointsIsMutable(); + points_.add(value); + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GeoPolygonQuery) + } + + static { + defaultInstance = new GeoPolygonQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GeoPolygonQuery) + } + + public interface QueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.QueryType type = 1; + boolean hasType(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryType getType(); + + // optional bytes query = 2; + boolean hasQuery(); + com.google.protobuf.ByteString getQuery(); + } + public static final class Query extends + com.google.protobuf.GeneratedMessage + implements QueryOrBuilder { + // Use Query.newBuilder() to construct. + private Query(Builder builder) { + super(builder); + } + private Query(boolean noInit) {} + + private static final Query defaultInstance; + public static Query getDefaultInstance() { + return defaultInstance; + } + + public Query getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.QueryType type = 1; + public static final int TYPE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.QueryType type_; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryType getType() { + return type_; + } + + // optional bytes query = 2; + public static final int QUERY_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString query_; + public boolean hasQuery() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getQuery() { + return query_; + } + + private void initFields() { + type_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryType.MATCH_QUERY; + query_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, query_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, type_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, query_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Query parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.Query prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + type_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryType.MATCH_QUERY; + bitField0_ = (bitField0_ & ~0x00000001); + query_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Query build() { + com.alicloud.openservices.tablestore.core.protocol.Search.Query result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.Query buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.Query result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Query buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.Query result = new com.alicloud.openservices.tablestore.core.protocol.Search.Query(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.query_ = query_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.Query) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.Query)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.Query other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()) return this; + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasQuery()) { + setQuery(other.getQuery()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryType value = com.alicloud.openservices.tablestore.core.protocol.Search.QueryType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + type_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + query_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.QueryType type = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.QueryType type_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryType.MATCH_QUERY; + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryType getType() { + return type_; + } + public Builder setType(com.alicloud.openservices.tablestore.core.protocol.Search.QueryType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + type_ = value; + onChanged(); + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000001); + type_ = com.alicloud.openservices.tablestore.core.protocol.Search.QueryType.MATCH_QUERY; + onChanged(); + return this; + } + + // optional bytes query = 2; + private com.google.protobuf.ByteString query_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasQuery() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getQuery() { + return query_; + } + public Builder setQuery(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + query_ = value; + onChanged(); + return this; + } + public Builder clearQuery() { + bitField0_ = (bitField0_ & ~0x00000002); + query_ = getDefaultInstance().getQuery(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Query) + } + + static { + defaultInstance = new Query(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Query) + } + + public interface CollapseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + } + public static final class Collapse extends + com.google.protobuf.GeneratedMessage + implements CollapseOrBuilder { + // Use Collapse.newBuilder() to construct. + private Collapse(Builder builder) { + super(builder); + } + private Collapse(boolean noInit) {} + + private static final Collapse defaultInstance; + public static Collapse getDefaultInstance() { + return defaultInstance; + } + + public Collapse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + fieldName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Collapse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.Collapse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.CollapseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Collapse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Collapse build() { + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.Collapse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Collapse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse result = new com.alicloud.openservices.tablestore.core.protocol.Search.Collapse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.Collapse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.Collapse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.Collapse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Collapse) + } + + static { + defaultInstance = new Collapse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Collapse) + } + + public interface NestedFilterOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string path = 1; + boolean hasPath(); + String getPath(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query filter = 2; + boolean hasFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterOrBuilder(); + } + public static final class NestedFilter extends + com.google.protobuf.GeneratedMessage + implements NestedFilterOrBuilder { + // Use NestedFilter.newBuilder() to construct. + private NestedFilter(Builder builder) { + super(builder); + } + private NestedFilter(boolean noInit) {} + + private static final NestedFilter defaultInstance; + public static NestedFilter getDefaultInstance() { + return defaultInstance; + } + + public NestedFilter getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_fieldAccessorTable; + } + + private int bitField0_; + // optional string path = 1; + public static final int PATH_FIELD_NUMBER = 1; + private java.lang.Object path_; + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getPath() { + java.lang.Object ref = path_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + path_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query filter = 2; + public static final int FILTER_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query filter_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilter() { + return filter_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterOrBuilder() { + return filter_; + } + + private void initFields() { + path_ = ""; + filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, filter_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, filter_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getFilterFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + path_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (filterBuilder_ == null) { + filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } else { + filterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter build() { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter result = new com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.path_ = path_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (filterBuilder_ == null) { + result.filter_ = filter_; + } else { + result.filter_ = filterBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance()) return this; + if (other.hasPath()) { + setPath(other.getPath()); + } + if (other.hasFilter()) { + mergeFilter(other.getFilter()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + path_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + if (hasFilter()) { + subBuilder.mergeFrom(getFilter()); + } + input.readMessage(subBuilder, extensionRegistry); + setFilter(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional string path = 1; + private java.lang.Object path_ = ""; + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + path_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setPath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + return this; + } + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000001); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + void setPath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query filter = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> filterBuilder_; + public boolean hasFilter() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getFilter() { + if (filterBuilder_ == null) { + return filter_; + } else { + return filterBuilder_.getMessage(); + } + } + public Builder setFilter(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (filterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + filter_ = value; + onChanged(); + } else { + filterBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setFilter( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (filterBuilder_ == null) { + filter_ = builderForValue.build(); + onChanged(); + } else { + filterBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeFilter(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (filterBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + filter_ != com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()) { + filter_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(filter_).mergeFrom(value).buildPartial(); + } else { + filter_ = value; + } + onChanged(); + } else { + filterBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearFilter() { + if (filterBuilder_ == null) { + filter_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + onChanged(); + } else { + filterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getFilterBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getFilterFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getFilterOrBuilder() { + if (filterBuilder_ != null) { + return filterBuilder_.getMessageOrBuilder(); + } else { + return filter_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getFilterFieldBuilder() { + if (filterBuilder_ == null) { + filterBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + filter_, + getParentForChildren(), + isClean()); + filter_ = null; + } + return filterBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.NestedFilter) + } + + static { + defaultInstance = new NestedFilter(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.NestedFilter) + } + + public interface ScoreSortOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 1; + boolean hasOrder(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder(); + } + public static final class ScoreSort extends + com.google.protobuf.GeneratedMessage + implements ScoreSortOrBuilder { + // Use ScoreSort.newBuilder() to construct. + private ScoreSort(Builder builder) { + super(builder); + } + private ScoreSort(boolean noInit) {} + + private static final ScoreSort defaultInstance; + public static ScoreSort getDefaultInstance() { + return defaultInstance; + } + + public ScoreSort getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 1; + public static final int ORDER_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_; + public boolean hasOrder() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + + private void initFields() { + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, order_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, order_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSortOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort build() { + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort result = new com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.order_ = order_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDefaultInstance()) return this; + if (other.hasOrder()) { + setOrder(other.getOrder()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + order_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + public boolean hasOrder() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + public Builder setOrder(com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + order_ = value; + onChanged(); + return this; + } + public Builder clearOrder() { + bitField0_ = (bitField0_ & ~0x00000001); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ScoreSort) + } + + static { + defaultInstance = new ScoreSort(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ScoreSort) + } + + public interface PrimaryKeySortOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 1; + boolean hasOrder(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder(); + } + public static final class PrimaryKeySort extends + com.google.protobuf.GeneratedMessage + implements PrimaryKeySortOrBuilder { + // Use PrimaryKeySort.newBuilder() to construct. + private PrimaryKeySort(Builder builder) { + super(builder); + } + private PrimaryKeySort(boolean noInit) {} + + private static final PrimaryKeySort defaultInstance; + public static PrimaryKeySort getDefaultInstance() { + return defaultInstance; + } + + public PrimaryKeySort getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 1; + public static final int ORDER_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_; + public boolean hasOrder() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + + private void initFields() { + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, order_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, order_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySortOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort build() { + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort result = new com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.order_ = order_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDefaultInstance()) return this; + if (other.hasOrder()) { + setOrder(other.getOrder()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + order_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + public boolean hasOrder() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + public Builder setOrder(com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + order_ = value; + onChanged(); + return this; + } + public Builder clearOrder() { + bitField0_ = (bitField0_ & ~0x00000001); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySort) + } + + static { + defaultInstance = new PrimaryKeySort(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySort) + } + + public interface FieldSortOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 2; + boolean hasOrder(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortMode mode = 3; + boolean hasMode(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortMode getMode(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.NestedFilter nested_filter = 4; + boolean hasNestedFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter getNestedFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder getNestedFilterOrBuilder(); + } + public static final class FieldSort extends + com.google.protobuf.GeneratedMessage + implements FieldSortOrBuilder { + // Use FieldSort.newBuilder() to construct. + private FieldSort(Builder builder) { + super(builder); + } + private FieldSort(boolean noInit) {} + + private static final FieldSort defaultInstance; + public static FieldSort getDefaultInstance() { + return defaultInstance; + } + + public FieldSort getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 2; + public static final int ORDER_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_; + public boolean hasOrder() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortMode mode = 3; + public static final int MODE_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortMode mode_; + public boolean hasMode() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortMode getMode() { + return mode_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.NestedFilter nested_filter = 4; + public static final int NESTED_FILTER_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter nestedFilter_; + public boolean hasNestedFilter() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter getNestedFilter() { + return nestedFilter_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder getNestedFilterOrBuilder() { + return nestedFilter_; + } + + private void initFields() { + fieldName_ = ""; + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(2, order_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(3, mode_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, nestedFilter_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, order_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, mode_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, nestedFilter_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.FieldSortOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getNestedFilterFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + bitField0_ = (bitField0_ & ~0x00000002); + mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + bitField0_ = (bitField0_ & ~0x00000004); + if (nestedFilterBuilder_ == null) { + nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + } else { + nestedFilterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort build() { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort result = new com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.order_ = order_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.mode_ = mode_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (nestedFilterBuilder_ == null) { + result.nestedFilter_ = nestedFilter_; + } else { + result.nestedFilter_ = nestedFilterBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasOrder()) { + setOrder(other.getOrder()); + } + if (other.hasMode()) { + setMode(other.getMode()); + } + if (other.hasNestedFilter()) { + mergeNestedFilter(other.getNestedFilter()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 16: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + order_ = value; + } + break; + } + case 24: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortMode value = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(3, rawValue); + } else { + bitField0_ |= 0x00000004; + mode_ = value; + } + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.newBuilder(); + if (hasNestedFilter()) { + subBuilder.mergeFrom(getNestedFilter()); + } + input.readMessage(subBuilder, extensionRegistry); + setNestedFilter(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + public boolean hasOrder() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + public Builder setOrder(com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + order_ = value; + onChanged(); + return this; + } + public Builder clearOrder() { + bitField0_ = (bitField0_ & ~0x00000002); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortMode mode = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortMode mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + public boolean hasMode() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortMode getMode() { + return mode_; + } + public Builder setMode(com.alicloud.openservices.tablestore.core.protocol.Search.SortMode value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + mode_ = value; + onChanged(); + return this; + } + public Builder clearMode() { + bitField0_ = (bitField0_ & ~0x00000004); + mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.NestedFilter nested_filter = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder> nestedFilterBuilder_; + public boolean hasNestedFilter() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter getNestedFilter() { + if (nestedFilterBuilder_ == null) { + return nestedFilter_; + } else { + return nestedFilterBuilder_.getMessage(); + } + } + public Builder setNestedFilter(com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter value) { + if (nestedFilterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + nestedFilter_ = value; + onChanged(); + } else { + nestedFilterBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setNestedFilter( + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder builderForValue) { + if (nestedFilterBuilder_ == null) { + nestedFilter_ = builderForValue.build(); + onChanged(); + } else { + nestedFilterBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeNestedFilter(com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter value) { + if (nestedFilterBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + nestedFilter_ != com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance()) { + nestedFilter_ = + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.newBuilder(nestedFilter_).mergeFrom(value).buildPartial(); + } else { + nestedFilter_ = value; + } + onChanged(); + } else { + nestedFilterBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearNestedFilter() { + if (nestedFilterBuilder_ == null) { + nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + onChanged(); + } else { + nestedFilterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder getNestedFilterBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getNestedFilterFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder getNestedFilterOrBuilder() { + if (nestedFilterBuilder_ != null) { + return nestedFilterBuilder_.getMessageOrBuilder(); + } else { + return nestedFilter_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder> + getNestedFilterFieldBuilder() { + if (nestedFilterBuilder_ == null) { + nestedFilterBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder>( + nestedFilter_, + getParentForChildren(), + isClean()); + nestedFilter_ = null; + } + return nestedFilterBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.FieldSort) + } + + static { + defaultInstance = new FieldSort(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.FieldSort) + } + + public interface GeoDistanceSortOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // repeated string points = 2; + java.util.List getPointsList(); + int getPointsCount(); + String getPoints(int index); + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 3; + boolean hasOrder(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortMode mode = 4; + boolean hasMode(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortMode getMode(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.GeoDistanceType distance_type = 5; + boolean hasDistanceType(); + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType getDistanceType(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.NestedFilter nested_filter = 6; + boolean hasNestedFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter getNestedFilter(); + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder getNestedFilterOrBuilder(); + } + public static final class GeoDistanceSort extends + com.google.protobuf.GeneratedMessage + implements GeoDistanceSortOrBuilder { + // Use GeoDistanceSort.newBuilder() to construct. + private GeoDistanceSort(Builder builder) { + super(builder); + } + private GeoDistanceSort(boolean noInit) {} + + private static final GeoDistanceSort defaultInstance; + public static GeoDistanceSort getDefaultInstance() { + return defaultInstance; + } + + public GeoDistanceSort getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated string points = 2; + public static final int POINTS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList points_; + public java.util.List + getPointsList() { + return points_; + } + public int getPointsCount() { + return points_.size(); + } + public String getPoints(int index) { + return points_.get(index); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 3; + public static final int ORDER_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_; + public boolean hasOrder() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortMode mode = 4; + public static final int MODE_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortMode mode_; + public boolean hasMode() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortMode getMode() { + return mode_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.GeoDistanceType distance_type = 5; + public static final int DISTANCE_TYPE_FIELD_NUMBER = 5; + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType distanceType_; + public boolean hasDistanceType() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType getDistanceType() { + return distanceType_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.NestedFilter nested_filter = 6; + public static final int NESTED_FILTER_FIELD_NUMBER = 6; + private com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter nestedFilter_; + public boolean hasNestedFilter() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter getNestedFilter() { + return nestedFilter_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder getNestedFilterOrBuilder() { + return nestedFilter_; + } + + private void initFields() { + fieldName_ = ""; + points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + distanceType_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType.GEO_DISTANCE_ARC; + nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + for (int i = 0; i < points_.size(); i++) { + output.writeBytes(2, points_.getByteString(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(3, order_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(4, mode_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeEnum(5, distanceType_.getNumber()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeMessage(6, nestedFilter_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + { + int dataSize = 0; + for (int i = 0; i < points_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(points_.getByteString(i)); + } + size += dataSize; + size += 1 * getPointsList().size(); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, order_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, mode_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(5, distanceType_.getNumber()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, nestedFilter_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSortOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getNestedFilterFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + bitField0_ = (bitField0_ & ~0x00000004); + mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + bitField0_ = (bitField0_ & ~0x00000008); + distanceType_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType.GEO_DISTANCE_ARC; + bitField0_ = (bitField0_ & ~0x00000010); + if (nestedFilterBuilder_ == null) { + nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + } else { + nestedFilterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000020); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort build() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort result = new com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + points_ = new com.google.protobuf.UnmodifiableLazyStringList( + points_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.points_ = points_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + result.order_ = order_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000004; + } + result.mode_ = mode_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000008; + } + result.distanceType_ = distanceType_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000010; + } + if (nestedFilterBuilder_ == null) { + result.nestedFilter_ = nestedFilter_; + } else { + result.nestedFilter_ = nestedFilterBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (!other.points_.isEmpty()) { + if (points_.isEmpty()) { + points_ = other.points_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensurePointsIsMutable(); + points_.addAll(other.points_); + } + onChanged(); + } + if (other.hasOrder()) { + setOrder(other.getOrder()); + } + if (other.hasMode()) { + setMode(other.getMode()); + } + if (other.hasDistanceType()) { + setDistanceType(other.getDistanceType()); + } + if (other.hasNestedFilter()) { + mergeNestedFilter(other.getNestedFilter()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 18: { + ensurePointsIsMutable(); + points_.add(input.readBytes()); + break; + } + case 24: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(3, rawValue); + } else { + bitField0_ |= 0x00000004; + order_ = value; + } + break; + } + case 32: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortMode value = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(4, rawValue); + } else { + bitField0_ |= 0x00000008; + mode_ = value; + } + break; + } + case 40: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType value = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(5, rawValue); + } else { + bitField0_ |= 0x00000010; + distanceType_ = value; + } + break; + } + case 50: { + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.newBuilder(); + if (hasNestedFilter()) { + subBuilder.mergeFrom(getNestedFilter()); + } + input.readMessage(subBuilder, extensionRegistry); + setNestedFilter(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // repeated string points = 2; + private com.google.protobuf.LazyStringList points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensurePointsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + points_ = new com.google.protobuf.LazyStringArrayList(points_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getPointsList() { + return java.util.Collections.unmodifiableList(points_); + } + public int getPointsCount() { + return points_.size(); + } + public String getPoints(int index) { + return points_.get(index); + } + public Builder setPoints( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePointsIsMutable(); + points_.set(index, value); + onChanged(); + return this; + } + public Builder addPoints(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensurePointsIsMutable(); + points_.add(value); + onChanged(); + return this; + } + public Builder addAllPoints( + java.lang.Iterable values) { + ensurePointsIsMutable(); + super.addAll(values, points_); + onChanged(); + return this; + } + public Builder clearPoints() { + points_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + void addPoints(com.google.protobuf.ByteString value) { + ensurePointsIsMutable(); + points_.add(value); + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortOrder order = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + public boolean hasOrder() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder getOrder() { + return order_; + } + public Builder setOrder(com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + order_ = value; + onChanged(); + return this; + } + public Builder clearOrder() { + bitField0_ = (bitField0_ & ~0x00000004); + order_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortOrder.SORT_ORDER_ASC; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SortMode mode = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.SortMode mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + public boolean hasMode() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortMode getMode() { + return mode_; + } + public Builder setMode(com.alicloud.openservices.tablestore.core.protocol.Search.SortMode value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + mode_ = value; + onChanged(); + return this; + } + public Builder clearMode() { + bitField0_ = (bitField0_ & ~0x00000008); + mode_ = com.alicloud.openservices.tablestore.core.protocol.Search.SortMode.SORT_MODE_MIN; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.GeoDistanceType distance_type = 5; + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType distanceType_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType.GEO_DISTANCE_ARC; + public boolean hasDistanceType() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType getDistanceType() { + return distanceType_; + } + public Builder setDistanceType(com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + distanceType_ = value; + onChanged(); + return this; + } + public Builder clearDistanceType() { + bitField0_ = (bitField0_ & ~0x00000010); + distanceType_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceType.GEO_DISTANCE_ARC; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.NestedFilter nested_filter = 6; + private com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder> nestedFilterBuilder_; + public boolean hasNestedFilter() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter getNestedFilter() { + if (nestedFilterBuilder_ == null) { + return nestedFilter_; + } else { + return nestedFilterBuilder_.getMessage(); + } + } + public Builder setNestedFilter(com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter value) { + if (nestedFilterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + nestedFilter_ = value; + onChanged(); + } else { + nestedFilterBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + return this; + } + public Builder setNestedFilter( + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder builderForValue) { + if (nestedFilterBuilder_ == null) { + nestedFilter_ = builderForValue.build(); + onChanged(); + } else { + nestedFilterBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + return this; + } + public Builder mergeNestedFilter(com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter value) { + if (nestedFilterBuilder_ == null) { + if (((bitField0_ & 0x00000020) == 0x00000020) && + nestedFilter_ != com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance()) { + nestedFilter_ = + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.newBuilder(nestedFilter_).mergeFrom(value).buildPartial(); + } else { + nestedFilter_ = value; + } + onChanged(); + } else { + nestedFilterBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000020; + return this; + } + public Builder clearNestedFilter() { + if (nestedFilterBuilder_ == null) { + nestedFilter_ = com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.getDefaultInstance(); + onChanged(); + } else { + nestedFilterBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000020); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder getNestedFilterBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getNestedFilterFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder getNestedFilterOrBuilder() { + if (nestedFilterBuilder_ != null) { + return nestedFilterBuilder_.getMessageOrBuilder(); + } else { + return nestedFilter_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder> + getNestedFilterFieldBuilder() { + if (nestedFilterBuilder_ == null) { + nestedFilterBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilterOrBuilder>( + nestedFilter_, + getParentForChildren(), + isClean()); + nestedFilter_ = null; + } + return nestedFilterBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GeoDistanceSort) + } + + static { + defaultInstance = new GeoDistanceSort(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GeoDistanceSort) + } + + public interface SorterOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldSort field_sort = 1; + boolean hasFieldSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort getFieldSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSortOrBuilder getFieldSortOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.GeoDistanceSort geo_distance_sort = 2; + boolean hasGeoDistanceSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort getGeoDistanceSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSortOrBuilder getGeoDistanceSortOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ScoreSort score_sort = 3; + boolean hasScoreSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort getScoreSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSortOrBuilder getScoreSortOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySort pk_sort = 4; + boolean hasPkSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort getPkSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySortOrBuilder getPkSortOrBuilder(); + } + public static final class Sorter extends + com.google.protobuf.GeneratedMessage + implements SorterOrBuilder { + // Use Sorter.newBuilder() to construct. + private Sorter(Builder builder) { + super(builder); + } + private Sorter(boolean noInit) {} + + private static final Sorter defaultInstance; + public static Sorter getDefaultInstance() { + return defaultInstance; + } + + public Sorter getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldSort field_sort = 1; + public static final int FIELD_SORT_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort fieldSort_; + public boolean hasFieldSort() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort getFieldSort() { + return fieldSort_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSortOrBuilder getFieldSortOrBuilder() { + return fieldSort_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.GeoDistanceSort geo_distance_sort = 2; + public static final int GEO_DISTANCE_SORT_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort geoDistanceSort_; + public boolean hasGeoDistanceSort() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort getGeoDistanceSort() { + return geoDistanceSort_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSortOrBuilder getGeoDistanceSortOrBuilder() { + return geoDistanceSort_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ScoreSort score_sort = 3; + public static final int SCORE_SORT_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort scoreSort_; + public boolean hasScoreSort() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort getScoreSort() { + return scoreSort_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSortOrBuilder getScoreSortOrBuilder() { + return scoreSort_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySort pk_sort = 4; + public static final int PK_SORT_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort pkSort_; + public boolean hasPkSort() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort getPkSort() { + return pkSort_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySortOrBuilder getPkSortOrBuilder() { + return pkSort_; + } + + private void initFields() { + fieldSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDefaultInstance(); + geoDistanceSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDefaultInstance(); + scoreSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDefaultInstance(); + pkSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, fieldSort_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, geoDistanceSort_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, scoreSort_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, pkSort_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, fieldSort_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, geoDistanceSort_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, scoreSort_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, pkSort_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sorter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.Sorter prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.SorterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getFieldSortFieldBuilder(); + getGeoDistanceSortFieldBuilder(); + getScoreSortFieldBuilder(); + getPkSortFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (fieldSortBuilder_ == null) { + fieldSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDefaultInstance(); + } else { + fieldSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (geoDistanceSortBuilder_ == null) { + geoDistanceSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDefaultInstance(); + } else { + geoDistanceSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (scoreSortBuilder_ == null) { + scoreSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDefaultInstance(); + } else { + scoreSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (pkSortBuilder_ == null) { + pkSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDefaultInstance(); + } else { + pkSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter build() { + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.Sorter buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter result = new com.alicloud.openservices.tablestore.core.protocol.Search.Sorter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (fieldSortBuilder_ == null) { + result.fieldSort_ = fieldSort_; + } else { + result.fieldSort_ = fieldSortBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (geoDistanceSortBuilder_ == null) { + result.geoDistanceSort_ = geoDistanceSort_; + } else { + result.geoDistanceSort_ = geoDistanceSortBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (scoreSortBuilder_ == null) { + result.scoreSort_ = scoreSort_; + } else { + result.scoreSort_ = scoreSortBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (pkSortBuilder_ == null) { + result.pkSort_ = pkSort_; + } else { + result.pkSort_ = pkSortBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.Sorter) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.Sorter)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.Sorter other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.getDefaultInstance()) return this; + if (other.hasFieldSort()) { + mergeFieldSort(other.getFieldSort()); + } + if (other.hasGeoDistanceSort()) { + mergeGeoDistanceSort(other.getGeoDistanceSort()); + } + if (other.hasScoreSort()) { + mergeScoreSort(other.getScoreSort()); + } + if (other.hasPkSort()) { + mergePkSort(other.getPkSort()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.newBuilder(); + if (hasFieldSort()) { + subBuilder.mergeFrom(getFieldSort()); + } + input.readMessage(subBuilder, extensionRegistry); + setFieldSort(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.newBuilder(); + if (hasGeoDistanceSort()) { + subBuilder.mergeFrom(getGeoDistanceSort()); + } + input.readMessage(subBuilder, extensionRegistry); + setGeoDistanceSort(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.newBuilder(); + if (hasScoreSort()) { + subBuilder.mergeFrom(getScoreSort()); + } + input.readMessage(subBuilder, extensionRegistry); + setScoreSort(subBuilder.buildPartial()); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.newBuilder(); + if (hasPkSort()) { + subBuilder.mergeFrom(getPkSort()); + } + input.readMessage(subBuilder, extensionRegistry); + setPkSort(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldSort field_sort = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort fieldSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSortOrBuilder> fieldSortBuilder_; + public boolean hasFieldSort() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort getFieldSort() { + if (fieldSortBuilder_ == null) { + return fieldSort_; + } else { + return fieldSortBuilder_.getMessage(); + } + } + public Builder setFieldSort(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort value) { + if (fieldSortBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fieldSort_ = value; + onChanged(); + } else { + fieldSortBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setFieldSort( + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.Builder builderForValue) { + if (fieldSortBuilder_ == null) { + fieldSort_ = builderForValue.build(); + onChanged(); + } else { + fieldSortBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeFieldSort(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort value) { + if (fieldSortBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + fieldSort_ != com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDefaultInstance()) { + fieldSort_ = + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.newBuilder(fieldSort_).mergeFrom(value).buildPartial(); + } else { + fieldSort_ = value; + } + onChanged(); + } else { + fieldSortBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearFieldSort() { + if (fieldSortBuilder_ == null) { + fieldSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.getDefaultInstance(); + onChanged(); + } else { + fieldSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.Builder getFieldSortBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getFieldSortFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSortOrBuilder getFieldSortOrBuilder() { + if (fieldSortBuilder_ != null) { + return fieldSortBuilder_.getMessageOrBuilder(); + } else { + return fieldSort_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSortOrBuilder> + getFieldSortFieldBuilder() { + if (fieldSortBuilder_ == null) { + fieldSortBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSortOrBuilder>( + fieldSort_, + getParentForChildren(), + isClean()); + fieldSort_ = null; + } + return fieldSortBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.GeoDistanceSort geo_distance_sort = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort geoDistanceSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort, com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSortOrBuilder> geoDistanceSortBuilder_; + public boolean hasGeoDistanceSort() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort getGeoDistanceSort() { + if (geoDistanceSortBuilder_ == null) { + return geoDistanceSort_; + } else { + return geoDistanceSortBuilder_.getMessage(); + } + } + public Builder setGeoDistanceSort(com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort value) { + if (geoDistanceSortBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + geoDistanceSort_ = value; + onChanged(); + } else { + geoDistanceSortBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setGeoDistanceSort( + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.Builder builderForValue) { + if (geoDistanceSortBuilder_ == null) { + geoDistanceSort_ = builderForValue.build(); + onChanged(); + } else { + geoDistanceSortBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeGeoDistanceSort(com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort value) { + if (geoDistanceSortBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + geoDistanceSort_ != com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDefaultInstance()) { + geoDistanceSort_ = + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.newBuilder(geoDistanceSort_).mergeFrom(value).buildPartial(); + } else { + geoDistanceSort_ = value; + } + onChanged(); + } else { + geoDistanceSortBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearGeoDistanceSort() { + if (geoDistanceSortBuilder_ == null) { + geoDistanceSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.getDefaultInstance(); + onChanged(); + } else { + geoDistanceSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.Builder getGeoDistanceSortBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getGeoDistanceSortFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSortOrBuilder getGeoDistanceSortOrBuilder() { + if (geoDistanceSortBuilder_ != null) { + return geoDistanceSortBuilder_.getMessageOrBuilder(); + } else { + return geoDistanceSort_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort, com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSortOrBuilder> + getGeoDistanceSortFieldBuilder() { + if (geoDistanceSortBuilder_ == null) { + geoDistanceSortBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort, com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSortOrBuilder>( + geoDistanceSort_, + getParentForChildren(), + isClean()); + geoDistanceSort_ = null; + } + return geoDistanceSortBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ScoreSort score_sort = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort scoreSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort, com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSortOrBuilder> scoreSortBuilder_; + public boolean hasScoreSort() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort getScoreSort() { + if (scoreSortBuilder_ == null) { + return scoreSort_; + } else { + return scoreSortBuilder_.getMessage(); + } + } + public Builder setScoreSort(com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort value) { + if (scoreSortBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scoreSort_ = value; + onChanged(); + } else { + scoreSortBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setScoreSort( + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.Builder builderForValue) { + if (scoreSortBuilder_ == null) { + scoreSort_ = builderForValue.build(); + onChanged(); + } else { + scoreSortBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeScoreSort(com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort value) { + if (scoreSortBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + scoreSort_ != com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDefaultInstance()) { + scoreSort_ = + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.newBuilder(scoreSort_).mergeFrom(value).buildPartial(); + } else { + scoreSort_ = value; + } + onChanged(); + } else { + scoreSortBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearScoreSort() { + if (scoreSortBuilder_ == null) { + scoreSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.getDefaultInstance(); + onChanged(); + } else { + scoreSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.Builder getScoreSortBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getScoreSortFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSortOrBuilder getScoreSortOrBuilder() { + if (scoreSortBuilder_ != null) { + return scoreSortBuilder_.getMessageOrBuilder(); + } else { + return scoreSort_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort, com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSortOrBuilder> + getScoreSortFieldBuilder() { + if (scoreSortBuilder_ == null) { + scoreSortBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort, com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSortOrBuilder>( + scoreSort_, + getParentForChildren(), + isClean()); + scoreSort_ = null; + } + return scoreSortBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.PrimaryKeySort pk_sort = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort pkSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort, com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySortOrBuilder> pkSortBuilder_; + public boolean hasPkSort() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort getPkSort() { + if (pkSortBuilder_ == null) { + return pkSort_; + } else { + return pkSortBuilder_.getMessage(); + } + } + public Builder setPkSort(com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort value) { + if (pkSortBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pkSort_ = value; + onChanged(); + } else { + pkSortBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setPkSort( + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.Builder builderForValue) { + if (pkSortBuilder_ == null) { + pkSort_ = builderForValue.build(); + onChanged(); + } else { + pkSortBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergePkSort(com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort value) { + if (pkSortBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + pkSort_ != com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDefaultInstance()) { + pkSort_ = + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.newBuilder(pkSort_).mergeFrom(value).buildPartial(); + } else { + pkSort_ = value; + } + onChanged(); + } else { + pkSortBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearPkSort() { + if (pkSortBuilder_ == null) { + pkSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.getDefaultInstance(); + onChanged(); + } else { + pkSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.Builder getPkSortBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getPkSortFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySortOrBuilder getPkSortOrBuilder() { + if (pkSortBuilder_ != null) { + return pkSortBuilder_.getMessageOrBuilder(); + } else { + return pkSort_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort, com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySortOrBuilder> + getPkSortFieldBuilder() { + if (pkSortBuilder_ == null) { + pkSortBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort, com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySortOrBuilder>( + pkSort_, + getParentForChildren(), + isClean()); + pkSort_ = null; + } + return pkSortBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Sorter) + } + + static { + defaultInstance = new Sorter(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Sorter) + } + + public interface SortOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Sorter sorter = 1; + java.util.List + getSorterList(); + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter getSorter(int index); + int getSorterCount(); + java.util.List + getSorterOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.SorterOrBuilder getSorterOrBuilder( + int index); + } + public static final class Sort extends + com.google.protobuf.GeneratedMessage + implements SortOrBuilder { + // Use Sort.newBuilder() to construct. + private Sort(Builder builder) { + super(builder); + } + private Sort(boolean noInit) {} + + private static final Sort defaultInstance; + public static Sort getDefaultInstance() { + return defaultInstance; + } + + public Sort getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Sorter sorter = 1; + public static final int SORTER_FIELD_NUMBER = 1; + private java.util.List sorter_; + public java.util.List getSorterList() { + return sorter_; + } + public java.util.List + getSorterOrBuilderList() { + return sorter_; + } + public int getSorterCount() { + return sorter_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter getSorter(int index) { + return sorter_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SorterOrBuilder getSorterOrBuilder( + int index) { + return sorter_.get(index); + } + + private void initFields() { + sorter_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < sorter_.size(); i++) { + output.writeMessage(1, sorter_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < sorter_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, sorter_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.Sort parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.Sort prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.Sort.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getSorterFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (sorterBuilder_ == null) { + sorter_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + sorterBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort build() { + com.alicloud.openservices.tablestore.core.protocol.Search.Sort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.Sort buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.Sort result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.Sort result = new com.alicloud.openservices.tablestore.core.protocol.Search.Sort(this); + int from_bitField0_ = bitField0_; + if (sorterBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + sorter_ = java.util.Collections.unmodifiableList(sorter_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.sorter_ = sorter_; + } else { + result.sorter_ = sorterBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.Sort) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.Sort)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.Sort other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance()) return this; + if (sorterBuilder_ == null) { + if (!other.sorter_.isEmpty()) { + if (sorter_.isEmpty()) { + sorter_ = other.sorter_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSorterIsMutable(); + sorter_.addAll(other.sorter_); + } + onChanged(); + } + } else { + if (!other.sorter_.isEmpty()) { + if (sorterBuilder_.isEmpty()) { + sorterBuilder_.dispose(); + sorterBuilder_ = null; + sorter_ = other.sorter_; + bitField0_ = (bitField0_ & ~0x00000001); + sorterBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getSorterFieldBuilder() : null; + } else { + sorterBuilder_.addAllMessages(other.sorter_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addSorter(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Sorter sorter = 1; + private java.util.List sorter_ = + java.util.Collections.emptyList(); + private void ensureSorterIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + sorter_ = new java.util.ArrayList(sorter_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SorterOrBuilder> sorterBuilder_; + + public java.util.List getSorterList() { + if (sorterBuilder_ == null) { + return java.util.Collections.unmodifiableList(sorter_); + } else { + return sorterBuilder_.getMessageList(); + } + } + public int getSorterCount() { + if (sorterBuilder_ == null) { + return sorter_.size(); + } else { + return sorterBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter getSorter(int index) { + if (sorterBuilder_ == null) { + return sorter_.get(index); + } else { + return sorterBuilder_.getMessage(index); + } + } + public Builder setSorter( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter value) { + if (sorterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSorterIsMutable(); + sorter_.set(index, value); + onChanged(); + } else { + sorterBuilder_.setMessage(index, value); + } + return this; + } + public Builder setSorter( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder builderForValue) { + if (sorterBuilder_ == null) { + ensureSorterIsMutable(); + sorter_.set(index, builderForValue.build()); + onChanged(); + } else { + sorterBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addSorter(com.alicloud.openservices.tablestore.core.protocol.Search.Sorter value) { + if (sorterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSorterIsMutable(); + sorter_.add(value); + onChanged(); + } else { + sorterBuilder_.addMessage(value); + } + return this; + } + public Builder addSorter( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter value) { + if (sorterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSorterIsMutable(); + sorter_.add(index, value); + onChanged(); + } else { + sorterBuilder_.addMessage(index, value); + } + return this; + } + public Builder addSorter( + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder builderForValue) { + if (sorterBuilder_ == null) { + ensureSorterIsMutable(); + sorter_.add(builderForValue.build()); + onChanged(); + } else { + sorterBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addSorter( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder builderForValue) { + if (sorterBuilder_ == null) { + ensureSorterIsMutable(); + sorter_.add(index, builderForValue.build()); + onChanged(); + } else { + sorterBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllSorter( + java.lang.Iterable values) { + if (sorterBuilder_ == null) { + ensureSorterIsMutable(); + super.addAll(values, sorter_); + onChanged(); + } else { + sorterBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearSorter() { + if (sorterBuilder_ == null) { + sorter_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + sorterBuilder_.clear(); + } + return this; + } + public Builder removeSorter(int index) { + if (sorterBuilder_ == null) { + ensureSorterIsMutable(); + sorter_.remove(index); + onChanged(); + } else { + sorterBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder getSorterBuilder( + int index) { + return getSorterFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SorterOrBuilder getSorterOrBuilder( + int index) { + if (sorterBuilder_ == null) { + return sorter_.get(index); } else { + return sorterBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getSorterOrBuilderList() { + if (sorterBuilder_ != null) { + return sorterBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(sorter_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder addSorterBuilder() { + return getSorterFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder addSorterBuilder( + int index) { + return getSorterFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.getDefaultInstance()); + } + public java.util.List + getSorterBuilderList() { + return getSorterFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SorterOrBuilder> + getSorterFieldBuilder() { + if (sorterBuilder_ == null) { + sorterBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter, com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SorterOrBuilder>( + sorter_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + sorter_ = null; + } + return sorterBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Sort) + } + + static { + defaultInstance = new Sort(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Sort) + } + + public interface SearchQueryOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int32 offset = 1; + boolean hasOffset(); + int getOffset(); + + // optional int32 limit = 2; + boolean hasLimit(); + int getLimit(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 4; + boolean hasQuery(); + com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery(); + com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Collapse collapse = 5; + boolean hasCollapse(); + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse getCollapse(); + com.alicloud.openservices.tablestore.core.protocol.Search.CollapseOrBuilder getCollapseOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Sort sort = 6; + boolean hasSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.Sort getSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder getSortOrBuilder(); + + // optional bool getTotalCount = 8; + boolean hasGetTotalCount(); + boolean getGetTotalCount(); + + // optional bytes token = 9; + boolean hasToken(); + com.google.protobuf.ByteString getToken(); + } + public static final class SearchQuery extends + com.google.protobuf.GeneratedMessage + implements SearchQueryOrBuilder { + // Use SearchQuery.newBuilder() to construct. + private SearchQuery(Builder builder) { + super(builder); + } + private SearchQuery(boolean noInit) {} + + private static final SearchQuery defaultInstance; + public static SearchQuery getDefaultInstance() { + return defaultInstance; + } + + public SearchQuery getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_fieldAccessorTable; + } + + private int bitField0_; + // optional int32 offset = 1; + public static final int OFFSET_FIELD_NUMBER = 1; + private int offset_; + public boolean hasOffset() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getOffset() { + return offset_; + } + + // optional int32 limit = 2; + public static final int LIMIT_FIELD_NUMBER = 2; + private int limit_; + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getLimit() { + return limit_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 4; + public static final int QUERY_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query query_; + public boolean hasQuery() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery() { + return query_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder() { + return query_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Collapse collapse = 5; + public static final int COLLAPSE_FIELD_NUMBER = 5; + private com.alicloud.openservices.tablestore.core.protocol.Search.Collapse collapse_; + public boolean hasCollapse() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Collapse getCollapse() { + return collapse_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.CollapseOrBuilder getCollapseOrBuilder() { + return collapse_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Sort sort = 6; + public static final int SORT_FIELD_NUMBER = 6; + private com.alicloud.openservices.tablestore.core.protocol.Search.Sort sort_; + public boolean hasSort() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort getSort() { + return sort_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder getSortOrBuilder() { + return sort_; + } + + // optional bool getTotalCount = 8; + public static final int GETTOTALCOUNT_FIELD_NUMBER = 8; + private boolean getTotalCount_; + public boolean hasGetTotalCount() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public boolean getGetTotalCount() { + return getTotalCount_; + } + + // optional bytes token = 9; + public static final int TOKEN_FIELD_NUMBER = 9; + private com.google.protobuf.ByteString token_; + public boolean hasToken() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public com.google.protobuf.ByteString getToken() { + return token_; + } + + private void initFields() { + offset_ = 0; + limit_ = 0; + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + collapse_ = com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDefaultInstance(); + sort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + getTotalCount_ = false; + token_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(1, offset_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(2, limit_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(4, query_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(5, collapse_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeMessage(6, sort_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBool(8, getTotalCount_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBytes(9, token_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, offset_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, limit_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, query_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, collapse_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, sort_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(8, getTotalCount_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(9, token_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.SearchQueryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getQueryFieldBuilder(); + getCollapseFieldBuilder(); + getSortFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + offset_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + limit_ = 0; + bitField0_ = (bitField0_ & ~0x00000002); + if (queryBuilder_ == null) { + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + } else { + queryBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (collapseBuilder_ == null) { + collapse_ = com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDefaultInstance(); + } else { + collapseBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + if (sortBuilder_ == null) { + sort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + } else { + sortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + getTotalCount_ = false; + bitField0_ = (bitField0_ & ~0x00000020); + token_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000040); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery build() { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery result = new com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.limit_ = limit_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (queryBuilder_ == null) { + result.query_ = query_; + } else { + result.query_ = queryBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (collapseBuilder_ == null) { + result.collapse_ = collapse_; + } else { + result.collapse_ = collapseBuilder_.build(); + } + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + if (sortBuilder_ == null) { + result.sort_ = sort_; + } else { + result.sort_ = sortBuilder_.build(); + } + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.getTotalCount_ = getTotalCount_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.token_ = token_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery.getDefaultInstance()) return this; + if (other.hasOffset()) { + setOffset(other.getOffset()); + } + if (other.hasLimit()) { + setLimit(other.getLimit()); + } + if (other.hasQuery()) { + mergeQuery(other.getQuery()); + } + if (other.hasCollapse()) { + mergeCollapse(other.getCollapse()); + } + if (other.hasSort()) { + mergeSort(other.getSort()); + } + if (other.hasGetTotalCount()) { + setGetTotalCount(other.getGetTotalCount()); + } + if (other.hasToken()) { + setToken(other.getToken()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + offset_ = input.readInt32(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + limit_ = input.readInt32(); + break; + } + case 34: { + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(); + if (hasQuery()) { + subBuilder.mergeFrom(getQuery()); + } + input.readMessage(subBuilder, extensionRegistry); + setQuery(subBuilder.buildPartial()); + break; + } + case 42: { + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.newBuilder(); + if (hasCollapse()) { + subBuilder.mergeFrom(getCollapse()); + } + input.readMessage(subBuilder, extensionRegistry); + setCollapse(subBuilder.buildPartial()); + break; + } + case 50: { + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.newBuilder(); + if (hasSort()) { + subBuilder.mergeFrom(getSort()); + } + input.readMessage(subBuilder, extensionRegistry); + setSort(subBuilder.buildPartial()); + break; + } + case 64: { + bitField0_ |= 0x00000020; + getTotalCount_ = input.readBool(); + break; + } + case 74: { + bitField0_ |= 0x00000040; + token_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional int32 offset = 1; + private int offset_ ; + public boolean hasOffset() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getOffset() { + return offset_; + } + public Builder setOffset(int value) { + bitField0_ |= 0x00000001; + offset_ = value; + onChanged(); + return this; + } + public Builder clearOffset() { + bitField0_ = (bitField0_ & ~0x00000001); + offset_ = 0; + onChanged(); + return this; + } + + // optional int32 limit = 2; + private int limit_ ; + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getLimit() { + return limit_; + } + public Builder setLimit(int value) { + bitField0_ |= 0x00000002; + limit_ = value; + onChanged(); + return this; + } + public Builder clearLimit() { + bitField0_ = (bitField0_ & ~0x00000002); + limit_ = 0; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Query query = 4; + private com.alicloud.openservices.tablestore.core.protocol.Search.Query query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> queryBuilder_; + public boolean hasQuery() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query getQuery() { + if (queryBuilder_ == null) { + return query_; + } else { + return queryBuilder_.getMessage(); + } + } + public Builder setQuery(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (queryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + query_ = value; + onChanged(); + } else { + queryBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setQuery( + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder builderForValue) { + if (queryBuilder_ == null) { + query_ = builderForValue.build(); + onChanged(); + } else { + queryBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeQuery(com.alicloud.openservices.tablestore.core.protocol.Search.Query value) { + if (queryBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + query_ != com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance()) { + query_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Query.newBuilder(query_).mergeFrom(value).buildPartial(); + } else { + query_ = value; + } + onChanged(); + } else { + queryBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearQuery() { + if (queryBuilder_ == null) { + query_ = com.alicloud.openservices.tablestore.core.protocol.Search.Query.getDefaultInstance(); + onChanged(); + } else { + queryBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder getQueryBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getQueryFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder getQueryOrBuilder() { + if (queryBuilder_ != null) { + return queryBuilder_.getMessageOrBuilder(); + } else { + return query_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder> + getQueryFieldBuilder() { + if (queryBuilder_ == null) { + queryBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Query, com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.QueryOrBuilder>( + query_, + getParentForChildren(), + isClean()); + query_ = null; + } + return queryBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Collapse collapse = 5; + private com.alicloud.openservices.tablestore.core.protocol.Search.Collapse collapse_ = com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse, com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.CollapseOrBuilder> collapseBuilder_; + public boolean hasCollapse() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Collapse getCollapse() { + if (collapseBuilder_ == null) { + return collapse_; + } else { + return collapseBuilder_.getMessage(); + } + } + public Builder setCollapse(com.alicloud.openservices.tablestore.core.protocol.Search.Collapse value) { + if (collapseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + collapse_ = value; + onChanged(); + } else { + collapseBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setCollapse( + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.Builder builderForValue) { + if (collapseBuilder_ == null) { + collapse_ = builderForValue.build(); + onChanged(); + } else { + collapseBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeCollapse(com.alicloud.openservices.tablestore.core.protocol.Search.Collapse value) { + if (collapseBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + collapse_ != com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDefaultInstance()) { + collapse_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.newBuilder(collapse_).mergeFrom(value).buildPartial(); + } else { + collapse_ = value; + } + onChanged(); + } else { + collapseBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearCollapse() { + if (collapseBuilder_ == null) { + collapse_ = com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.getDefaultInstance(); + onChanged(); + } else { + collapseBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.Builder getCollapseBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getCollapseFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.CollapseOrBuilder getCollapseOrBuilder() { + if (collapseBuilder_ != null) { + return collapseBuilder_.getMessageOrBuilder(); + } else { + return collapse_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse, com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.CollapseOrBuilder> + getCollapseFieldBuilder() { + if (collapseBuilder_ == null) { + collapseBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse, com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.CollapseOrBuilder>( + collapse_, + getParentForChildren(), + isClean()); + collapse_ = null; + } + return collapseBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Sort sort = 6; + private com.alicloud.openservices.tablestore.core.protocol.Search.Sort sort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sort, com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder> sortBuilder_; + public boolean hasSort() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort getSort() { + if (sortBuilder_ == null) { + return sort_; + } else { + return sortBuilder_.getMessage(); + } + } + public Builder setSort(com.alicloud.openservices.tablestore.core.protocol.Search.Sort value) { + if (sortBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + sort_ = value; + onChanged(); + } else { + sortBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + return this; + } + public Builder setSort( + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder builderForValue) { + if (sortBuilder_ == null) { + sort_ = builderForValue.build(); + onChanged(); + } else { + sortBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + return this; + } + public Builder mergeSort(com.alicloud.openservices.tablestore.core.protocol.Search.Sort value) { + if (sortBuilder_ == null) { + if (((bitField0_ & 0x00000010) == 0x00000010) && + sort_ != com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance()) { + sort_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.newBuilder(sort_).mergeFrom(value).buildPartial(); + } else { + sort_ = value; + } + onChanged(); + } else { + sortBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000010; + return this; + } + public Builder clearSort() { + if (sortBuilder_ == null) { + sort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + onChanged(); + } else { + sortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder getSortBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getSortFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder getSortOrBuilder() { + if (sortBuilder_ != null) { + return sortBuilder_.getMessageOrBuilder(); + } else { + return sort_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sort, com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder> + getSortFieldBuilder() { + if (sortBuilder_ == null) { + sortBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sort, com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder>( + sort_, + getParentForChildren(), + isClean()); + sort_ = null; + } + return sortBuilder_; + } + + // optional bool getTotalCount = 8; + private boolean getTotalCount_ ; + public boolean hasGetTotalCount() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public boolean getGetTotalCount() { + return getTotalCount_; + } + public Builder setGetTotalCount(boolean value) { + bitField0_ |= 0x00000020; + getTotalCount_ = value; + onChanged(); + return this; + } + public Builder clearGetTotalCount() { + bitField0_ = (bitField0_ & ~0x00000020); + getTotalCount_ = false; + onChanged(); + return this; + } + + // optional bytes token = 9; + private com.google.protobuf.ByteString token_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasToken() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public com.google.protobuf.ByteString getToken() { + return token_; + } + public Builder setToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + token_ = value; + onChanged(); + return this; + } + public Builder clearToken() { + bitField0_ = (bitField0_ & ~0x00000040); + token_ = getDefaultInstance().getToken(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.SearchQuery) + } + + static { + defaultInstance = new SearchQuery(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.SearchQuery) + } + + public interface ColumnsToGetOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.ColumnReturnType return_type = 1; + boolean hasReturnType(); + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType getReturnType(); + + // repeated string column_names = 2; + java.util.List getColumnNamesList(); + int getColumnNamesCount(); + String getColumnNames(int index); + } + public static final class ColumnsToGet extends + com.google.protobuf.GeneratedMessage + implements ColumnsToGetOrBuilder { + // Use ColumnsToGet.newBuilder() to construct. + private ColumnsToGet(Builder builder) { + super(builder); + } + private ColumnsToGet(boolean noInit) {} + + private static final ColumnsToGet defaultInstance; + public static ColumnsToGet getDefaultInstance() { + return defaultInstance; + } + + public ColumnsToGet getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.ColumnReturnType return_type = 1; + public static final int RETURN_TYPE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType returnType_; + public boolean hasReturnType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType getReturnType() { + return returnType_; + } + + // repeated string column_names = 2; + public static final int COLUMN_NAMES_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList columnNames_; + public java.util.List + getColumnNamesList() { + return columnNames_; + } + public int getColumnNamesCount() { + return columnNames_.size(); + } + public String getColumnNames(int index) { + return columnNames_.get(index); + } + + private void initFields() { + returnType_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType.RETURN_ALL; + columnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, returnType_.getNumber()); + } + for (int i = 0; i < columnNames_.size(); i++) { + output.writeBytes(2, columnNames_.getByteString(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, returnType_.getNumber()); + } + { + int dataSize = 0; + for (int i = 0; i < columnNames_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(columnNames_.getByteString(i)); + } + size += dataSize; + size += 1 * getColumnNamesList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + returnType_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType.RETURN_ALL; + bitField0_ = (bitField0_ & ~0x00000001); + columnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet build() { + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet result = new com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.returnType_ = returnType_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + columnNames_ = new com.google.protobuf.UnmodifiableLazyStringList( + columnNames_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.columnNames_ = columnNames_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDefaultInstance()) return this; + if (other.hasReturnType()) { + setReturnType(other.getReturnType()); + } + if (!other.columnNames_.isEmpty()) { + if (columnNames_.isEmpty()) { + columnNames_ = other.columnNames_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureColumnNamesIsMutable(); + columnNames_.addAll(other.columnNames_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType value = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + returnType_ = value; + } + break; + } + case 18: { + ensureColumnNamesIsMutable(); + columnNames_.add(input.readBytes()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.ColumnReturnType return_type = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType returnType_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType.RETURN_ALL; + public boolean hasReturnType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType getReturnType() { + return returnType_; + } + public Builder setReturnType(com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + returnType_ = value; + onChanged(); + return this; + } + public Builder clearReturnType() { + bitField0_ = (bitField0_ & ~0x00000001); + returnType_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnReturnType.RETURN_ALL; + onChanged(); + return this; + } + + // repeated string column_names = 2; + private com.google.protobuf.LazyStringList columnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureColumnNamesIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + columnNames_ = new com.google.protobuf.LazyStringArrayList(columnNames_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getColumnNamesList() { + return java.util.Collections.unmodifiableList(columnNames_); + } + public int getColumnNamesCount() { + return columnNames_.size(); + } + public String getColumnNames(int index) { + return columnNames_.get(index); + } + public Builder setColumnNames( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnNamesIsMutable(); + columnNames_.set(index, value); + onChanged(); + return this; + } + public Builder addColumnNames(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnNamesIsMutable(); + columnNames_.add(value); + onChanged(); + return this; + } + public Builder addAllColumnNames( + java.lang.Iterable values) { + ensureColumnNamesIsMutable(); + super.addAll(values, columnNames_); + onChanged(); + return this; + } + public Builder clearColumnNames() { + columnNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + void addColumnNames(com.google.protobuf.ByteString value) { + ensureColumnNamesIsMutable(); + columnNames_.add(value); + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ColumnsToGet) + } + + static { + defaultInstance = new ColumnsToGet(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ColumnsToGet) + } + + public interface SearchRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // optional string index_name = 2; + boolean hasIndexName(); + String getIndexName(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ColumnsToGet columns_to_get = 3; + boolean hasColumnsToGet(); + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet getColumnsToGet(); + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGetOrBuilder getColumnsToGetOrBuilder(); + + // optional bytes search_query = 4; + boolean hasSearchQuery(); + com.google.protobuf.ByteString getSearchQuery(); + + // repeated bytes routing_values = 5; + java.util.List getRoutingValuesList(); + int getRoutingValuesCount(); + com.google.protobuf.ByteString getRoutingValues(int index); + } + public static final class SearchRequest extends + com.google.protobuf.GeneratedMessage + implements SearchRequestOrBuilder { + // Use SearchRequest.newBuilder() to construct. + private SearchRequest(Builder builder) { + super(builder); + } + private SearchRequest(boolean noInit) {} + + private static final SearchRequest defaultInstance; + public static SearchRequest getDefaultInstance() { + return defaultInstance; + } + + public SearchRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_fieldAccessorTable; + } + + private int bitField0_; + // optional string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string index_name = 2; + public static final int INDEX_NAME_FIELD_NUMBER = 2; + private java.lang.Object indexName_; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + indexName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIndexNameBytes() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + indexName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ColumnsToGet columns_to_get = 3; + public static final int COLUMNS_TO_GET_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet columnsToGet_; + public boolean hasColumnsToGet() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet getColumnsToGet() { + return columnsToGet_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGetOrBuilder getColumnsToGetOrBuilder() { + return columnsToGet_; + } + + // optional bytes search_query = 4; + public static final int SEARCH_QUERY_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString searchQuery_; + public boolean hasSearchQuery() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getSearchQuery() { + return searchQuery_; + } + + // repeated bytes routing_values = 5; + public static final int ROUTING_VALUES_FIELD_NUMBER = 5; + private java.util.List routingValues_; + public java.util.List + getRoutingValuesList() { + return routingValues_; + } + public int getRoutingValuesCount() { + return routingValues_.size(); + } + public com.google.protobuf.ByteString getRoutingValues(int index) { + return routingValues_.get(index); + } + + private void initFields() { + tableName_ = ""; + indexName_ = ""; + columnsToGet_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDefaultInstance(); + searchQuery_ = com.google.protobuf.ByteString.EMPTY; + routingValues_ = java.util.Collections.emptyList();; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIndexNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, columnsToGet_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, searchQuery_); + } + for (int i = 0; i < routingValues_.size(); i++) { + output.writeBytes(5, routingValues_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIndexNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, columnsToGet_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, searchQuery_); + } + { + int dataSize = 0; + for (int i = 0; i < routingValues_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(routingValues_.get(i)); + } + size += dataSize; + size += 1 * getRoutingValuesList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getColumnsToGetFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + indexName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + if (columnsToGetBuilder_ == null) { + columnsToGet_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDefaultInstance(); + } else { + columnsToGetBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + searchQuery_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + routingValues_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest build() { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest result = new com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.indexName_ = indexName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (columnsToGetBuilder_ == null) { + result.columnsToGet_ = columnsToGet_; + } else { + result.columnsToGet_ = columnsToGetBuilder_.build(); + } + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.searchQuery_ = searchQuery_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + routingValues_ = java.util.Collections.unmodifiableList(routingValues_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.routingValues_ = routingValues_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasIndexName()) { + setIndexName(other.getIndexName()); + } + if (other.hasColumnsToGet()) { + mergeColumnsToGet(other.getColumnsToGet()); + } + if (other.hasSearchQuery()) { + setSearchQuery(other.getSearchQuery()); + } + if (!other.routingValues_.isEmpty()) { + if (routingValues_.isEmpty()) { + routingValues_ = other.routingValues_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureRoutingValuesIsMutable(); + routingValues_.addAll(other.routingValues_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + indexName_ = input.readBytes(); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.newBuilder(); + if (hasColumnsToGet()) { + subBuilder.mergeFrom(getColumnsToGet()); + } + input.readMessage(subBuilder, extensionRegistry); + setColumnsToGet(subBuilder.buildPartial()); + break; + } + case 34: { + bitField0_ |= 0x00000008; + searchQuery_ = input.readBytes(); + break; + } + case 42: { + ensureRoutingValuesIsMutable(); + routingValues_.add(input.readBytes()); + break; + } + } + } + } + + private int bitField0_; + + // optional string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // optional string index_name = 2; + private java.lang.Object indexName_ = ""; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + indexName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIndexName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + return this; + } + public Builder clearIndexName() { + bitField0_ = (bitField0_ & ~0x00000002); + indexName_ = getDefaultInstance().getIndexName(); + onChanged(); + return this; + } + void setIndexName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ColumnsToGet columns_to_get = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet columnsToGet_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet, com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGetOrBuilder> columnsToGetBuilder_; + public boolean hasColumnsToGet() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet getColumnsToGet() { + if (columnsToGetBuilder_ == null) { + return columnsToGet_; + } else { + return columnsToGetBuilder_.getMessage(); + } + } + public Builder setColumnsToGet(com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet value) { + if (columnsToGetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + columnsToGet_ = value; + onChanged(); + } else { + columnsToGetBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setColumnsToGet( + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.Builder builderForValue) { + if (columnsToGetBuilder_ == null) { + columnsToGet_ = builderForValue.build(); + onChanged(); + } else { + columnsToGetBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeColumnsToGet(com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet value) { + if (columnsToGetBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + columnsToGet_ != com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDefaultInstance()) { + columnsToGet_ = + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.newBuilder(columnsToGet_).mergeFrom(value).buildPartial(); + } else { + columnsToGet_ = value; + } + onChanged(); + } else { + columnsToGetBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearColumnsToGet() { + if (columnsToGetBuilder_ == null) { + columnsToGet_ = com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.getDefaultInstance(); + onChanged(); + } else { + columnsToGetBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.Builder getColumnsToGetBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getColumnsToGetFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGetOrBuilder getColumnsToGetOrBuilder() { + if (columnsToGetBuilder_ != null) { + return columnsToGetBuilder_.getMessageOrBuilder(); + } else { + return columnsToGet_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet, com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGetOrBuilder> + getColumnsToGetFieldBuilder() { + if (columnsToGetBuilder_ == null) { + columnsToGetBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet, com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGetOrBuilder>( + columnsToGet_, + getParentForChildren(), + isClean()); + columnsToGet_ = null; + } + return columnsToGetBuilder_; + } + + // optional bytes search_query = 4; + private com.google.protobuf.ByteString searchQuery_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasSearchQuery() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getSearchQuery() { + return searchQuery_; + } + public Builder setSearchQuery(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + searchQuery_ = value; + onChanged(); + return this; + } + public Builder clearSearchQuery() { + bitField0_ = (bitField0_ & ~0x00000008); + searchQuery_ = getDefaultInstance().getSearchQuery(); + onChanged(); + return this; + } + + // repeated bytes routing_values = 5; + private java.util.List routingValues_ = java.util.Collections.emptyList();; + private void ensureRoutingValuesIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + routingValues_ = new java.util.ArrayList(routingValues_); + bitField0_ |= 0x00000010; + } + } + public java.util.List + getRoutingValuesList() { + return java.util.Collections.unmodifiableList(routingValues_); + } + public int getRoutingValuesCount() { + return routingValues_.size(); + } + public com.google.protobuf.ByteString getRoutingValues(int index) { + return routingValues_.get(index); + } + public Builder setRoutingValues( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRoutingValuesIsMutable(); + routingValues_.set(index, value); + onChanged(); + return this; + } + public Builder addRoutingValues(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRoutingValuesIsMutable(); + routingValues_.add(value); + onChanged(); + return this; + } + public Builder addAllRoutingValues( + java.lang.Iterable values) { + ensureRoutingValuesIsMutable(); + super.addAll(values, routingValues_); + onChanged(); + return this; + } + public Builder clearRoutingValues() { + routingValues_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.SearchRequest) + } + + static { + defaultInstance = new SearchRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.SearchRequest) + } + + public interface SearchResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int64 total_hits = 1; + boolean hasTotalHits(); + long getTotalHits(); + + // repeated bytes rows = 2; + java.util.List getRowsList(); + int getRowsCount(); + com.google.protobuf.ByteString getRows(int index); + + // optional bool is_all_succeeded = 3; + boolean hasIsAllSucceeded(); + boolean getIsAllSucceeded(); + + // optional bytes next_token = 6; + boolean hasNextToken(); + com.google.protobuf.ByteString getNextToken(); + } + public static final class SearchResponse extends + com.google.protobuf.GeneratedMessage + implements SearchResponseOrBuilder { + // Use SearchResponse.newBuilder() to construct. + private SearchResponse(Builder builder) { + super(builder); + } + private SearchResponse(boolean noInit) {} + + private static final SearchResponse defaultInstance; + public static SearchResponse getDefaultInstance() { + return defaultInstance; + } + + public SearchResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_fieldAccessorTable; + } + + private int bitField0_; + // optional int64 total_hits = 1; + public static final int TOTAL_HITS_FIELD_NUMBER = 1; + private long totalHits_; + public boolean hasTotalHits() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getTotalHits() { + return totalHits_; + } + + // repeated bytes rows = 2; + public static final int ROWS_FIELD_NUMBER = 2; + private java.util.List rows_; + public java.util.List + getRowsList() { + return rows_; + } + public int getRowsCount() { + return rows_.size(); + } + public com.google.protobuf.ByteString getRows(int index) { + return rows_.get(index); + } + + // optional bool is_all_succeeded = 3; + public static final int IS_ALL_SUCCEEDED_FIELD_NUMBER = 3; + private boolean isAllSucceeded_; + public boolean hasIsAllSucceeded() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public boolean getIsAllSucceeded() { + return isAllSucceeded_; + } + + // optional bytes next_token = 6; + public static final int NEXT_TOKEN_FIELD_NUMBER = 6; + private com.google.protobuf.ByteString nextToken_; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + + private void initFields() { + totalHits_ = 0L; + rows_ = java.util.Collections.emptyList();; + isAllSucceeded_ = false; + nextToken_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, totalHits_); + } + for (int i = 0; i < rows_.size(); i++) { + output.writeBytes(2, rows_.get(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBool(3, isAllSucceeded_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(6, nextToken_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, totalHits_); + } + { + int dataSize = 0; + for (int i = 0; i < rows_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(rows_.get(i)); + } + size += dataSize; + size += 1 * getRowsList().size(); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, isAllSucceeded_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(6, nextToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + totalHits_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + rows_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000002); + isAllSucceeded_ = false; + bitField0_ = (bitField0_ & ~0x00000004); + nextToken_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse build() { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse result = new com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.totalHits_ = totalHits_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = java.util.Collections.unmodifiableList(rows_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.rows_ = rows_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + result.isAllSucceeded_ = isAllSucceeded_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000004; + } + result.nextToken_ = nextToken_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse.getDefaultInstance()) return this; + if (other.hasTotalHits()) { + setTotalHits(other.getTotalHits()); + } + if (!other.rows_.isEmpty()) { + if (rows_.isEmpty()) { + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRowsIsMutable(); + rows_.addAll(other.rows_); + } + onChanged(); + } + if (other.hasIsAllSucceeded()) { + setIsAllSucceeded(other.getIsAllSucceeded()); + } + if (other.hasNextToken()) { + setNextToken(other.getNextToken()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + totalHits_ = input.readInt64(); + break; + } + case 18: { + ensureRowsIsMutable(); + rows_.add(input.readBytes()); + break; + } + case 24: { + bitField0_ |= 0x00000004; + isAllSucceeded_ = input.readBool(); + break; + } + case 50: { + bitField0_ |= 0x00000008; + nextToken_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional int64 total_hits = 1; + private long totalHits_ ; + public boolean hasTotalHits() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getTotalHits() { + return totalHits_; + } + public Builder setTotalHits(long value) { + bitField0_ |= 0x00000001; + totalHits_ = value; + onChanged(); + return this; + } + public Builder clearTotalHits() { + bitField0_ = (bitField0_ & ~0x00000001); + totalHits_ = 0L; + onChanged(); + return this; + } + + // repeated bytes rows = 2; + private java.util.List rows_ = java.util.Collections.emptyList();; + private void ensureRowsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = new java.util.ArrayList(rows_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getRowsList() { + return java.util.Collections.unmodifiableList(rows_); + } + public int getRowsCount() { + return rows_.size(); + } + public com.google.protobuf.ByteString getRows(int index) { + return rows_.get(index); + } + public Builder setRows( + int index, com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.set(index, value); + onChanged(); + return this; + } + public Builder addRows(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(value); + onChanged(); + return this; + } + public Builder addAllRows( + java.lang.Iterable values) { + ensureRowsIsMutable(); + super.addAll(values, rows_); + onChanged(); + return this; + } + public Builder clearRows() { + rows_ = java.util.Collections.emptyList();; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + + // optional bool is_all_succeeded = 3; + private boolean isAllSucceeded_ ; + public boolean hasIsAllSucceeded() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public boolean getIsAllSucceeded() { + return isAllSucceeded_; + } + public Builder setIsAllSucceeded(boolean value) { + bitField0_ |= 0x00000004; + isAllSucceeded_ = value; + onChanged(); + return this; + } + public Builder clearIsAllSucceeded() { + bitField0_ = (bitField0_ & ~0x00000004); + isAllSucceeded_ = false; + onChanged(); + return this; + } + + // optional bytes next_token = 6; + private com.google.protobuf.ByteString nextToken_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getNextToken() { + return nextToken_; + } + public Builder setNextToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + nextToken_ = value; + onChanged(); + return this; + } + public Builder clearNextToken() { + bitField0_ = (bitField0_ & ~0x00000008); + nextToken_ = getDefaultInstance().getNextToken(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.SearchResponse) + } + + static { + defaultInstance = new SearchResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.SearchResponse) + } + + public interface FieldSchemaOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string field_name = 1; + boolean hasFieldName(); + String getFieldName(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldType field_type = 2; + boolean hasFieldType(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldType getFieldType(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexOptions index_options = 3; + boolean hasIndexOptions(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions getIndexOptions(); + + // optional string analyzer = 4; + boolean hasAnalyzer(); + String getAnalyzer(); + + // optional bool index = 5; + boolean hasIndex(); + boolean getIndex(); + + // optional bool doc_values = 6; + boolean hasDocValues(); + boolean getDocValues(); + + // optional bool store = 7; + boolean hasStore(); + boolean getStore(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.FieldSchema field_schemas = 8; + java.util.List + getFieldSchemasList(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema getFieldSchemas(int index); + int getFieldSchemasCount(); + java.util.List + getFieldSchemasOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder getFieldSchemasOrBuilder( + int index); + + // optional bool is_array = 9; + boolean hasIsArray(); + boolean getIsArray(); + } + public static final class FieldSchema extends + com.google.protobuf.GeneratedMessage + implements FieldSchemaOrBuilder { + // Use FieldSchema.newBuilder() to construct. + private FieldSchema(Builder builder) { + super(builder); + } + private FieldSchema(boolean noInit) {} + + private static final FieldSchema defaultInstance; + public static FieldSchema getDefaultInstance() { + return defaultInstance; + } + + public FieldSchema getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_fieldAccessorTable; + } + + private int bitField0_; + // optional string field_name = 1; + public static final int FIELD_NAME_FIELD_NUMBER = 1; + private java.lang.Object fieldName_; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fieldName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFieldNameBytes() { + java.lang.Object ref = fieldName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fieldName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldType field_type = 2; + public static final int FIELD_TYPE_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldType fieldType_; + public boolean hasFieldType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldType getFieldType() { + return fieldType_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexOptions index_options = 3; + public static final int INDEX_OPTIONS_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions indexOptions_; + public boolean hasIndexOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions getIndexOptions() { + return indexOptions_; + } + + // optional string analyzer = 4; + public static final int ANALYZER_FIELD_NUMBER = 4; + private java.lang.Object analyzer_; + public boolean hasAnalyzer() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getAnalyzer() { + java.lang.Object ref = analyzer_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + analyzer_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getAnalyzerBytes() { + java.lang.Object ref = analyzer_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + analyzer_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bool index = 5; + public static final int INDEX_FIELD_NUMBER = 5; + private boolean index_; + public boolean hasIndex() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getIndex() { + return index_; + } + + // optional bool doc_values = 6; + public static final int DOC_VALUES_FIELD_NUMBER = 6; + private boolean docValues_; + public boolean hasDocValues() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public boolean getDocValues() { + return docValues_; + } + + // optional bool store = 7; + public static final int STORE_FIELD_NUMBER = 7; + private boolean store_; + public boolean hasStore() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public boolean getStore() { + return store_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.FieldSchema field_schemas = 8; + public static final int FIELD_SCHEMAS_FIELD_NUMBER = 8; + private java.util.List fieldSchemas_; + public java.util.List getFieldSchemasList() { + return fieldSchemas_; + } + public java.util.List + getFieldSchemasOrBuilderList() { + return fieldSchemas_; + } + public int getFieldSchemasCount() { + return fieldSchemas_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema getFieldSchemas(int index) { + return fieldSchemas_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder getFieldSchemasOrBuilder( + int index) { + return fieldSchemas_.get(index); + } + + // optional bool is_array = 9; + public static final int IS_ARRAY_FIELD_NUMBER = 9; + private boolean isArray_; + public boolean hasIsArray() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public boolean getIsArray() { + return isArray_; + } + + private void initFields() { + fieldName_ = ""; + fieldType_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldType.LONG; + indexOptions_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions.DOCS; + analyzer_ = ""; + index_ = false; + docValues_ = false; + store_ = false; + fieldSchemas_ = java.util.Collections.emptyList(); + isArray_ = false; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeEnum(2, fieldType_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(3, indexOptions_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getAnalyzerBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBool(5, index_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBool(6, docValues_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBool(7, store_); + } + for (int i = 0; i < fieldSchemas_.size(); i++) { + output.writeMessage(8, fieldSchemas_.get(i)); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeBool(9, isArray_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getFieldNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(2, fieldType_.getNumber()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, indexOptions_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getAnalyzerBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, index_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(6, docValues_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(7, store_); + } + for (int i = 0; i < fieldSchemas_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, fieldSchemas_.get(i)); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(9, isArray_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getFieldSchemasFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + fieldName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + fieldType_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldType.LONG; + bitField0_ = (bitField0_ & ~0x00000002); + indexOptions_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions.DOCS; + bitField0_ = (bitField0_ & ~0x00000004); + analyzer_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + index_ = false; + bitField0_ = (bitField0_ & ~0x00000010); + docValues_ = false; + bitField0_ = (bitField0_ & ~0x00000020); + store_ = false; + bitField0_ = (bitField0_ & ~0x00000040); + if (fieldSchemasBuilder_ == null) { + fieldSchemas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + } else { + fieldSchemasBuilder_.clear(); + } + isArray_ = false; + bitField0_ = (bitField0_ & ~0x00000100); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema build() { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema result = new com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.fieldName_ = fieldName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.fieldType_ = fieldType_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.indexOptions_ = indexOptions_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.analyzer_ = analyzer_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.index_ = index_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.docValues_ = docValues_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.store_ = store_; + if (fieldSchemasBuilder_ == null) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { + fieldSchemas_ = java.util.Collections.unmodifiableList(fieldSchemas_); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.fieldSchemas_ = fieldSchemas_; + } else { + result.fieldSchemas_ = fieldSchemasBuilder_.build(); + } + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000080; + } + result.isArray_ = isArray_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.getDefaultInstance()) return this; + if (other.hasFieldName()) { + setFieldName(other.getFieldName()); + } + if (other.hasFieldType()) { + setFieldType(other.getFieldType()); + } + if (other.hasIndexOptions()) { + setIndexOptions(other.getIndexOptions()); + } + if (other.hasAnalyzer()) { + setAnalyzer(other.getAnalyzer()); + } + if (other.hasIndex()) { + setIndex(other.getIndex()); + } + if (other.hasDocValues()) { + setDocValues(other.getDocValues()); + } + if (other.hasStore()) { + setStore(other.getStore()); + } + if (fieldSchemasBuilder_ == null) { + if (!other.fieldSchemas_.isEmpty()) { + if (fieldSchemas_.isEmpty()) { + fieldSchemas_ = other.fieldSchemas_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureFieldSchemasIsMutable(); + fieldSchemas_.addAll(other.fieldSchemas_); + } + onChanged(); + } + } else { + if (!other.fieldSchemas_.isEmpty()) { + if (fieldSchemasBuilder_.isEmpty()) { + fieldSchemasBuilder_.dispose(); + fieldSchemasBuilder_ = null; + fieldSchemas_ = other.fieldSchemas_; + bitField0_ = (bitField0_ & ~0x00000080); + fieldSchemasBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getFieldSchemasFieldBuilder() : null; + } else { + fieldSchemasBuilder_.addAllMessages(other.fieldSchemas_); + } + } + } + if (other.hasIsArray()) { + setIsArray(other.getIsArray()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + fieldName_ = input.readBytes(); + break; + } + case 16: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldType value = com.alicloud.openservices.tablestore.core.protocol.Search.FieldType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + fieldType_ = value; + } + break; + } + case 24: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions value = com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(3, rawValue); + } else { + bitField0_ |= 0x00000004; + indexOptions_ = value; + } + break; + } + case 34: { + bitField0_ |= 0x00000008; + analyzer_ = input.readBytes(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + index_ = input.readBool(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + docValues_ = input.readBool(); + break; + } + case 56: { + bitField0_ |= 0x00000040; + store_ = input.readBool(); + break; + } + case 66: { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addFieldSchemas(subBuilder.buildPartial()); + break; + } + case 72: { + bitField0_ |= 0x00000100; + isArray_ = input.readBool(); + break; + } + } + } + } + + private int bitField0_; + + // optional string field_name = 1; + private java.lang.Object fieldName_ = ""; + public boolean hasFieldName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getFieldName() { + java.lang.Object ref = fieldName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fieldName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFieldName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + return this; + } + public Builder clearFieldName() { + bitField0_ = (bitField0_ & ~0x00000001); + fieldName_ = getDefaultInstance().getFieldName(); + onChanged(); + return this; + } + void setFieldName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + fieldName_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.FieldType field_type = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.FieldType fieldType_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldType.LONG; + public boolean hasFieldType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldType getFieldType() { + return fieldType_; + } + public Builder setFieldType(com.alicloud.openservices.tablestore.core.protocol.Search.FieldType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + fieldType_ = value; + onChanged(); + return this; + } + public Builder clearFieldType() { + bitField0_ = (bitField0_ & ~0x00000002); + fieldType_ = com.alicloud.openservices.tablestore.core.protocol.Search.FieldType.LONG; + onChanged(); + return this; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexOptions index_options = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions indexOptions_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions.DOCS; + public boolean hasIndexOptions() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions getIndexOptions() { + return indexOptions_; + } + public Builder setIndexOptions(com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + indexOptions_ = value; + onChanged(); + return this; + } + public Builder clearIndexOptions() { + bitField0_ = (bitField0_ & ~0x00000004); + indexOptions_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexOptions.DOCS; + onChanged(); + return this; + } + + // optional string analyzer = 4; + private java.lang.Object analyzer_ = ""; + public boolean hasAnalyzer() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getAnalyzer() { + java.lang.Object ref = analyzer_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + analyzer_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setAnalyzer(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + analyzer_ = value; + onChanged(); + return this; + } + public Builder clearAnalyzer() { + bitField0_ = (bitField0_ & ~0x00000008); + analyzer_ = getDefaultInstance().getAnalyzer(); + onChanged(); + return this; + } + void setAnalyzer(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + analyzer_ = value; + onChanged(); + } + + // optional bool index = 5; + private boolean index_ ; + public boolean hasIndex() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getIndex() { + return index_; + } + public Builder setIndex(boolean value) { + bitField0_ |= 0x00000010; + index_ = value; + onChanged(); + return this; + } + public Builder clearIndex() { + bitField0_ = (bitField0_ & ~0x00000010); + index_ = false; + onChanged(); + return this; + } + + // optional bool doc_values = 6; + private boolean docValues_ ; + public boolean hasDocValues() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public boolean getDocValues() { + return docValues_; + } + public Builder setDocValues(boolean value) { + bitField0_ |= 0x00000020; + docValues_ = value; + onChanged(); + return this; + } + public Builder clearDocValues() { + bitField0_ = (bitField0_ & ~0x00000020); + docValues_ = false; + onChanged(); + return this; + } + + // optional bool store = 7; + private boolean store_ ; + public boolean hasStore() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public boolean getStore() { + return store_; + } + public Builder setStore(boolean value) { + bitField0_ |= 0x00000040; + store_ = value; + onChanged(); + return this; + } + public Builder clearStore() { + bitField0_ = (bitField0_ & ~0x00000040); + store_ = false; + onChanged(); + return this; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.FieldSchema field_schemas = 8; + private java.util.List fieldSchemas_ = + java.util.Collections.emptyList(); + private void ensureFieldSchemasIsMutable() { + if (!((bitField0_ & 0x00000080) == 0x00000080)) { + fieldSchemas_ = new java.util.ArrayList(fieldSchemas_); + bitField0_ |= 0x00000080; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder> fieldSchemasBuilder_; + + public java.util.List getFieldSchemasList() { + if (fieldSchemasBuilder_ == null) { + return java.util.Collections.unmodifiableList(fieldSchemas_); + } else { + return fieldSchemasBuilder_.getMessageList(); + } + } + public int getFieldSchemasCount() { + if (fieldSchemasBuilder_ == null) { + return fieldSchemas_.size(); + } else { + return fieldSchemasBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema getFieldSchemas(int index) { + if (fieldSchemasBuilder_ == null) { + return fieldSchemas_.get(index); + } else { + return fieldSchemasBuilder_.getMessage(index); + } + } + public Builder setFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema value) { + if (fieldSchemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFieldSchemasIsMutable(); + fieldSchemas_.set(index, value); + onChanged(); + } else { + fieldSchemasBuilder_.setMessage(index, value); + } + return this; + } + public Builder setFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder builderForValue) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.set(index, builderForValue.build()); + onChanged(); + } else { + fieldSchemasBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addFieldSchemas(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema value) { + if (fieldSchemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(value); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(value); + } + return this; + } + public Builder addFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema value) { + if (fieldSchemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(index, value); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(index, value); + } + return this; + } + public Builder addFieldSchemas( + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder builderForValue) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(builderForValue.build()); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder builderForValue) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(index, builderForValue.build()); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllFieldSchemas( + java.lang.Iterable values) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + super.addAll(values, fieldSchemas_); + onChanged(); + } else { + fieldSchemasBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearFieldSchemas() { + if (fieldSchemasBuilder_ == null) { + fieldSchemas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + } else { + fieldSchemasBuilder_.clear(); + } + return this; + } + public Builder removeFieldSchemas(int index) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.remove(index); + onChanged(); + } else { + fieldSchemasBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder getFieldSchemasBuilder( + int index) { + return getFieldSchemasFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder getFieldSchemasOrBuilder( + int index) { + if (fieldSchemasBuilder_ == null) { + return fieldSchemas_.get(index); } else { + return fieldSchemasBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getFieldSchemasOrBuilderList() { + if (fieldSchemasBuilder_ != null) { + return fieldSchemasBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(fieldSchemas_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder addFieldSchemasBuilder() { + return getFieldSchemasFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder addFieldSchemasBuilder( + int index) { + return getFieldSchemasFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.getDefaultInstance()); + } + public java.util.List + getFieldSchemasBuilderList() { + return getFieldSchemasFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder> + getFieldSchemasFieldBuilder() { + if (fieldSchemasBuilder_ == null) { + fieldSchemasBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder>( + fieldSchemas_, + ((bitField0_ & 0x00000080) == 0x00000080), + getParentForChildren(), + isClean()); + fieldSchemas_ = null; + } + return fieldSchemasBuilder_; + } + + // optional bool is_array = 9; + private boolean isArray_ ; + public boolean hasIsArray() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public boolean getIsArray() { + return isArray_; + } + public Builder setIsArray(boolean value) { + bitField0_ |= 0x00000100; + isArray_ = value; + onChanged(); + return this; + } + public Builder clearIsArray() { + bitField0_ = (bitField0_ & ~0x00000100); + isArray_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.FieldSchema) + } + + static { + defaultInstance = new FieldSchema(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.FieldSchema) + } + + public interface IndexSchemaOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.FieldSchema field_schemas = 1; + java.util.List + getFieldSchemasList(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema getFieldSchemas(int index); + int getFieldSchemasCount(); + java.util.List + getFieldSchemasOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder getFieldSchemasOrBuilder( + int index); + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSetting index_setting = 2; + boolean hasIndexSetting(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting getIndexSetting(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSettingOrBuilder getIndexSettingOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.Sort index_sort = 3; + boolean hasIndexSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.Sort getIndexSort(); + com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder getIndexSortOrBuilder(); + } + public static final class IndexSchema extends + com.google.protobuf.GeneratedMessage + implements IndexSchemaOrBuilder { + // Use IndexSchema.newBuilder() to construct. + private IndexSchema(Builder builder) { + super(builder); + } + private IndexSchema(boolean noInit) {} + + private static final IndexSchema defaultInstance; + public static IndexSchema getDefaultInstance() { + return defaultInstance; + } + + public IndexSchema getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_fieldAccessorTable; + } + + private int bitField0_; + // repeated .com.alicloud.openservices.tablestore.core.protocol.FieldSchema field_schemas = 1; + public static final int FIELD_SCHEMAS_FIELD_NUMBER = 1; + private java.util.List fieldSchemas_; + public java.util.List getFieldSchemasList() { + return fieldSchemas_; + } + public java.util.List + getFieldSchemasOrBuilderList() { + return fieldSchemas_; + } + public int getFieldSchemasCount() { + return fieldSchemas_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema getFieldSchemas(int index) { + return fieldSchemas_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder getFieldSchemasOrBuilder( + int index) { + return fieldSchemas_.get(index); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSetting index_setting = 2; + public static final int INDEX_SETTING_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting indexSetting_; + public boolean hasIndexSetting() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting getIndexSetting() { + return indexSetting_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSettingOrBuilder getIndexSettingOrBuilder() { + return indexSetting_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Sort index_sort = 3; + public static final int INDEX_SORT_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.Sort indexSort_; + public boolean hasIndexSort() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort getIndexSort() { + return indexSort_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder getIndexSortOrBuilder() { + return indexSort_; + } + + private void initFields() { + fieldSchemas_ = java.util.Collections.emptyList(); + indexSetting_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDefaultInstance(); + indexSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < fieldSchemas_.size(); i++) { + output.writeMessage(1, fieldSchemas_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(2, indexSetting_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(3, indexSort_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < fieldSchemas_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, fieldSchemas_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, indexSetting_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, indexSort_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getFieldSchemasFieldBuilder(); + getIndexSettingFieldBuilder(); + getIndexSortFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (fieldSchemasBuilder_ == null) { + fieldSchemas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + fieldSchemasBuilder_.clear(); + } + if (indexSettingBuilder_ == null) { + indexSetting_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDefaultInstance(); + } else { + indexSettingBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (indexSortBuilder_ == null) { + indexSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + } else { + indexSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema build() { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema result = new com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (fieldSchemasBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + fieldSchemas_ = java.util.Collections.unmodifiableList(fieldSchemas_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.fieldSchemas_ = fieldSchemas_; + } else { + result.fieldSchemas_ = fieldSchemasBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000001; + } + if (indexSettingBuilder_ == null) { + result.indexSetting_ = indexSetting_; + } else { + result.indexSetting_ = indexSettingBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + if (indexSortBuilder_ == null) { + result.indexSort_ = indexSort_; + } else { + result.indexSort_ = indexSortBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance()) return this; + if (fieldSchemasBuilder_ == null) { + if (!other.fieldSchemas_.isEmpty()) { + if (fieldSchemas_.isEmpty()) { + fieldSchemas_ = other.fieldSchemas_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureFieldSchemasIsMutable(); + fieldSchemas_.addAll(other.fieldSchemas_); + } + onChanged(); + } + } else { + if (!other.fieldSchemas_.isEmpty()) { + if (fieldSchemasBuilder_.isEmpty()) { + fieldSchemasBuilder_.dispose(); + fieldSchemasBuilder_ = null; + fieldSchemas_ = other.fieldSchemas_; + bitField0_ = (bitField0_ & ~0x00000001); + fieldSchemasBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getFieldSchemasFieldBuilder() : null; + } else { + fieldSchemasBuilder_.addAllMessages(other.fieldSchemas_); + } + } + } + if (other.hasIndexSetting()) { + mergeIndexSetting(other.getIndexSetting()); + } + if (other.hasIndexSort()) { + mergeIndexSort(other.getIndexSort()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addFieldSchemas(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.newBuilder(); + if (hasIndexSetting()) { + subBuilder.mergeFrom(getIndexSetting()); + } + input.readMessage(subBuilder, extensionRegistry); + setIndexSetting(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.newBuilder(); + if (hasIndexSort()) { + subBuilder.mergeFrom(getIndexSort()); + } + input.readMessage(subBuilder, extensionRegistry); + setIndexSort(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.FieldSchema field_schemas = 1; + private java.util.List fieldSchemas_ = + java.util.Collections.emptyList(); + private void ensureFieldSchemasIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + fieldSchemas_ = new java.util.ArrayList(fieldSchemas_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder> fieldSchemasBuilder_; + + public java.util.List getFieldSchemasList() { + if (fieldSchemasBuilder_ == null) { + return java.util.Collections.unmodifiableList(fieldSchemas_); + } else { + return fieldSchemasBuilder_.getMessageList(); + } + } + public int getFieldSchemasCount() { + if (fieldSchemasBuilder_ == null) { + return fieldSchemas_.size(); + } else { + return fieldSchemasBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema getFieldSchemas(int index) { + if (fieldSchemasBuilder_ == null) { + return fieldSchemas_.get(index); + } else { + return fieldSchemasBuilder_.getMessage(index); + } + } + public Builder setFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema value) { + if (fieldSchemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFieldSchemasIsMutable(); + fieldSchemas_.set(index, value); + onChanged(); + } else { + fieldSchemasBuilder_.setMessage(index, value); + } + return this; + } + public Builder setFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder builderForValue) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.set(index, builderForValue.build()); + onChanged(); + } else { + fieldSchemasBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addFieldSchemas(com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema value) { + if (fieldSchemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(value); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(value); + } + return this; + } + public Builder addFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema value) { + if (fieldSchemasBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(index, value); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(index, value); + } + return this; + } + public Builder addFieldSchemas( + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder builderForValue) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(builderForValue.build()); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addFieldSchemas( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder builderForValue) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.add(index, builderForValue.build()); + onChanged(); + } else { + fieldSchemasBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllFieldSchemas( + java.lang.Iterable values) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + super.addAll(values, fieldSchemas_); + onChanged(); + } else { + fieldSchemasBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearFieldSchemas() { + if (fieldSchemasBuilder_ == null) { + fieldSchemas_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + fieldSchemasBuilder_.clear(); + } + return this; + } + public Builder removeFieldSchemas(int index) { + if (fieldSchemasBuilder_ == null) { + ensureFieldSchemasIsMutable(); + fieldSchemas_.remove(index); + onChanged(); + } else { + fieldSchemasBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder getFieldSchemasBuilder( + int index) { + return getFieldSchemasFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder getFieldSchemasOrBuilder( + int index) { + if (fieldSchemasBuilder_ == null) { + return fieldSchemas_.get(index); } else { + return fieldSchemasBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getFieldSchemasOrBuilderList() { + if (fieldSchemasBuilder_ != null) { + return fieldSchemasBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(fieldSchemas_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder addFieldSchemasBuilder() { + return getFieldSchemasFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder addFieldSchemasBuilder( + int index) { + return getFieldSchemasFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.getDefaultInstance()); + } + public java.util.List + getFieldSchemasBuilderList() { + return getFieldSchemasFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder> + getFieldSchemasFieldBuilder() { + if (fieldSchemasBuilder_ == null) { + fieldSchemasBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchemaOrBuilder>( + fieldSchemas_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + fieldSchemas_ = null; + } + return fieldSchemasBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSetting index_setting = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting indexSetting_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSettingOrBuilder> indexSettingBuilder_; + public boolean hasIndexSetting() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting getIndexSetting() { + if (indexSettingBuilder_ == null) { + return indexSetting_; + } else { + return indexSettingBuilder_.getMessage(); + } + } + public Builder setIndexSetting(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting value) { + if (indexSettingBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + indexSetting_ = value; + onChanged(); + } else { + indexSettingBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setIndexSetting( + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.Builder builderForValue) { + if (indexSettingBuilder_ == null) { + indexSetting_ = builderForValue.build(); + onChanged(); + } else { + indexSettingBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeIndexSetting(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting value) { + if (indexSettingBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + indexSetting_ != com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDefaultInstance()) { + indexSetting_ = + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.newBuilder(indexSetting_).mergeFrom(value).buildPartial(); + } else { + indexSetting_ = value; + } + onChanged(); + } else { + indexSettingBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearIndexSetting() { + if (indexSettingBuilder_ == null) { + indexSetting_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDefaultInstance(); + onChanged(); + } else { + indexSettingBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.Builder getIndexSettingBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getIndexSettingFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSettingOrBuilder getIndexSettingOrBuilder() { + if (indexSettingBuilder_ != null) { + return indexSettingBuilder_.getMessageOrBuilder(); + } else { + return indexSetting_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSettingOrBuilder> + getIndexSettingFieldBuilder() { + if (indexSettingBuilder_ == null) { + indexSettingBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSettingOrBuilder>( + indexSetting_, + getParentForChildren(), + isClean()); + indexSetting_ = null; + } + return indexSettingBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.Sort index_sort = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.Sort indexSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sort, com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder> indexSortBuilder_; + public boolean hasIndexSort() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort getIndexSort() { + if (indexSortBuilder_ == null) { + return indexSort_; + } else { + return indexSortBuilder_.getMessage(); + } + } + public Builder setIndexSort(com.alicloud.openservices.tablestore.core.protocol.Search.Sort value) { + if (indexSortBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + indexSort_ = value; + onChanged(); + } else { + indexSortBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setIndexSort( + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder builderForValue) { + if (indexSortBuilder_ == null) { + indexSort_ = builderForValue.build(); + onChanged(); + } else { + indexSortBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeIndexSort(com.alicloud.openservices.tablestore.core.protocol.Search.Sort value) { + if (indexSortBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + indexSort_ != com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance()) { + indexSort_ = + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.newBuilder(indexSort_).mergeFrom(value).buildPartial(); + } else { + indexSort_ = value; + } + onChanged(); + } else { + indexSortBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearIndexSort() { + if (indexSortBuilder_ == null) { + indexSort_ = com.alicloud.openservices.tablestore.core.protocol.Search.Sort.getDefaultInstance(); + onChanged(); + } else { + indexSortBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder getIndexSortBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getIndexSortFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder getIndexSortOrBuilder() { + if (indexSortBuilder_ != null) { + return indexSortBuilder_.getMessageOrBuilder(); + } else { + return indexSort_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sort, com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder> + getIndexSortFieldBuilder() { + if (indexSortBuilder_ == null) { + indexSortBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.Sort, com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SortOrBuilder>( + indexSort_, + getParentForChildren(), + isClean()); + indexSort_ = null; + } + return indexSortBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.IndexSchema) + } + + static { + defaultInstance = new IndexSchema(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.IndexSchema) + } + + public interface IndexSettingOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int32 number_of_shards = 1; + boolean hasNumberOfShards(); + int getNumberOfShards(); + + // repeated string routing_fields = 2; + java.util.List getRoutingFieldsList(); + int getRoutingFieldsCount(); + String getRoutingFields(int index); + + // optional int32 routing_partition_size = 3; + boolean hasRoutingPartitionSize(); + int getRoutingPartitionSize(); + } + public static final class IndexSetting extends + com.google.protobuf.GeneratedMessage + implements IndexSettingOrBuilder { + // Use IndexSetting.newBuilder() to construct. + private IndexSetting(Builder builder) { + super(builder); + } + private IndexSetting(boolean noInit) {} + + private static final IndexSetting defaultInstance; + public static IndexSetting getDefaultInstance() { + return defaultInstance; + } + + public IndexSetting getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_fieldAccessorTable; + } + + private int bitField0_; + // optional int32 number_of_shards = 1; + public static final int NUMBER_OF_SHARDS_FIELD_NUMBER = 1; + private int numberOfShards_; + public boolean hasNumberOfShards() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getNumberOfShards() { + return numberOfShards_; + } + + // repeated string routing_fields = 2; + public static final int ROUTING_FIELDS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList routingFields_; + public java.util.List + getRoutingFieldsList() { + return routingFields_; + } + public int getRoutingFieldsCount() { + return routingFields_.size(); + } + public String getRoutingFields(int index) { + return routingFields_.get(index); + } + + // optional int32 routing_partition_size = 3; + public static final int ROUTING_PARTITION_SIZE_FIELD_NUMBER = 3; + private int routingPartitionSize_; + public boolean hasRoutingPartitionSize() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public int getRoutingPartitionSize() { + return routingPartitionSize_; + } + + private void initFields() { + numberOfShards_ = 0; + routingFields_ = com.google.protobuf.LazyStringArrayList.EMPTY; + routingPartitionSize_ = 0; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(1, numberOfShards_); + } + for (int i = 0; i < routingFields_.size(); i++) { + output.writeBytes(2, routingFields_.getByteString(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt32(3, routingPartitionSize_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, numberOfShards_); + } + { + int dataSize = 0; + for (int i = 0; i < routingFields_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeBytesSizeNoTag(routingFields_.getByteString(i)); + } + size += dataSize; + size += 1 * getRoutingFieldsList().size(); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, routingPartitionSize_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.IndexSettingOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + numberOfShards_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + routingFields_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + routingPartitionSize_ = 0; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting build() { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting result = new com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.numberOfShards_ = numberOfShards_; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + routingFields_ = new com.google.protobuf.UnmodifiableLazyStringList( + routingFields_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.routingFields_ = routingFields_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + result.routingPartitionSize_ = routingPartitionSize_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.getDefaultInstance()) return this; + if (other.hasNumberOfShards()) { + setNumberOfShards(other.getNumberOfShards()); + } + if (!other.routingFields_.isEmpty()) { + if (routingFields_.isEmpty()) { + routingFields_ = other.routingFields_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRoutingFieldsIsMutable(); + routingFields_.addAll(other.routingFields_); + } + onChanged(); + } + if (other.hasRoutingPartitionSize()) { + setRoutingPartitionSize(other.getRoutingPartitionSize()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + numberOfShards_ = input.readInt32(); + break; + } + case 18: { + ensureRoutingFieldsIsMutable(); + routingFields_.add(input.readBytes()); + break; + } + case 24: { + bitField0_ |= 0x00000004; + routingPartitionSize_ = input.readInt32(); + break; + } + } + } + } + + private int bitField0_; + + // optional int32 number_of_shards = 1; + private int numberOfShards_ ; + public boolean hasNumberOfShards() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getNumberOfShards() { + return numberOfShards_; + } + public Builder setNumberOfShards(int value) { + bitField0_ |= 0x00000001; + numberOfShards_ = value; + onChanged(); + return this; + } + public Builder clearNumberOfShards() { + bitField0_ = (bitField0_ & ~0x00000001); + numberOfShards_ = 0; + onChanged(); + return this; + } + + // repeated string routing_fields = 2; + private com.google.protobuf.LazyStringList routingFields_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureRoutingFieldsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + routingFields_ = new com.google.protobuf.LazyStringArrayList(routingFields_); + bitField0_ |= 0x00000002; + } + } + public java.util.List + getRoutingFieldsList() { + return java.util.Collections.unmodifiableList(routingFields_); + } + public int getRoutingFieldsCount() { + return routingFields_.size(); + } + public String getRoutingFields(int index) { + return routingFields_.get(index); + } + public Builder setRoutingFields( + int index, String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRoutingFieldsIsMutable(); + routingFields_.set(index, value); + onChanged(); + return this; + } + public Builder addRoutingFields(String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureRoutingFieldsIsMutable(); + routingFields_.add(value); + onChanged(); + return this; + } + public Builder addAllRoutingFields( + java.lang.Iterable values) { + ensureRoutingFieldsIsMutable(); + super.addAll(values, routingFields_); + onChanged(); + return this; + } + public Builder clearRoutingFields() { + routingFields_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + void addRoutingFields(com.google.protobuf.ByteString value) { + ensureRoutingFieldsIsMutable(); + routingFields_.add(value); + onChanged(); + } + + // optional int32 routing_partition_size = 3; + private int routingPartitionSize_ ; + public boolean hasRoutingPartitionSize() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getRoutingPartitionSize() { + return routingPartitionSize_; + } + public Builder setRoutingPartitionSize(int value) { + bitField0_ |= 0x00000004; + routingPartitionSize_ = value; + onChanged(); + return this; + } + public Builder clearRoutingPartitionSize() { + bitField0_ = (bitField0_ & ~0x00000004); + routingPartitionSize_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.IndexSetting) + } + + static { + defaultInstance = new IndexSetting(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.IndexSetting) + } + + public interface CreateSearchIndexRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required string index_name = 2; + boolean hasIndexName(); + String getIndexName(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSchema schema = 3; + boolean hasSchema(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema getSchema(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder getSchemaOrBuilder(); + } + public static final class CreateSearchIndexRequest extends + com.google.protobuf.GeneratedMessage + implements CreateSearchIndexRequestOrBuilder { + // Use CreateSearchIndexRequest.newBuilder() to construct. + private CreateSearchIndexRequest(Builder builder) { + super(builder); + } + private CreateSearchIndexRequest(boolean noInit) {} + + private static final CreateSearchIndexRequest defaultInstance; + public static CreateSearchIndexRequest getDefaultInstance() { + return defaultInstance; + } + + public CreateSearchIndexRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string index_name = 2; + public static final int INDEX_NAME_FIELD_NUMBER = 2; + private java.lang.Object indexName_; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + indexName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIndexNameBytes() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + indexName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSchema schema = 3; + public static final int SCHEMA_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema schema_; + public boolean hasSchema() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema getSchema() { + return schema_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder getSchemaOrBuilder() { + return schema_; + } + + private void initFields() { + tableName_ = ""; + indexName_ = ""; + schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasIndexName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIndexNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, schema_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIndexNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, schema_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getSchemaFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + indexName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + if (schemaBuilder_ == null) { + schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + } else { + schemaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest build() { + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest result = new com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.indexName_ = indexName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (schemaBuilder_ == null) { + result.schema_ = schema_; + } else { + result.schema_ = schemaBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasIndexName()) { + setIndexName(other.getIndexName()); + } + if (other.hasSchema()) { + mergeSchema(other.getSchema()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasIndexName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + indexName_ = input.readBytes(); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.newBuilder(); + if (hasSchema()) { + subBuilder.mergeFrom(getSchema()); + } + input.readMessage(subBuilder, extensionRegistry); + setSchema(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required string index_name = 2; + private java.lang.Object indexName_ = ""; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + indexName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIndexName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + return this; + } + public Builder clearIndexName() { + bitField0_ = (bitField0_ & ~0x00000002); + indexName_ = getDefaultInstance().getIndexName(); + onChanged(); + return this; + } + void setIndexName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSchema schema = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder> schemaBuilder_; + public boolean hasSchema() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema getSchema() { + if (schemaBuilder_ == null) { + return schema_; + } else { + return schemaBuilder_.getMessage(); + } + } + public Builder setSchema(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema value) { + if (schemaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + schema_ = value; + onChanged(); + } else { + schemaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setSchema( + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder builderForValue) { + if (schemaBuilder_ == null) { + schema_ = builderForValue.build(); + onChanged(); + } else { + schemaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeSchema(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema value) { + if (schemaBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + schema_ != com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance()) { + schema_ = + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.newBuilder(schema_).mergeFrom(value).buildPartial(); + } else { + schema_ = value; + } + onChanged(); + } else { + schemaBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearSchema() { + if (schemaBuilder_ == null) { + schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + onChanged(); + } else { + schemaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder getSchemaBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getSchemaFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder getSchemaOrBuilder() { + if (schemaBuilder_ != null) { + return schemaBuilder_.getMessageOrBuilder(); + } else { + return schema_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder> + getSchemaFieldBuilder() { + if (schemaBuilder_ == null) { + schemaBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder>( + schema_, + getParentForChildren(), + isClean()); + schema_ = null; + } + return schemaBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateSearchIndexRequest) + } + + static { + defaultInstance = new CreateSearchIndexRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateSearchIndexRequest) + } + + public interface CreateSearchIndexResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class CreateSearchIndexResponse extends + com.google.protobuf.GeneratedMessage + implements CreateSearchIndexResponseOrBuilder { + // Use CreateSearchIndexResponse.newBuilder() to construct. + private CreateSearchIndexResponse(Builder builder) { + super(builder); + } + private CreateSearchIndexResponse(boolean noInit) {} + + private static final CreateSearchIndexResponse defaultInstance; + public static CreateSearchIndexResponse getDefaultInstance() { + return defaultInstance; + } + + public CreateSearchIndexResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse build() { + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse result = new com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateSearchIndexResponse) + } + + static { + defaultInstance = new CreateSearchIndexResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateSearchIndexResponse) + } + + public interface IndexInfoOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // optional string index_name = 2; + boolean hasIndexName(); + String getIndexName(); + } + public static final class IndexInfo extends + com.google.protobuf.GeneratedMessage + implements IndexInfoOrBuilder { + // Use IndexInfo.newBuilder() to construct. + private IndexInfo(Builder builder) { + super(builder); + } + private IndexInfo(boolean noInit) {} + + private static final IndexInfo defaultInstance; + public static IndexInfo getDefaultInstance() { + return defaultInstance; + } + + public IndexInfo getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_fieldAccessorTable; + } + + private int bitField0_; + // optional string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string index_name = 2; + public static final int INDEX_NAME_FIELD_NUMBER = 2; + private java.lang.Object indexName_; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + indexName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIndexNameBytes() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + indexName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + indexName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIndexNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIndexNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + indexName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo build() { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo result = new com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.indexName_ = indexName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasIndexName()) { + setIndexName(other.getIndexName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + indexName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // optional string index_name = 2; + private java.lang.Object indexName_ = ""; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + indexName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIndexName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + return this; + } + public Builder clearIndexName() { + bitField0_ = (bitField0_ & ~0x00000002); + indexName_ = getDefaultInstance().getIndexName(); + onChanged(); + return this; + } + void setIndexName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.IndexInfo) + } + + static { + defaultInstance = new IndexInfo(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.IndexInfo) + } + + public interface ListSearchIndexRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string table_name = 1; + boolean hasTableName(); + String getTableName(); + } + public static final class ListSearchIndexRequest extends + com.google.protobuf.GeneratedMessage + implements ListSearchIndexRequestOrBuilder { + // Use ListSearchIndexRequest.newBuilder() to construct. + private ListSearchIndexRequest(Builder builder) { + super(builder); + } + private ListSearchIndexRequest(boolean noInit) {} + + private static final ListSearchIndexRequest defaultInstance; + public static ListSearchIndexRequest getDefaultInstance() { + return defaultInstance; + } + + public ListSearchIndexRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_fieldAccessorTable; + } + + private int bitField0_; + // optional string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest build() { + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest result = new com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListSearchIndexRequest) + } + + static { + defaultInstance = new ListSearchIndexRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListSearchIndexRequest) + } + + public interface ListSearchIndexResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexInfo indices = 1; + java.util.List + getIndicesList(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo getIndices(int index); + int getIndicesCount(); + java.util.List + getIndicesOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfoOrBuilder getIndicesOrBuilder( + int index); + } + public static final class ListSearchIndexResponse extends + com.google.protobuf.GeneratedMessage + implements ListSearchIndexResponseOrBuilder { + // Use ListSearchIndexResponse.newBuilder() to construct. + private ListSearchIndexResponse(Builder builder) { + super(builder); + } + private ListSearchIndexResponse(boolean noInit) {} + + private static final ListSearchIndexResponse defaultInstance; + public static ListSearchIndexResponse getDefaultInstance() { + return defaultInstance; + } + + public ListSearchIndexResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexInfo indices = 1; + public static final int INDICES_FIELD_NUMBER = 1; + private java.util.List indices_; + public java.util.List getIndicesList() { + return indices_; + } + public java.util.List + getIndicesOrBuilderList() { + return indices_; + } + public int getIndicesCount() { + return indices_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo getIndices(int index) { + return indices_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfoOrBuilder getIndicesOrBuilder( + int index) { + return indices_.get(index); + } + + private void initFields() { + indices_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < indices_.size(); i++) { + output.writeMessage(1, indices_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < indices_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, indices_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getIndicesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (indicesBuilder_ == null) { + indices_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + indicesBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse build() { + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse result = new com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse(this); + int from_bitField0_ = bitField0_; + if (indicesBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + indices_ = java.util.Collections.unmodifiableList(indices_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.indices_ = indices_; + } else { + result.indices_ = indicesBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse.getDefaultInstance()) return this; + if (indicesBuilder_ == null) { + if (!other.indices_.isEmpty()) { + if (indices_.isEmpty()) { + indices_ = other.indices_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureIndicesIsMutable(); + indices_.addAll(other.indices_); + } + onChanged(); + } + } else { + if (!other.indices_.isEmpty()) { + if (indicesBuilder_.isEmpty()) { + indicesBuilder_.dispose(); + indicesBuilder_ = null; + indices_ = other.indices_; + bitField0_ = (bitField0_ & ~0x00000001); + indicesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getIndicesFieldBuilder() : null; + } else { + indicesBuilder_.addAllMessages(other.indices_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addIndices(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.IndexInfo indices = 1; + private java.util.List indices_ = + java.util.Collections.emptyList(); + private void ensureIndicesIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + indices_ = new java.util.ArrayList(indices_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfoOrBuilder> indicesBuilder_; + + public java.util.List getIndicesList() { + if (indicesBuilder_ == null) { + return java.util.Collections.unmodifiableList(indices_); + } else { + return indicesBuilder_.getMessageList(); + } + } + public int getIndicesCount() { + if (indicesBuilder_ == null) { + return indices_.size(); + } else { + return indicesBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo getIndices(int index) { + if (indicesBuilder_ == null) { + return indices_.get(index); + } else { + return indicesBuilder_.getMessage(index); + } + } + public Builder setIndices( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo value) { + if (indicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndicesIsMutable(); + indices_.set(index, value); + onChanged(); + } else { + indicesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setIndices( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder builderForValue) { + if (indicesBuilder_ == null) { + ensureIndicesIsMutable(); + indices_.set(index, builderForValue.build()); + onChanged(); + } else { + indicesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addIndices(com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo value) { + if (indicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndicesIsMutable(); + indices_.add(value); + onChanged(); + } else { + indicesBuilder_.addMessage(value); + } + return this; + } + public Builder addIndices( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo value) { + if (indicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndicesIsMutable(); + indices_.add(index, value); + onChanged(); + } else { + indicesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addIndices( + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder builderForValue) { + if (indicesBuilder_ == null) { + ensureIndicesIsMutable(); + indices_.add(builderForValue.build()); + onChanged(); + } else { + indicesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addIndices( + int index, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder builderForValue) { + if (indicesBuilder_ == null) { + ensureIndicesIsMutable(); + indices_.add(index, builderForValue.build()); + onChanged(); + } else { + indicesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllIndices( + java.lang.Iterable values) { + if (indicesBuilder_ == null) { + ensureIndicesIsMutable(); + super.addAll(values, indices_); + onChanged(); + } else { + indicesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearIndices() { + if (indicesBuilder_ == null) { + indices_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + indicesBuilder_.clear(); + } + return this; + } + public Builder removeIndices(int index) { + if (indicesBuilder_ == null) { + ensureIndicesIsMutable(); + indices_.remove(index); + onChanged(); + } else { + indicesBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder getIndicesBuilder( + int index) { + return getIndicesFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfoOrBuilder getIndicesOrBuilder( + int index) { + if (indicesBuilder_ == null) { + return indices_.get(index); } else { + return indicesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getIndicesOrBuilderList() { + if (indicesBuilder_ != null) { + return indicesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(indices_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder addIndicesBuilder() { + return getIndicesFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder addIndicesBuilder( + int index) { + return getIndicesFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.getDefaultInstance()); + } + public java.util.List + getIndicesBuilderList() { + return getIndicesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfoOrBuilder> + getIndicesFieldBuilder() { + if (indicesBuilder_ == null) { + indicesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfoOrBuilder>( + indices_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + indices_ = null; + } + return indicesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListSearchIndexResponse) + } + + static { + defaultInstance = new ListSearchIndexResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListSearchIndexResponse) + } + + public interface DeleteSearchIndexRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // optional string index_name = 2; + boolean hasIndexName(); + String getIndexName(); + } + public static final class DeleteSearchIndexRequest extends + com.google.protobuf.GeneratedMessage + implements DeleteSearchIndexRequestOrBuilder { + // Use DeleteSearchIndexRequest.newBuilder() to construct. + private DeleteSearchIndexRequest(Builder builder) { + super(builder); + } + private DeleteSearchIndexRequest(boolean noInit) {} + + private static final DeleteSearchIndexRequest defaultInstance; + public static DeleteSearchIndexRequest getDefaultInstance() { + return defaultInstance; + } + + public DeleteSearchIndexRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_fieldAccessorTable; + } + + private int bitField0_; + // optional string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string index_name = 2; + public static final int INDEX_NAME_FIELD_NUMBER = 2; + private java.lang.Object indexName_; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + indexName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIndexNameBytes() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + indexName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + indexName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIndexNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIndexNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + indexName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest build() { + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest result = new com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.indexName_ = indexName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasIndexName()) { + setIndexName(other.getIndexName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + indexName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // optional string index_name = 2; + private java.lang.Object indexName_ = ""; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + indexName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIndexName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + return this; + } + public Builder clearIndexName() { + bitField0_ = (bitField0_ & ~0x00000002); + indexName_ = getDefaultInstance().getIndexName(); + onChanged(); + return this; + } + void setIndexName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteSearchIndexRequest) + } + + static { + defaultInstance = new DeleteSearchIndexRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteSearchIndexRequest) + } + + public interface DeleteSearchIndexResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class DeleteSearchIndexResponse extends + com.google.protobuf.GeneratedMessage + implements DeleteSearchIndexResponseOrBuilder { + // Use DeleteSearchIndexResponse.newBuilder() to construct. + private DeleteSearchIndexResponse(Builder builder) { + super(builder); + } + private DeleteSearchIndexResponse(boolean noInit) {} + + private static final DeleteSearchIndexResponse defaultInstance; + public static DeleteSearchIndexResponse getDefaultInstance() { + return defaultInstance; + } + + public DeleteSearchIndexResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse build() { + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse result = new com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteSearchIndexResponse) + } + + static { + defaultInstance = new DeleteSearchIndexResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteSearchIndexResponse) + } + + public interface SyncStatOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.SyncPhase sync_phase = 1; + boolean hasSyncPhase(); + com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase getSyncPhase(); + + // optional int64 current_sync_timestamp = 2; + boolean hasCurrentSyncTimestamp(); + long getCurrentSyncTimestamp(); + } + public static final class SyncStat extends + com.google.protobuf.GeneratedMessage + implements SyncStatOrBuilder { + // Use SyncStat.newBuilder() to construct. + private SyncStat(Builder builder) { + super(builder); + } + private SyncStat(boolean noInit) {} + + private static final SyncStat defaultInstance; + public static SyncStat getDefaultInstance() { + return defaultInstance; + } + + public SyncStat getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.SyncPhase sync_phase = 1; + public static final int SYNC_PHASE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase syncPhase_; + public boolean hasSyncPhase() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase getSyncPhase() { + return syncPhase_; + } + + // optional int64 current_sync_timestamp = 2; + public static final int CURRENT_SYNC_TIMESTAMP_FIELD_NUMBER = 2; + private long currentSyncTimestamp_; + public boolean hasCurrentSyncTimestamp() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getCurrentSyncTimestamp() { + return currentSyncTimestamp_; + } + + private void initFields() { + syncPhase_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase.FULL; + currentSyncTimestamp_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, syncPhase_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, currentSyncTimestamp_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, syncPhase_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, currentSyncTimestamp_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.SyncStatOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + syncPhase_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase.FULL; + bitField0_ = (bitField0_ & ~0x00000001); + currentSyncTimestamp_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat build() { + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat result = new com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.syncPhase_ = syncPhase_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.currentSyncTimestamp_ = currentSyncTimestamp_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDefaultInstance()) return this; + if (other.hasSyncPhase()) { + setSyncPhase(other.getSyncPhase()); + } + if (other.hasCurrentSyncTimestamp()) { + setCurrentSyncTimestamp(other.getCurrentSyncTimestamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase value = com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + syncPhase_ = value; + } + break; + } + case 16: { + bitField0_ |= 0x00000002; + currentSyncTimestamp_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.SyncPhase sync_phase = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase syncPhase_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase.FULL; + public boolean hasSyncPhase() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase getSyncPhase() { + return syncPhase_; + } + public Builder setSyncPhase(com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + syncPhase_ = value; + onChanged(); + return this; + } + public Builder clearSyncPhase() { + bitField0_ = (bitField0_ & ~0x00000001); + syncPhase_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncPhase.FULL; + onChanged(); + return this; + } + + // optional int64 current_sync_timestamp = 2; + private long currentSyncTimestamp_ ; + public boolean hasCurrentSyncTimestamp() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getCurrentSyncTimestamp() { + return currentSyncTimestamp_; + } + public Builder setCurrentSyncTimestamp(long value) { + bitField0_ |= 0x00000002; + currentSyncTimestamp_ = value; + onChanged(); + return this; + } + public Builder clearCurrentSyncTimestamp() { + bitField0_ = (bitField0_ & ~0x00000002); + currentSyncTimestamp_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.SyncStat) + } + + static { + defaultInstance = new SyncStat(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.SyncStat) + } + + public interface MeteringInfoOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int64 storage_size = 1; + boolean hasStorageSize(); + long getStorageSize(); + + // optional int64 doc_count = 2; + boolean hasDocCount(); + long getDocCount(); + + // optional int64 reserved_read_cu = 3; + boolean hasReservedReadCu(); + long getReservedReadCu(); + + // optional int64 timestamp = 4; + boolean hasTimestamp(); + long getTimestamp(); + } + public static final class MeteringInfo extends + com.google.protobuf.GeneratedMessage + implements MeteringInfoOrBuilder { + // Use MeteringInfo.newBuilder() to construct. + private MeteringInfo(Builder builder) { + super(builder); + } + private MeteringInfo(boolean noInit) {} + + private static final MeteringInfo defaultInstance; + public static MeteringInfo getDefaultInstance() { + return defaultInstance; + } + + public MeteringInfo getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_fieldAccessorTable; + } + + private int bitField0_; + // optional int64 storage_size = 1; + public static final int STORAGE_SIZE_FIELD_NUMBER = 1; + private long storageSize_; + public boolean hasStorageSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getStorageSize() { + return storageSize_; + } + + // optional int64 doc_count = 2; + public static final int DOC_COUNT_FIELD_NUMBER = 2; + private long docCount_; + public boolean hasDocCount() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getDocCount() { + return docCount_; + } + + // optional int64 reserved_read_cu = 3; + public static final int RESERVED_READ_CU_FIELD_NUMBER = 3; + private long reservedReadCu_; + public boolean hasReservedReadCu() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getReservedReadCu() { + return reservedReadCu_; + } + + // optional int64 timestamp = 4; + public static final int TIMESTAMP_FIELD_NUMBER = 4; + private long timestamp_; + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getTimestamp() { + return timestamp_; + } + + private void initFields() { + storageSize_ = 0L; + docCount_ = 0L; + reservedReadCu_ = 0L; + timestamp_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, storageSize_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, docCount_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, reservedReadCu_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt64(4, timestamp_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, storageSize_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, docCount_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, reservedReadCu_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(4, timestamp_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + storageSize_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + docCount_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + reservedReadCu_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + timestamp_ = 0L; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo build() { + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo result = new com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.storageSize_ = storageSize_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.docCount_ = docCount_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.reservedReadCu_ = reservedReadCu_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.timestamp_ = timestamp_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDefaultInstance()) return this; + if (other.hasStorageSize()) { + setStorageSize(other.getStorageSize()); + } + if (other.hasDocCount()) { + setDocCount(other.getDocCount()); + } + if (other.hasReservedReadCu()) { + setReservedReadCu(other.getReservedReadCu()); + } + if (other.hasTimestamp()) { + setTimestamp(other.getTimestamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + storageSize_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + docCount_ = input.readInt64(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + reservedReadCu_ = input.readInt64(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + timestamp_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional int64 storage_size = 1; + private long storageSize_ ; + public boolean hasStorageSize() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getStorageSize() { + return storageSize_; + } + public Builder setStorageSize(long value) { + bitField0_ |= 0x00000001; + storageSize_ = value; + onChanged(); + return this; + } + public Builder clearStorageSize() { + bitField0_ = (bitField0_ & ~0x00000001); + storageSize_ = 0L; + onChanged(); + return this; + } + + // optional int64 doc_count = 2; + private long docCount_ ; + public boolean hasDocCount() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getDocCount() { + return docCount_; + } + public Builder setDocCount(long value) { + bitField0_ |= 0x00000002; + docCount_ = value; + onChanged(); + return this; + } + public Builder clearDocCount() { + bitField0_ = (bitField0_ & ~0x00000002); + docCount_ = 0L; + onChanged(); + return this; + } + + // optional int64 reserved_read_cu = 3; + private long reservedReadCu_ ; + public boolean hasReservedReadCu() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getReservedReadCu() { + return reservedReadCu_; + } + public Builder setReservedReadCu(long value) { + bitField0_ |= 0x00000004; + reservedReadCu_ = value; + onChanged(); + return this; + } + public Builder clearReservedReadCu() { + bitField0_ = (bitField0_ & ~0x00000004); + reservedReadCu_ = 0L; + onChanged(); + return this; + } + + // optional int64 timestamp = 4; + private long timestamp_ ; + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getTimestamp() { + return timestamp_; + } + public Builder setTimestamp(long value) { + bitField0_ |= 0x00000008; + timestamp_ = value; + onChanged(); + return this; + } + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000008); + timestamp_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.MeteringInfo) + } + + static { + defaultInstance = new MeteringInfo(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.MeteringInfo) + } + + public interface DescribeSearchIndexRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // optional string index_name = 2; + boolean hasIndexName(); + String getIndexName(); + } + public static final class DescribeSearchIndexRequest extends + com.google.protobuf.GeneratedMessage + implements DescribeSearchIndexRequestOrBuilder { + // Use DescribeSearchIndexRequest.newBuilder() to construct. + private DescribeSearchIndexRequest(Builder builder) { + super(builder); + } + private DescribeSearchIndexRequest(boolean noInit) {} + + private static final DescribeSearchIndexRequest defaultInstance; + public static DescribeSearchIndexRequest getDefaultInstance() { + return defaultInstance; + } + + public DescribeSearchIndexRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_fieldAccessorTable; + } + + private int bitField0_; + // optional string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string index_name = 2; + public static final int INDEX_NAME_FIELD_NUMBER = 2; + private java.lang.Object indexName_; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + indexName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIndexNameBytes() { + java.lang.Object ref = indexName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + indexName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + indexName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIndexNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIndexNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + indexName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest build() { + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest result = new com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.indexName_ = indexName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasIndexName()) { + setIndexName(other.getIndexName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + indexName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // optional string index_name = 2; + private java.lang.Object indexName_ = ""; + public boolean hasIndexName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIndexName() { + java.lang.Object ref = indexName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + indexName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIndexName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + return this; + } + public Builder clearIndexName() { + bitField0_ = (bitField0_ & ~0x00000002); + indexName_ = getDefaultInstance().getIndexName(); + onChanged(); + return this; + } + void setIndexName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + indexName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeSearchIndexRequest) + } + + static { + defaultInstance = new DescribeSearchIndexRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeSearchIndexRequest) + } + + public interface DescribeSearchIndexResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSchema schema = 1; + boolean hasSchema(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema getSchema(); + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder getSchemaOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.SyncStat sync_stat = 2; + boolean hasSyncStat(); + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat getSyncStat(); + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStatOrBuilder getSyncStatOrBuilder(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.MeteringInfo metering_info = 3; + boolean hasMeteringInfo(); + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo getMeteringInfo(); + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfoOrBuilder getMeteringInfoOrBuilder(); + } + public static final class DescribeSearchIndexResponse extends + com.google.protobuf.GeneratedMessage + implements DescribeSearchIndexResponseOrBuilder { + // Use DescribeSearchIndexResponse.newBuilder() to construct. + private DescribeSearchIndexResponse(Builder builder) { + super(builder); + } + private DescribeSearchIndexResponse(boolean noInit) {} + + private static final DescribeSearchIndexResponse defaultInstance; + public static DescribeSearchIndexResponse getDefaultInstance() { + return defaultInstance; + } + + public DescribeSearchIndexResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSchema schema = 1; + public static final int SCHEMA_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema schema_; + public boolean hasSchema() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema getSchema() { + return schema_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder getSchemaOrBuilder() { + return schema_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SyncStat sync_stat = 2; + public static final int SYNC_STAT_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat syncStat_; + public boolean hasSyncStat() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat getSyncStat() { + return syncStat_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStatOrBuilder getSyncStatOrBuilder() { + return syncStat_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.MeteringInfo metering_info = 3; + public static final int METERING_INFO_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo meteringInfo_; + public boolean hasMeteringInfo() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo getMeteringInfo() { + return meteringInfo_; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfoOrBuilder getMeteringInfoOrBuilder() { + return meteringInfo_; + } + + private void initFields() { + schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + syncStat_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDefaultInstance(); + meteringInfo_ = com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, schema_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, syncStat_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, meteringInfo_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, schema_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, syncStat_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, meteringInfo_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.Search.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getSchemaFieldBuilder(); + getSyncStatFieldBuilder(); + getMeteringInfoFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (schemaBuilder_ == null) { + schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + } else { + schemaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (syncStatBuilder_ == null) { + syncStat_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDefaultInstance(); + } else { + syncStatBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (meteringInfoBuilder_ == null) { + meteringInfo_ = com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDefaultInstance(); + } else { + meteringInfoBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse build() { + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse result = new com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (schemaBuilder_ == null) { + result.schema_ = schema_; + } else { + result.schema_ = schemaBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (syncStatBuilder_ == null) { + result.syncStat_ = syncStat_; + } else { + result.syncStat_ = syncStatBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (meteringInfoBuilder_ == null) { + result.meteringInfo_ = meteringInfo_; + } else { + result.meteringInfo_ = meteringInfoBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse.getDefaultInstance()) return this; + if (other.hasSchema()) { + mergeSchema(other.getSchema()); + } + if (other.hasSyncStat()) { + mergeSyncStat(other.getSyncStat()); + } + if (other.hasMeteringInfo()) { + mergeMeteringInfo(other.getMeteringInfo()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.newBuilder(); + if (hasSchema()) { + subBuilder.mergeFrom(getSchema()); + } + input.readMessage(subBuilder, extensionRegistry); + setSchema(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.newBuilder(); + if (hasSyncStat()) { + subBuilder.mergeFrom(getSyncStat()); + } + input.readMessage(subBuilder, extensionRegistry); + setSyncStat(subBuilder.buildPartial()); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.newBuilder(); + if (hasMeteringInfo()) { + subBuilder.mergeFrom(getMeteringInfo()); + } + input.readMessage(subBuilder, extensionRegistry); + setMeteringInfo(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alicloud.openservices.tablestore.core.protocol.IndexSchema schema = 1; + private com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder> schemaBuilder_; + public boolean hasSchema() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema getSchema() { + if (schemaBuilder_ == null) { + return schema_; + } else { + return schemaBuilder_.getMessage(); + } + } + public Builder setSchema(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema value) { + if (schemaBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + schema_ = value; + onChanged(); + } else { + schemaBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setSchema( + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder builderForValue) { + if (schemaBuilder_ == null) { + schema_ = builderForValue.build(); + onChanged(); + } else { + schemaBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeSchema(com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema value) { + if (schemaBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + schema_ != com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance()) { + schema_ = + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.newBuilder(schema_).mergeFrom(value).buildPartial(); + } else { + schema_ = value; + } + onChanged(); + } else { + schemaBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearSchema() { + if (schemaBuilder_ == null) { + schema_ = com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.getDefaultInstance(); + onChanged(); + } else { + schemaBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder getSchemaBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getSchemaFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder getSchemaOrBuilder() { + if (schemaBuilder_ != null) { + return schemaBuilder_.getMessageOrBuilder(); + } else { + return schema_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder> + getSchemaFieldBuilder() { + if (schemaBuilder_ == null) { + schemaBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchemaOrBuilder>( + schema_, + getParentForChildren(), + isClean()); + schema_ = null; + } + return schemaBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.SyncStat sync_stat = 2; + private com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat syncStat_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat, com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SyncStatOrBuilder> syncStatBuilder_; + public boolean hasSyncStat() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat getSyncStat() { + if (syncStatBuilder_ == null) { + return syncStat_; + } else { + return syncStatBuilder_.getMessage(); + } + } + public Builder setSyncStat(com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat value) { + if (syncStatBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + syncStat_ = value; + onChanged(); + } else { + syncStatBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setSyncStat( + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.Builder builderForValue) { + if (syncStatBuilder_ == null) { + syncStat_ = builderForValue.build(); + onChanged(); + } else { + syncStatBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeSyncStat(com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat value) { + if (syncStatBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + syncStat_ != com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDefaultInstance()) { + syncStat_ = + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.newBuilder(syncStat_).mergeFrom(value).buildPartial(); + } else { + syncStat_ = value; + } + onChanged(); + } else { + syncStatBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearSyncStat() { + if (syncStatBuilder_ == null) { + syncStat_ = com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.getDefaultInstance(); + onChanged(); + } else { + syncStatBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.Builder getSyncStatBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getSyncStatFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.SyncStatOrBuilder getSyncStatOrBuilder() { + if (syncStatBuilder_ != null) { + return syncStatBuilder_.getMessageOrBuilder(); + } else { + return syncStat_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat, com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SyncStatOrBuilder> + getSyncStatFieldBuilder() { + if (syncStatBuilder_ == null) { + syncStatBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat, com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.SyncStatOrBuilder>( + syncStat_, + getParentForChildren(), + isClean()); + syncStat_ = null; + } + return syncStatBuilder_; + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.MeteringInfo metering_info = 3; + private com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo meteringInfo_ = com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo, com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfoOrBuilder> meteringInfoBuilder_; + public boolean hasMeteringInfo() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo getMeteringInfo() { + if (meteringInfoBuilder_ == null) { + return meteringInfo_; + } else { + return meteringInfoBuilder_.getMessage(); + } + } + public Builder setMeteringInfo(com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo value) { + if (meteringInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + meteringInfo_ = value; + onChanged(); + } else { + meteringInfoBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder setMeteringInfo( + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.Builder builderForValue) { + if (meteringInfoBuilder_ == null) { + meteringInfo_ = builderForValue.build(); + onChanged(); + } else { + meteringInfoBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder mergeMeteringInfo(com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo value) { + if (meteringInfoBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + meteringInfo_ != com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDefaultInstance()) { + meteringInfo_ = + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.newBuilder(meteringInfo_).mergeFrom(value).buildPartial(); + } else { + meteringInfo_ = value; + } + onChanged(); + } else { + meteringInfoBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + public Builder clearMeteringInfo() { + if (meteringInfoBuilder_ == null) { + meteringInfo_ = com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.getDefaultInstance(); + onChanged(); + } else { + meteringInfoBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.Builder getMeteringInfoBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getMeteringInfoFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfoOrBuilder getMeteringInfoOrBuilder() { + if (meteringInfoBuilder_ != null) { + return meteringInfoBuilder_.getMessageOrBuilder(); + } else { + return meteringInfo_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo, com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfoOrBuilder> + getMeteringInfoFieldBuilder() { + if (meteringInfoBuilder_ == null) { + meteringInfoBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo, com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfoOrBuilder>( + meteringInfo_, + getParentForChildren(), + isClean()); + meteringInfo_ = null; + } + return meteringInfoBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeSearchIndexResponse) + } + + static { + defaultInstance = new DescribeSearchIndexResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeSearchIndexResponse) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\014search.proto\0222com.alicloud.openservice" + + "s.tablestore.core.protocol\"\241\001\n\nMatchQuer" + + "y\022\022\n\nfield_name\030\001 \001(\t\022\014\n\004text\030\002 \001(\t\022\034\n\024m" + + "inimum_should_match\030\003 \001(\005\022S\n\010operator\030\004 " + + "\001(\0162A.com.alicloud.openservices.tablesto" + + "re.core.protocol.QueryOperator\"4\n\020MatchP" + + "hraseQuery\022\022\n\nfield_name\030\001 \001(\t\022\014\n\004text\030\002" + + " \001(\t\"\017\n\rMatchAllQuery\"-\n\tTermQuery\022\022\n\nfi" + + "eld_name\030\001 \001(\t\022\014\n\004term\030\002 \001(\014\"/\n\nTermsQue" + + "ry\022\022\n\nfield_name\030\001 \001(\t\022\r\n\005terms\030\002 \003(\014\"t\n", + "\nRangeQuery\022\022\n\nfield_name\030\001 \001(\t\022\022\n\nrange" + + "_from\030\002 \001(\014\022\020\n\010range_to\030\003 \001(\014\022\025\n\rinclude" + + "_lower\030\004 \001(\010\022\025\n\rinclude_upper\030\005 \001(\010\"1\n\013P" + + "refixQuery\022\022\n\nfield_name\030\001 \001(\t\022\016\n\006prefix" + + "\030\002 \001(\t\"2\n\rWildcardQuery\022\022\n\nfield_name\030\001 " + + "\001(\t\022\r\n\005value\030\002 \001(\t\"\365\002\n\tBoolQuery\022O\n\014must" + + "_queries\030\001 \003(\01329.com.alicloud.openservic" + + "es.tablestore.core.protocol.Query\022S\n\020mus" + + "t_not_queries\030\002 \003(\01329.com.alicloud.opens" + + "ervices.tablestore.core.protocol.Query\022Q", + "\n\016filter_queries\030\003 \003(\01329.com.alicloud.op" + + "enservices.tablestore.core.protocol.Quer" + + "y\022Q\n\016should_queries\030\004 \003(\01329.com.alicloud" + + ".openservices.tablestore.core.protocol.Q" + + "uery\022\034\n\024minimum_should_match\030\005 \001(\005\"\\\n\017Co" + + "nstScoreQuery\022I\n\006filter\030\001 \001(\01329.com.alic" + + "loud.openservices.tablestore.core.protoc" + + "ol.Query\"&\n\020FieldValueFactor\022\022\n\nfield_na" + + "me\030\001 \001(\t\"\300\001\n\022FunctionScoreQuery\022H\n\005query" + + "\030\001 \001(\01329.com.alicloud.openservices.table", + "store.core.protocol.Query\022`\n\022field_value" + + "_factor\030\002 \001(\0132D.com.alicloud.openservice" + + "s.tablestore.core.protocol.FieldValueFac" + + "tor\"\270\001\n\013NestedQuery\022\014\n\004path\030\001 \001(\t\022H\n\005que" + + "ry\030\002 \001(\01329.com.alicloud.openservices.tab" + + "lestore.core.protocol.Query\022Q\n\nscore_mod" + + "e\030\003 \001(\0162=.com.alicloud.openservices.tabl" + + "estore.core.protocol.ScoreMode\"Q\n\023GeoBou" + + "ndingBoxQuery\022\022\n\nfield_name\030\001 \001(\t\022\020\n\010top" + + "_left\030\002 \001(\t\022\024\n\014bottom_right\030\003 \001(\t\"N\n\020Geo", + "DistanceQuery\022\022\n\nfield_name\030\001 \001(\t\022\024\n\014cen" + + "ter_point\030\002 \001(\t\022\020\n\010distance\030\003 \001(\001\"5\n\017Geo" + + "PolygonQuery\022\022\n\nfield_name\030\001 \001(\t\022\016\n\006poin" + + "ts\030\002 \003(\t\"c\n\005Query\022K\n\004type\030\001 \001(\0162=.com.al" + + "icloud.openservices.tablestore.core.prot" + + "ocol.QueryType\022\r\n\005query\030\002 \001(\014\"\036\n\010Collaps" + + "e\022\022\n\nfield_name\030\001 \001(\t\"g\n\014NestedFilter\022\014\n" + + "\004path\030\001 \001(\t\022I\n\006filter\030\002 \001(\01329.com.aliclo" + + "ud.openservices.tablestore.core.protocol" + + ".Query\"Y\n\tScoreSort\022L\n\005order\030\001 \001(\0162=.com", + ".alicloud.openservices.tablestore.core.p" + + "rotocol.SortOrder\"^\n\016PrimaryKeySort\022L\n\005o" + + "rder\030\001 \001(\0162=.com.alicloud.openservices.t" + + "ablestore.core.protocol.SortOrder\"\222\002\n\tFi" + + "eldSort\022\022\n\nfield_name\030\001 \001(\t\022L\n\005order\030\002 \001" + + "(\0162=.com.alicloud.openservices.tablestor" + + "e.core.protocol.SortOrder\022J\n\004mode\030\003 \001(\0162" + + "<.com.alicloud.openservices.tablestore.c" + + "ore.protocol.SortMode\022W\n\rnested_filter\030\004" + + " \001(\0132@.com.alicloud.openservices.tablest", + "ore.core.protocol.NestedFilter\"\204\003\n\017GeoDi" + + "stanceSort\022\022\n\nfield_name\030\001 \001(\t\022\016\n\006points" + + "\030\002 \003(\t\022L\n\005order\030\003 \001(\0162=.com.alicloud.ope" + + "nservices.tablestore.core.protocol.SortO" + + "rder\022J\n\004mode\030\004 \001(\0162<.com.alicloud.opense" + + "rvices.tablestore.core.protocol.SortMode" + + "\022Z\n\rdistance_type\030\005 \001(\0162C.com.alicloud.o" + + "penservices.tablestore.core.protocol.Geo" + + "DistanceType\022W\n\rnested_filter\030\006 \001(\0132@.co" + + "m.alicloud.openservices.tablestore.core.", + "protocol.NestedFilter\"\343\002\n\006Sorter\022Q\n\nfiel" + + "d_sort\030\001 \001(\0132=.com.alicloud.openservices" + + ".tablestore.core.protocol.FieldSort\022^\n\021g" + + "eo_distance_sort\030\002 \001(\0132C.com.alicloud.op" + + "enservices.tablestore.core.protocol.GeoD" + + "istanceSort\022Q\n\nscore_sort\030\003 \001(\0132=.com.al" + + "icloud.openservices.tablestore.core.prot" + + "ocol.ScoreSort\022S\n\007pk_sort\030\004 \001(\0132B.com.al" + + "icloud.openservices.tablestore.core.prot" + + "ocol.PrimaryKeySort\"R\n\004Sort\022J\n\006sorter\030\001 ", + "\003(\0132:.com.alicloud.openservices.tablesto" + + "re.core.protocol.Sorter\"\264\002\n\013SearchQuery\022" + + "\016\n\006offset\030\001 \001(\005\022\r\n\005limit\030\002 \001(\005\022H\n\005query\030" + + "\004 \001(\01329.com.alicloud.openservices.tables" + + "tore.core.protocol.Query\022N\n\010collapse\030\005 \001" + + "(\0132<.com.alicloud.openservices.tablestor" + + "e.core.protocol.Collapse\022F\n\004sort\030\006 \001(\01328" + + ".com.alicloud.openservices.tablestore.co" + + "re.protocol.Sort\022\025\n\rgetTotalCount\030\010 \001(\010\022" + + "\r\n\005token\030\t \001(\014\"\177\n\014ColumnsToGet\022Y\n\013return", + "_type\030\001 \001(\0162D.com.alicloud.openservices." + + "tablestore.core.protocol.ColumnReturnTyp" + + "e\022\024\n\014column_names\030\002 \003(\t\"\277\001\n\rSearchReques" + + "t\022\022\n\ntable_name\030\001 \001(\t\022\022\n\nindex_name\030\002 \001(" + + "\t\022X\n\016columns_to_get\030\003 \001(\0132@.com.alicloud" + + ".openservices.tablestore.core.protocol.C" + + "olumnsToGet\022\024\n\014search_query\030\004 \001(\014\022\026\n\016rou" + + "ting_values\030\005 \003(\014\"`\n\016SearchResponse\022\022\n\nt" + + "otal_hits\030\001 \001(\003\022\014\n\004rows\030\002 \003(\014\022\030\n\020is_all_" + + "succeeded\030\003 \001(\010\022\022\n\nnext_token\030\006 \001(\014\"\373\002\n\013", + "FieldSchema\022\022\n\nfield_name\030\001 \001(\t\022Q\n\nfield" + + "_type\030\002 \001(\0162=.com.alicloud.openservices." + + "tablestore.core.protocol.FieldType\022W\n\rin" + + "dex_options\030\003 \001(\0162@.com.alicloud.openser" + + "vices.tablestore.core.protocol.IndexOpti" + + "ons\022\020\n\010analyzer\030\004 \001(\t\022\r\n\005index\030\005 \001(\010\022\022\n\n" + + "doc_values\030\006 \001(\010\022\r\n\005store\030\007 \001(\010\022V\n\rfield" + + "_schemas\030\010 \003(\0132?.com.alicloud.openservic" + + "es.tablestore.core.protocol.FieldSchema\022" + + "\020\n\010is_array\030\t \001(\010\"\214\002\n\013IndexSchema\022V\n\rfie", + "ld_schemas\030\001 \003(\0132?.com.alicloud.openserv" + + "ices.tablestore.core.protocol.FieldSchem" + + "a\022W\n\rindex_setting\030\002 \001(\0132@.com.alicloud." + + "openservices.tablestore.core.protocol.In" + + "dexSetting\022L\n\nindex_sort\030\003 \001(\01328.com.ali" + + "cloud.openservices.tablestore.core.proto" + + "col.Sort\"`\n\014IndexSetting\022\030\n\020number_of_sh" + + "ards\030\001 \001(\005\022\026\n\016routing_fields\030\002 \003(\t\022\036\n\026ro" + + "uting_partition_size\030\003 \001(\005\"\223\001\n\030CreateSea" + + "rchIndexRequest\022\022\n\ntable_name\030\001 \002(\t\022\022\n\ni", + "ndex_name\030\002 \002(\t\022O\n\006schema\030\003 \001(\0132?.com.al" + + "icloud.openservices.tablestore.core.prot" + + "ocol.IndexSchema\"\033\n\031CreateSearchIndexRes" + + "ponse\"3\n\tIndexInfo\022\022\n\ntable_name\030\001 \001(\t\022\022" + + "\n\nindex_name\030\002 \001(\t\",\n\026ListSearchIndexReq" + + "uest\022\022\n\ntable_name\030\001 \001(\t\"i\n\027ListSearchIn" + + "dexResponse\022N\n\007indices\030\001 \003(\0132=.com.alicl" + + "oud.openservices.tablestore.core.protoco" + + "l.IndexInfo\"B\n\030DeleteSearchIndexRequest\022" + + "\022\n\ntable_name\030\001 \001(\t\022\022\n\nindex_name\030\002 \001(\t\"", + "\033\n\031DeleteSearchIndexResponse\"}\n\010SyncStat" + + "\022Q\n\nsync_phase\030\001 \001(\0162=.com.alicloud.open" + + "services.tablestore.core.protocol.SyncPh" + + "ase\022\036\n\026current_sync_timestamp\030\002 \001(\003\"d\n\014M" + + "eteringInfo\022\024\n\014storage_size\030\001 \001(\003\022\021\n\tdoc" + + "_count\030\002 \001(\003\022\030\n\020reserved_read_cu\030\003 \001(\003\022\021" + + "\n\ttimestamp\030\004 \001(\003\"D\n\032DescribeSearchIndex" + + "Request\022\022\n\ntable_name\030\001 \001(\t\022\022\n\nindex_nam" + + "e\030\002 \001(\t\"\230\002\n\033DescribeSearchIndexResponse\022" + + "O\n\006schema\030\001 \001(\0132?.com.alicloud.openservi", + "ces.tablestore.core.protocol.IndexSchema" + + "\022O\n\tsync_stat\030\002 \001(\0132<.com.alicloud.opens" + + "ervices.tablestore.core.protocol.SyncSta" + + "t\022W\n\rmetering_info\030\003 \001(\0132@.com.alicloud." + + "openservices.tablestore.core.protocol.Me" + + "teringInfo*\277\002\n\tQueryType\022\017\n\013MATCH_QUERY\020" + + "\001\022\026\n\022MATCH_PHRASE_QUERY\020\002\022\016\n\nTERM_QUERY\020" + + "\003\022\017\n\013RANGE_QUERY\020\004\022\020\n\014PREFIX_QUERY\020\005\022\016\n\n" + + "BOOL_QUERY\020\006\022\025\n\021CONST_SCORE_QUERY\020\007\022\030\n\024F" + + "UNCTION_SCORE_QUERY\020\010\022\020\n\014NESTED_QUERY\020\t\022", + "\022\n\016WILDCARD_QUERY\020\n\022\023\n\017MATCH_ALL_QUERY\020\013" + + "\022\032\n\026GEO_BOUNDING_BOX_QUERY\020\014\022\026\n\022GEO_DIST" + + "ANCE_QUERY\020\r\022\025\n\021GEO_POLYGON_QUERY\020\016\022\017\n\013T" + + "ERMS_QUERY\020\017* \n\rQueryOperator\022\006\n\002OR\020\001\022\007\n" + + "\003AND\020\002*r\n\tScoreMode\022\023\n\017SCORE_MODE_NONE\020\001" + + "\022\022\n\016SCORE_MODE_AVG\020\002\022\022\n\016SCORE_MODE_MAX\020\003" + + "\022\024\n\020SCORE_MODE_TOTAL\020\004\022\022\n\016SCORE_MODE_MIN" + + "\020\005*4\n\tSortOrder\022\022\n\016SORT_ORDER_ASC\020\000\022\023\n\017S" + + "ORT_ORDER_DESC\020\001*C\n\010SortMode\022\021\n\rSORT_MOD" + + "E_MIN\020\000\022\021\n\rSORT_MODE_MAX\020\001\022\021\n\rSORT_MODE_", + "AVG\020\002*?\n\017GeoDistanceType\022\024\n\020GEO_DISTANCE" + + "_ARC\020\000\022\026\n\022GEO_DISTANCE_PLANE\020\001*I\n\020Column" + + "ReturnType\022\016\n\nRETURN_ALL\020\001\022\024\n\020RETURN_SPE" + + "CIFIED\020\002\022\017\n\013RETURN_NONE\020\003*?\n\014IndexOption" + + "s\022\010\n\004DOCS\020\001\022\t\n\005FREQS\020\002\022\r\n\tPOSITIONS\020\003\022\013\n" + + "\007OFFSETS\020\004*`\n\tFieldType\022\010\n\004LONG\020\001\022\n\n\006DOU" + + "BLE\020\002\022\013\n\007BOOLEAN\020\003\022\013\n\007KEYWORD\020\004\022\010\n\004TEXT\020" + + "\005\022\n\n\006NESTED\020\006\022\r\n\tGEO_POINT\020\007*\037\n\tSyncPhas" + + "e\022\010\n\004FULL\020\001\022\010\n\004INCR\020\002" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchQuery_descriptor, + new java.lang.String[] { "FieldName", "Text", "MinimumShouldMatch", "Operator", }, + com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.MatchQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchPhraseQuery_descriptor, + new java.lang.String[] { "FieldName", "Text", }, + com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.MatchPhraseQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_MatchAllQuery_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.MatchAllQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermQuery_descriptor, + new java.lang.String[] { "FieldName", "Term", }, + com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.TermQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TermsQuery_descriptor, + new java.lang.String[] { "FieldName", "Terms", }, + com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.TermsQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_RangeQuery_descriptor, + new java.lang.String[] { "FieldName", "RangeFrom", "RangeTo", "IncludeLower", "IncludeUpper", }, + com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.RangeQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrefixQuery_descriptor, + new java.lang.String[] { "FieldName", "Prefix", }, + com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.PrefixQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_WildcardQuery_descriptor, + new java.lang.String[] { "FieldName", "Value", }, + com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.WildcardQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_BoolQuery_descriptor, + new java.lang.String[] { "MustQueries", "MustNotQueries", "FilterQueries", "ShouldQueries", "MinimumShouldMatch", }, + com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.BoolQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConstScoreQuery_descriptor, + new java.lang.String[] { "Filter", }, + com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.ConstScoreQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldValueFactor_descriptor, + new java.lang.String[] { "FieldName", }, + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.class, + com.alicloud.openservices.tablestore.core.protocol.Search.FieldValueFactor.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_FunctionScoreQuery_descriptor, + new java.lang.String[] { "Query", "FieldValueFactor", }, + com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.FunctionScoreQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedQuery_descriptor, + new java.lang.String[] { "Path", "Query", "ScoreMode", }, + com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.NestedQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoBoundingBoxQuery_descriptor, + new java.lang.String[] { "FieldName", "TopLeft", "BottomRight", }, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoBoundingBoxQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceQuery_descriptor, + new java.lang.String[] { "FieldName", "CenterPoint", "Distance", }, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoPolygonQuery_descriptor, + new java.lang.String[] { "FieldName", "Points", }, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoPolygonQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Query_descriptor, + new java.lang.String[] { "Type", "Query", }, + com.alicloud.openservices.tablestore.core.protocol.Search.Query.class, + com.alicloud.openservices.tablestore.core.protocol.Search.Query.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Collapse_descriptor, + new java.lang.String[] { "FieldName", }, + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.class, + com.alicloud.openservices.tablestore.core.protocol.Search.Collapse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_NestedFilter_descriptor, + new java.lang.String[] { "Path", "Filter", }, + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.class, + com.alicloud.openservices.tablestore.core.protocol.Search.NestedFilter.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ScoreSort_descriptor, + new java.lang.String[] { "Order", }, + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.class, + com.alicloud.openservices.tablestore.core.protocol.Search.ScoreSort.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_descriptor = + getDescriptor().getMessageTypes().get(20); + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_PrimaryKeySort_descriptor, + new java.lang.String[] { "Order", }, + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.class, + com.alicloud.openservices.tablestore.core.protocol.Search.PrimaryKeySort.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_descriptor = + getDescriptor().getMessageTypes().get(21); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSort_descriptor, + new java.lang.String[] { "FieldName", "Order", "Mode", "NestedFilter", }, + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.class, + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSort.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_descriptor = + getDescriptor().getMessageTypes().get(22); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GeoDistanceSort_descriptor, + new java.lang.String[] { "FieldName", "Points", "Order", "Mode", "DistanceType", "NestedFilter", }, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.class, + com.alicloud.openservices.tablestore.core.protocol.Search.GeoDistanceSort.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_descriptor = + getDescriptor().getMessageTypes().get(23); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sorter_descriptor, + new java.lang.String[] { "FieldSort", "GeoDistanceSort", "ScoreSort", "PkSort", }, + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.class, + com.alicloud.openservices.tablestore.core.protocol.Search.Sorter.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_descriptor = + getDescriptor().getMessageTypes().get(24); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Sort_descriptor, + new java.lang.String[] { "Sorter", }, + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.class, + com.alicloud.openservices.tablestore.core.protocol.Search.Sort.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_descriptor = + getDescriptor().getMessageTypes().get(25); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchQuery_descriptor, + new java.lang.String[] { "Offset", "Limit", "Query", "Collapse", "Sort", "GetTotalCount", "Token", }, + com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery.class, + com.alicloud.openservices.tablestore.core.protocol.Search.SearchQuery.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_descriptor = + getDescriptor().getMessageTypes().get(26); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ColumnsToGet_descriptor, + new java.lang.String[] { "ReturnType", "ColumnNames", }, + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.class, + com.alicloud.openservices.tablestore.core.protocol.Search.ColumnsToGet.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_descriptor = + getDescriptor().getMessageTypes().get(27); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchRequest_descriptor, + new java.lang.String[] { "TableName", "IndexName", "ColumnsToGet", "SearchQuery", "RoutingValues", }, + com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest.class, + com.alicloud.openservices.tablestore.core.protocol.Search.SearchRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_descriptor = + getDescriptor().getMessageTypes().get(28); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_SearchResponse_descriptor, + new java.lang.String[] { "TotalHits", "Rows", "IsAllSucceeded", "NextToken", }, + com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse.class, + com.alicloud.openservices.tablestore.core.protocol.Search.SearchResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_descriptor = + getDescriptor().getMessageTypes().get(29); + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_FieldSchema_descriptor, + new java.lang.String[] { "FieldName", "FieldType", "IndexOptions", "Analyzer", "Index", "DocValues", "Store", "FieldSchemas", "IsArray", }, + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.class, + com.alicloud.openservices.tablestore.core.protocol.Search.FieldSchema.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_descriptor = + getDescriptor().getMessageTypes().get(30); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSchema_descriptor, + new java.lang.String[] { "FieldSchemas", "IndexSetting", "IndexSort", }, + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.class, + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSchema.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_descriptor = + getDescriptor().getMessageTypes().get(31); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexSetting_descriptor, + new java.lang.String[] { "NumberOfShards", "RoutingFields", "RoutingPartitionSize", }, + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.class, + com.alicloud.openservices.tablestore.core.protocol.Search.IndexSetting.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_descriptor = + getDescriptor().getMessageTypes().get(32); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexRequest_descriptor, + new java.lang.String[] { "TableName", "IndexName", "Schema", }, + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest.class, + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_descriptor = + getDescriptor().getMessageTypes().get(33); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateSearchIndexResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse.class, + com.alicloud.openservices.tablestore.core.protocol.Search.CreateSearchIndexResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_descriptor = + getDescriptor().getMessageTypes().get(34); + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_IndexInfo_descriptor, + new java.lang.String[] { "TableName", "IndexName", }, + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.class, + com.alicloud.openservices.tablestore.core.protocol.Search.IndexInfo.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_descriptor = + getDescriptor().getMessageTypes().get(35); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexRequest_descriptor, + new java.lang.String[] { "TableName", }, + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest.class, + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_descriptor = + getDescriptor().getMessageTypes().get(36); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListSearchIndexResponse_descriptor, + new java.lang.String[] { "Indices", }, + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse.class, + com.alicloud.openservices.tablestore.core.protocol.Search.ListSearchIndexResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_descriptor = + getDescriptor().getMessageTypes().get(37); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexRequest_descriptor, + new java.lang.String[] { "TableName", "IndexName", }, + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest.class, + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_descriptor = + getDescriptor().getMessageTypes().get(38); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteSearchIndexResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse.class, + com.alicloud.openservices.tablestore.core.protocol.Search.DeleteSearchIndexResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_descriptor = + getDescriptor().getMessageTypes().get(39); + internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_SyncStat_descriptor, + new java.lang.String[] { "SyncPhase", "CurrentSyncTimestamp", }, + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.class, + com.alicloud.openservices.tablestore.core.protocol.Search.SyncStat.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_descriptor = + getDescriptor().getMessageTypes().get(40); + internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_MeteringInfo_descriptor, + new java.lang.String[] { "StorageSize", "DocCount", "ReservedReadCu", "Timestamp", }, + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.class, + com.alicloud.openservices.tablestore.core.protocol.Search.MeteringInfo.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_descriptor = + getDescriptor().getMessageTypes().get(41); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexRequest_descriptor, + new java.lang.String[] { "TableName", "IndexName", }, + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest.class, + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_descriptor = + getDescriptor().getMessageTypes().get(42); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeSearchIndexResponse_descriptor, + new java.lang.String[] { "Schema", "SyncStat", "MeteringInfo", }, + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse.class, + com.alicloud.openservices.tablestore.core.protocol.Search.DescribeSearchIndexResponse.Builder.class); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolBuilder.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolBuilder.java new file mode 100644 index 0000000..e252569 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolBuilder.java @@ -0,0 +1,208 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.PrimaryKey; +import com.alicloud.openservices.tablestore.model.search.*; +import com.google.protobuf.ByteString; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class SearchProtocolBuilder { + + static final int DEFAULT_NUMBER_OF_SHARDS = 1; + + public static Search.FieldType buildFieldType(FieldType fieldType) { + switch (fieldType) { + case LONG: + return Search.FieldType.LONG; + case DOUBLE: + return Search.FieldType.DOUBLE; + case BOOLEAN: + return Search.FieldType.BOOLEAN; + case KEYWORD: + return Search.FieldType.KEYWORD; + case TEXT: + return Search.FieldType.TEXT; + case NESTED: + return Search.FieldType.NESTED; + case GEO_POINT: + return Search.FieldType.GEO_POINT; + default: + throw new IllegalArgumentException("Unknown fieldType: " + fieldType.name()); + } + } + + public static Search.IndexOptions buildIndexOptions(IndexOptions indexOptions) { + switch (indexOptions) { + case DOCS: + return Search.IndexOptions.DOCS; + case FREQS: + return Search.IndexOptions.FREQS; + case POSITIONS: + return Search.IndexOptions.POSITIONS; + case OFFSETS: + return Search.IndexOptions.OFFSETS; + default: + throw new IllegalArgumentException("Unknown indexOptions: " + indexOptions.name()); + } + } + + public static Search.FieldSchema buildFieldSchema(FieldSchema fieldSchema) { + Search.FieldSchema.Builder builder = Search.FieldSchema.newBuilder(); + builder.setFieldName(fieldSchema.getFieldName()); + builder.setFieldType(buildFieldType(fieldSchema.getFieldType())); + if (fieldSchema.getFieldType() != FieldType.NESTED) { + if (fieldSchema.isIndex() != null) { + builder.setIndex(fieldSchema.isIndex()); + } + if (fieldSchema.isEnableSortAndAgg() != null) { + builder.setDocValues(fieldSchema.isEnableSortAndAgg()); + } + if (fieldSchema.isStore() != null) { + builder.setStore(fieldSchema.isStore()); + } else { + if (fieldSchema.getFieldType() == FieldType.TEXT) { + builder.setStore(false); + } else { + builder.setStore(true); + } + } + if (fieldSchema.isArray() != null) { + builder.setIsArray(fieldSchema.isArray()); + } + } + if (fieldSchema.getIndexOptions() != null) { + builder.setIndexOptions(buildIndexOptions(fieldSchema.getIndexOptions())); + } + if (fieldSchema.getAnalyzer() != null) { + builder.setAnalyzer(fieldSchema.getAnalyzer().toString()); + } + if (fieldSchema.getSubFieldSchemas() != null) { + for (FieldSchema subSchema : fieldSchema.getSubFieldSchemas()) { + builder.addFieldSchemas(buildFieldSchema(subSchema)); + } + } + return builder.build(); + } + + public static Search.IndexSetting buildIndexSetting(IndexSetting indexSetting) { + Search.IndexSetting.Builder builder = Search.IndexSetting.newBuilder(); + builder.setNumberOfShards(DEFAULT_NUMBER_OF_SHARDS); + if (indexSetting.getRoutingFields() != null) { + builder.addAllRoutingFields(indexSetting.getRoutingFields()); + } + return builder.build(); + } + + public static Search.IndexSchema buildIndexSchema(IndexSchema indexSchema) { + Search.IndexSchema.Builder builder = Search.IndexSchema.newBuilder(); + if (indexSchema.getIndexSetting() != null) { + builder.setIndexSetting(buildIndexSetting(indexSchema.getIndexSetting())); + } else { + builder.setIndexSetting(buildIndexSetting(new IndexSetting())); + } + for (FieldSchema fieldSchema : indexSchema.getFieldSchemas()) { + builder.addFieldSchemas(buildFieldSchema(fieldSchema)); + } + if (indexSchema.getIndexSort() != null) { + builder.setIndexSort(SearchSortBuilder.buildSort(indexSchema.getIndexSort())); + } + return builder.build(); + } + + public static Search.CreateSearchIndexRequest buildCreateSearchIndexRequest(CreateSearchIndexRequest request) { + Search.CreateSearchIndexRequest.Builder builder = Search.CreateSearchIndexRequest.newBuilder(); + builder.setTableName(request.getTableName()); + builder.setIndexName(request.getIndexName()); + builder.setSchema(buildIndexSchema(request.getIndexSchema())); + return builder.build(); + } + + public static Search.DeleteSearchIndexRequest buildDeleteSearchIndexRequest(DeleteSearchIndexRequest request) { + Search.DeleteSearchIndexRequest.Builder builder = Search.DeleteSearchIndexRequest.newBuilder(); + builder.setTableName(request.getTableName()); + builder.setIndexName(request.getIndexName()); + return builder.build(); + } + + public static Search.ListSearchIndexRequest buildListSearchIndexRequest(ListSearchIndexRequest request) { + Search.ListSearchIndexRequest.Builder builder = Search.ListSearchIndexRequest.newBuilder(); + builder.setTableName(request.getTableName()); + return builder.build(); + } + + public static Search.DescribeSearchIndexRequest buildDescribeSearchIndexRequest(DescribeSearchIndexRequest request) { + Search.DescribeSearchIndexRequest.Builder builder = Search.DescribeSearchIndexRequest.newBuilder(); + builder.setTableName(request.getTableName()); + builder.setIndexName(request.getIndexName()); + return builder.build(); + } + + public static Search.ColumnsToGet buildColumnsToGet(SearchRequest.ColumnsToGet columnsToGet) { + Search.ColumnsToGet.Builder builder = Search.ColumnsToGet.newBuilder(); + if (columnsToGet.isReturnAll()) { + builder.setReturnType(Search.ColumnReturnType.RETURN_ALL); + } else if (columnsToGet.getColumns().size() > 0) { + builder.setReturnType(Search.ColumnReturnType.RETURN_SPECIFIED); + builder.addAllColumnNames(columnsToGet.getColumns()); + } else { + builder.setReturnType(Search.ColumnReturnType.RETURN_NONE); + } + return builder.build(); + } + + public static Search.Collapse buildCollapse(Collapse collapse) { + Search.Collapse.Builder builder = Search.Collapse.newBuilder(); + builder.setFieldName(collapse.getFieldName()); + return builder.build(); + } + + public static Search.SearchQuery buildSearchQuery(SearchQuery searchQuery) { + Search.SearchQuery.Builder builder = Search.SearchQuery.newBuilder(); + if (searchQuery.getOffset() != null) { + builder.setOffset(searchQuery.getOffset()); + } + if (searchQuery.getLimit() != null) { + builder.setLimit(searchQuery.getLimit()); + } + if (searchQuery.getQuery() != null) { + builder.setQuery(SearchQueryBuilder.buildQuery(searchQuery.getQuery())); + } + if (searchQuery.getSort() != null) { + builder.setSort(SearchSortBuilder.buildSort(searchQuery.getSort())); + } + if (searchQuery.getCollapse() != null) { + builder.setCollapse(buildCollapse(searchQuery.getCollapse())); + } + builder.setGetTotalCount(searchQuery.isGetTotalCount()); + if (searchQuery.getToken() != null) { + builder.setToken(ByteString.copyFrom(searchQuery.getToken())); + } + return builder.build(); + } + + public static Search.SearchRequest buildSearchRequest(SearchRequest request) { + Search.SearchRequest.Builder builder = Search.SearchRequest.newBuilder(); + builder.setTableName(request.getTableName()); + builder.setIndexName(request.getIndexName()); + if (request.getColumnsToGet() != null) { + builder.setColumnsToGet(buildColumnsToGet(request.getColumnsToGet())); + } + builder.setSearchQuery(buildSearchQuery(request.getSearchQuery()).toByteString()); + if (request.getRoutingValues() != null) { + List routingValues = new ArrayList(); + for (PrimaryKey pk : request.getRoutingValues()) { + try { + routingValues.add(ByteString.copyFrom(PlainBufferBuilder.buildPrimaryKeyWithHeader(pk))); + } catch (IOException e) { + throw new ClientException("build plain buffer fail", e); + } + } + builder.addAllRoutingValues(routingValues); + } + return builder.build(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolParser.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolParser.java new file mode 100644 index 0000000..05e2292 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchProtocolParser.java @@ -0,0 +1,188 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.CapacityUnit; +import com.alicloud.openservices.tablestore.model.PrimaryKey; +import com.alicloud.openservices.tablestore.model.ReservedThroughput; +import com.alicloud.openservices.tablestore.model.search.*; +import com.alicloud.openservices.tablestore.model.search.sort.FieldSort; +import com.alicloud.openservices.tablestore.model.search.sort.PrimaryKeySort; +import com.alicloud.openservices.tablestore.model.search.sort.Sort; +import com.alicloud.openservices.tablestore.model.search.sort.SortOrder; + +import java.util.ArrayList; +import java.util.List; + +public class SearchProtocolParser { + + public static FieldType toFieldType(Search.FieldType fieldType) { + switch (fieldType) { + case LONG: + return FieldType.LONG; + case DOUBLE: + return FieldType.DOUBLE; + case BOOLEAN: + return FieldType.BOOLEAN; + case KEYWORD: + return FieldType.KEYWORD; + case TEXT: + return FieldType.TEXT; + case NESTED: + return FieldType.NESTED; + case GEO_POINT: + return FieldType.GEO_POINT; + default: + throw new IllegalArgumentException("Unknown fieldType: " + fieldType.name()); + } + } + + public static IndexOptions toIndexOptions(Search.IndexOptions indexOptions) { + switch (indexOptions) { + case DOCS: + return IndexOptions.DOCS; + case FREQS: + return IndexOptions.FREQS; + case POSITIONS: + return IndexOptions.POSITIONS; + case OFFSETS: + return IndexOptions.OFFSETS; + default: + throw new IllegalArgumentException("Unknown indexOptions: " + indexOptions.name()); + } + } + + public static FieldSchema toFieldSchema(Search.FieldSchema fieldSchema) { + FieldSchema result = new FieldSchema(fieldSchema.getFieldName(), + toFieldType(fieldSchema.getFieldType())); + if (fieldSchema.hasIndex()) { + result.setIndex(fieldSchema.getIndex()); + } else { + result.setIndex(false); + } + if (fieldSchema.hasDocValues()) { + result.setEnableSortAndAgg(fieldSchema.getDocValues()); + } else { + result.setEnableSortAndAgg(false); + } + if (fieldSchema.hasStore()) { + result.setStore(fieldSchema.getStore()); + } else { + result.setStore(false); + } + if (fieldSchema.hasIsArray()) { + result.setIsArray(fieldSchema.getIsArray()); + } else { + result.setIsArray(false); + } + if (fieldSchema.hasIndexOptions()) { + result.setIndexOptions(toIndexOptions(fieldSchema.getIndexOptions())); + } + if (fieldSchema.hasAnalyzer()) { + result.setAnalyzer(FieldSchema.Analyzer.fromString(fieldSchema.getAnalyzer())); + } + if (fieldSchema.getFieldSchemasList() != null) { + List subSchemas = new ArrayList(); + for (Search.FieldSchema subSchema : fieldSchema.getFieldSchemasList()) { + subSchemas.add(toFieldSchema(subSchema)); + } + result.setSubFieldSchemas(subSchemas); + } + return result; + } + + public static IndexSetting toIndexSetting(Search.IndexSetting indexSetting) { + IndexSetting result = new IndexSetting(); + if (indexSetting.getRoutingFieldsCount() > 0) { + result.setRoutingFields(indexSetting.getRoutingFieldsList()); + } + return result; + } + + public static Sort toIndexSort(Search.Sort sort) { + if (sort.getSorterCount() == 0) { + return null; + } + List sorters = new ArrayList(); + for (Search.Sorter sorter : sort.getSorterList()) { + if (sorter.hasFieldSort()) { + Search.FieldSort pbFieldSort = sorter.getFieldSort(); + FieldSort fieldSort = new FieldSort(pbFieldSort.getFieldName()); + if (pbFieldSort.hasOrder()) { + if (pbFieldSort.getOrder().equals(Search.SortOrder.SORT_ORDER_ASC)) { + fieldSort.setOrder(SortOrder.ASC); + } else { + fieldSort.setOrder(SortOrder.DESC); + } + } + sorters.add(fieldSort); + } else if (sorter.hasPkSort()) { + Search.PrimaryKeySort pbPkSort = sorter.getPkSort(); + PrimaryKeySort pkSort = new PrimaryKeySort(); + if (pbPkSort.hasOrder()) { + if (pbPkSort.getOrder().equals(Search.SortOrder.SORT_ORDER_ASC)) { + pkSort.setOrder(SortOrder.ASC); + } else { + pkSort.setOrder(SortOrder.DESC); + } + } + sorters.add(pkSort); + } else { + throw new ClientException("failed to parse index_sort in response"); + } + } + return new Sort(sorters); + } + + public static IndexSchema toIndexSchema(Search.IndexSchema indexSchema) { + IndexSchema result = new IndexSchema(); + result.setIndexSetting(toIndexSetting(indexSchema.getIndexSetting())); + List fieldSchemas = new ArrayList(); + for (Search.FieldSchema fieldSchema : indexSchema.getFieldSchemasList()) { + fieldSchemas.add(toFieldSchema(fieldSchema)); + } + result.setFieldSchemas(fieldSchemas); + if (indexSchema.hasIndexSort()) { + result.setIndexSort(toIndexSort(indexSchema.getIndexSort())); + } + return result; + } + + public static SyncStat toSyncStat(Search.SyncStat syncStat) { + SyncStat result = new SyncStat(); + if (!syncStat.hasSyncPhase()) { + throw new ClientException("missing [SyncPhase] in SyncStat"); + } + switch (syncStat.getSyncPhase()) { + case FULL: + result.setSyncPhase(SyncStat.SyncPhase.FULL); + break; + case INCR: + result.setSyncPhase(SyncStat.SyncPhase.INCR); + break; + default: + throw new ClientException("unknown SyncPhase: " + syncStat.getSyncPhase().name()); + } + if (syncStat.hasCurrentSyncTimestamp()) { + result.setCurrentSyncTimestamp(syncStat.getCurrentSyncTimestamp()); + } + return result; + } + + public static MeteringInfo toMeteringInfo(Search.MeteringInfo meteringInfo) { + MeteringInfo result = new MeteringInfo(); + if (meteringInfo.hasReservedReadCu()) { + result.setReservedThroughput(new ReservedThroughput( + new CapacityUnit((int) meteringInfo.getReservedReadCu(), 0))); + } + if (meteringInfo.hasStorageSize()) { + result.setStorageSize(meteringInfo.getStorageSize()); + } + if (meteringInfo.hasDocCount()) { + result.setDocCount(meteringInfo.getDocCount()); + } + if (meteringInfo.hasTimestamp()) { + result.setTimestamp(meteringInfo.getTimestamp()); + } + return result; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchQueryBuilder.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchQueryBuilder.java new file mode 100644 index 0000000..87a172a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchQueryBuilder.java @@ -0,0 +1,228 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.search.query.*; +import com.google.protobuf.ByteString; + +public class SearchQueryBuilder { + + public static Search.QueryType buildQueryType(QueryType type) { + switch (type) { + case QueryType_MatchQuery: + return Search.QueryType.MATCH_QUERY; + case QueryType_MatchPhraseQuery: + return Search.QueryType.MATCH_PHRASE_QUERY; + case QueryType_TermQuery: + return Search.QueryType.TERM_QUERY; + case QueryType_TermsQuery: + return Search.QueryType.TERMS_QUERY; + case QueryType_RangeQuery: + return Search.QueryType.RANGE_QUERY; + case QueryType_PrefixQuery: + return Search.QueryType.PREFIX_QUERY; + case QueryType_BoolQuery: + return Search.QueryType.BOOL_QUERY; + case QueryType_ConstScoreQuery: + return Search.QueryType.CONST_SCORE_QUERY; + case QueryType_FunctionScoreQuery: + return Search.QueryType.FUNCTION_SCORE_QUERY; + case QueryType_NestedQuery: + return Search.QueryType.NESTED_QUERY; + case QueryType_WildcardQuery: + return Search.QueryType.WILDCARD_QUERY; + case QueryType_MatchAllQuery: + return Search.QueryType.MATCH_ALL_QUERY; + case QueryType_GeoBoundingBoxQuery: + return Search.QueryType.GEO_BOUNDING_BOX_QUERY; + case QueryType_GeoDistanceQuery: + return Search.QueryType.GEO_DISTANCE_QUERY; + case QueryType_GeoPolygonQuery: + return Search.QueryType.GEO_POLYGON_QUERY; + default: + throw new IllegalArgumentException("unknown queryType: " + type.name()); + } + } + + public static Search.Query buildQuery(Query query) { + Search.Query.Builder builder = Search.Query.newBuilder(); + builder.setType(buildQueryType(query.getQueryType())); + builder.setQuery(query.serialize()); + return builder.build(); + } + + public static Search.MatchAllQuery buildMatchAllQuery() { + Search.MatchAllQuery.Builder builder = Search.MatchAllQuery.newBuilder(); + return builder.build(); + } + + public static Search.MatchQuery buildMatchQuery(MatchQuery query) { + Search.MatchQuery.Builder builder = Search.MatchQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.setText(query.getText()); + if (query.getMinimumShouldMatch() != null) { + builder.setMinimumShouldMatch(query.getMinimumShouldMatch()); + } + if (query.getOperator() != null) { + switch (query.getOperator()) { + case OR: + builder.setOperator(Search.QueryOperator.OR); + break; + case AND: + builder.setOperator(Search.QueryOperator.AND); + break; + default: + throw new IllegalArgumentException("unsupported operator: " + query.getOperator()); + } + } + return builder.build(); + } + + public static Search.MatchPhraseQuery buildMatchPhraseQuery(MatchPhraseQuery query) { + Search.MatchPhraseQuery.Builder builder = Search.MatchPhraseQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.setText(query.getText()); + return builder.build(); + } + + public static Search.TermQuery buildTermQuery(TermQuery query) { + Search.TermQuery.Builder builder = Search.TermQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.setTerm(ByteString.copyFrom(SearchVariantType.toVariant(query.getTerm()))); + return builder.build(); + } + + public static Search.TermsQuery buildTermsQuery(TermsQuery query) { + Search.TermsQuery.Builder builder = Search.TermsQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + if (query.getTerms() == null) { + throw new IllegalArgumentException("terms is null"); + } + for (ColumnValue term : query.getTerms()) { + builder.addTerms(ByteString.copyFrom(SearchVariantType.toVariant(term))); + } + return builder.build(); + } + + public static Search.RangeQuery buildRangeQuery(RangeQuery query) { + Search.RangeQuery.Builder builder = Search.RangeQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + if (query.getFrom() != null) { + builder.setRangeFrom(ByteString.copyFrom(SearchVariantType.toVariant(query.getFrom()))); + builder.setIncludeLower(query.isIncludeLower()); + } + if (query.getTo() != null) { + builder.setRangeTo(ByteString.copyFrom(SearchVariantType.toVariant(query.getTo()))); + builder.setIncludeUpper(query.isIncludeUpper()); + } + return builder.build(); + } + + public static Search.PrefixQuery buildPrefixQuery(PrefixQuery query) { + Search.PrefixQuery.Builder builder = Search.PrefixQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.setPrefix(query.getPrefix()); + return builder.build(); + } + + public static Search.WildcardQuery buildWildcardQuery(WildcardQuery query) { + Search.WildcardQuery.Builder builder = Search.WildcardQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.setValue(query.getValue()); + return builder.build(); + } + + public static Search.BoolQuery buildBoolQuery(BoolQuery query) { + Search.BoolQuery.Builder builder = Search.BoolQuery.newBuilder(); + if (query.getMinimumShouldMatch() != null) { + builder.setMinimumShouldMatch(query.getMinimumShouldMatch()); + } + if (query.getMustQueries() != null) { + for (Query q : query.getMustQueries()) { + builder.addMustQueries(buildQuery(q)); + } + } + if (query.getMustNotQueries() != null) { + for (Query q : query.getMustNotQueries()) { + builder.addMustNotQueries(buildQuery(q)); + } + } + if (query.getShouldQueries() != null) { + for (Query q : query.getShouldQueries()) { + builder.addShouldQueries(buildQuery(q)); + } + } + if (query.getFilterQueries() != null) { + for (Query q : query.getFilterQueries()) { + builder.addFilterQueries(buildQuery(q)); + } + } + return builder.build(); + } + + public static Search.ConstScoreQuery buildConstScoreQuery(ConstScoreQuery query) { + Search.ConstScoreQuery.Builder builder = Search.ConstScoreQuery.newBuilder(); + builder.setFilter(SearchQueryBuilder.buildQuery(query.getFilter())); + return builder.build(); + } + + public static Search.FieldValueFactor buildFieldValueFactor(FieldValueFactor fieldValueFactor) { + Search.FieldValueFactor.Builder builder = Search.FieldValueFactor.newBuilder(); + builder.setFieldName(fieldValueFactor.getFieldName()); + return builder.build(); + } + + public static Search.FunctionScoreQuery buildFunctionScoreQuery(FunctionScoreQuery query) { + Search.FunctionScoreQuery.Builder builder = Search.FunctionScoreQuery.newBuilder(); + builder.setQuery(SearchQueryBuilder.buildQuery(query.getQuery())); + builder.setFieldValueFactor(buildFieldValueFactor(query.getFieldValueFactor())); + return builder.build(); + } + + public static Search.ScoreMode buildScoreMode(ScoreMode scoreMode) { + switch (scoreMode) { + case Max: + return Search.ScoreMode.SCORE_MODE_MAX; + case Min: + return Search.ScoreMode.SCORE_MODE_MIN; + case Avg: + return Search.ScoreMode.SCORE_MODE_AVG; + case Total: + return Search.ScoreMode.SCORE_MODE_TOTAL; + case None: + return Search.ScoreMode.SCORE_MODE_NONE; + default: + throw new IllegalArgumentException("unknown scoreMode: " + scoreMode.name()); + } + } + + public static Search.NestedQuery buildNestedQuery(NestedQuery query) { + Search.NestedQuery.Builder builder = Search.NestedQuery.newBuilder(); + builder.setQuery(SearchQueryBuilder.buildQuery(query.getQuery())); + builder.setPath(query.getPath()); + builder.setScoreMode(buildScoreMode(query.getScoreMode())); + return builder.build(); + } + + public static Search.GeoBoundingBoxQuery buildGeoBoundingBoxQuery(GeoBoundingBoxQuery query) { + Search.GeoBoundingBoxQuery.Builder builder = Search.GeoBoundingBoxQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.setTopLeft(query.getTopLeft()); + builder.setBottomRight(query.getBottomRight()); + return builder.build(); + } + + public static Search.GeoDistanceQuery buildGeoDistanceQuery(GeoDistanceQuery query) { + Search.GeoDistanceQuery.Builder builder = Search.GeoDistanceQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.setCenterPoint(query.getCenterPoint()); + builder.setDistance(query.getDistanceInMeter()); + return builder.build(); + } + + public static Search.GeoPolygonQuery buildGeoPolygonQuery(GeoPolygonQuery query) { + Search.GeoPolygonQuery.Builder builder = Search.GeoPolygonQuery.newBuilder(); + builder.setFieldName(query.getFieldName()); + builder.addAllPoints(query.getPoints()); + return builder.build(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchSortBuilder.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchSortBuilder.java new file mode 100644 index 0000000..64a3b4e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchSortBuilder.java @@ -0,0 +1,121 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.model.search.sort.*; + +public class SearchSortBuilder { + + public static Search.SortOrder buildSortOrder(SortOrder sortOrder) { + switch (sortOrder) { + case ASC: + return Search.SortOrder.SORT_ORDER_ASC; + case DESC: + return Search.SortOrder.SORT_ORDER_DESC; + default: + throw new IllegalArgumentException("Unknown sortOrder:" + sortOrder.name()); + } + } + + public static Search.SortMode buildSortMode(SortMode sortMode) { + switch (sortMode) { + case MIN: + return Search.SortMode.SORT_MODE_MIN; + case MAX: + return Search.SortMode.SORT_MODE_MAX; + case AVG: + return Search.SortMode.SORT_MODE_AVG; + default: + throw new IllegalArgumentException("Unknown sortMode:" + sortMode.name()); + } + } + + public static Search.NestedFilter buildNestedFilter(NestedFilter nestedFilter) { + Search.NestedFilter.Builder builder = Search.NestedFilter.newBuilder(); + builder.setPath(nestedFilter.getPath()); + builder.setFilter(SearchQueryBuilder.buildQuery(nestedFilter.getQuery())); + return builder.build(); + } + + public static Search.FieldSort buildFieldSort(FieldSort fieldSort) { + Search.FieldSort.Builder builder = Search.FieldSort.newBuilder(); + builder.setFieldName(fieldSort.getFieldName()); + if (fieldSort.getOrder() != null) { + builder.setOrder(buildSortOrder(fieldSort.getOrder())); + } + if (fieldSort.getMode() != null) { + builder.setMode(buildSortMode(fieldSort.getMode())); + } + if (fieldSort.getNestedFilter() != null) { + builder.setNestedFilter(buildNestedFilter(fieldSort.getNestedFilter())); + } + return builder.build(); + } + + public static Search.ScoreSort buildScoreSort(ScoreSort scoreSort) { + Search.ScoreSort.Builder builder = Search.ScoreSort.newBuilder(); + builder.setOrder(buildSortOrder(scoreSort.getOrder())); + return builder.build(); + } + + public static Search.GeoDistanceType buildGeoDistanceType(GeoDistanceType geoDistanceType) { + switch (geoDistanceType) { + case ARC: + return Search.GeoDistanceType.GEO_DISTANCE_ARC; + case PLANE: + return Search.GeoDistanceType.GEO_DISTANCE_PLANE; + default: + throw new IllegalArgumentException("unknown geoDistanceType: " + geoDistanceType.name()); + } + } + + public static Search.GeoDistanceSort buildGeoDistanceSort(GeoDistanceSort geoDistanceSort) { + Search.GeoDistanceSort.Builder builder = Search.GeoDistanceSort.newBuilder(); + builder.setFieldName(geoDistanceSort.getFieldName()); + if (geoDistanceSort.getPoints() != null) { + builder.addAllPoints(geoDistanceSort.getPoints()); + } + if (geoDistanceSort.getOrder() != null) { + builder.setOrder(buildSortOrder(geoDistanceSort.getOrder())); + } + if (geoDistanceSort.getMode() != null) { + builder.setMode(buildSortMode(geoDistanceSort.getMode())); + } + if (geoDistanceSort.getDistanceType() != null) { + builder.setDistanceType(buildGeoDistanceType(geoDistanceSort.getDistanceType())); + } + if (geoDistanceSort.getNestedFilter() != null) { + builder.setNestedFilter(buildNestedFilter(geoDistanceSort.getNestedFilter())); + } + return builder.build(); + } + + public static Search.PrimaryKeySort buildPrimaryKeySort(PrimaryKeySort primaryKeySort) { + Search.PrimaryKeySort.Builder builder = Search.PrimaryKeySort.newBuilder(); + builder.setOrder(buildSortOrder(primaryKeySort.getOrder())); + return builder.build(); + } + + public static Search.Sorter buildSorter(Sort.Sorter sorter) { + Search.Sorter.Builder builder = Search.Sorter.newBuilder(); + if (sorter instanceof FieldSort) { + builder.setFieldSort(buildFieldSort((FieldSort) sorter)); + } else if (sorter instanceof ScoreSort) { + builder.setScoreSort(buildScoreSort((ScoreSort) sorter)); + } else if (sorter instanceof GeoDistanceSort) { + builder.setGeoDistanceSort(buildGeoDistanceSort((GeoDistanceSort) sorter)); + } else if (sorter instanceof PrimaryKeySort) { + builder.setPkSort(buildPrimaryKeySort((PrimaryKeySort) sorter)); + } else { + throw new IllegalArgumentException("Unknown sorter type: " + sorter.getClass()); + } + return builder.build(); + } + + public static Search.Sort buildSort(Sort sort) { + Search.Sort.Builder builder = Search.Sort.newBuilder(); + for (Sort.Sorter sorter : sort.getSorters()) { + builder.addSorter(buildSorter(sorter)); + } + return builder.build(); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchVariantType.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchVariantType.java new file mode 100644 index 0000000..daf7d55 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/SearchVariantType.java @@ -0,0 +1,104 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.model.ColumnValue; + +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +public class SearchVariantType { + + enum VariantType { + INTEGER, + DOUBLE, + BOOLEAN, + STRING + } + + // variant type + public final static byte VT_INTEGER = 0x0; + public final static byte VT_DOUBLE = 0x1; + public final static byte VT_BOOLEAN = 0x2; + public final static byte VT_STRING = 0x3; + + public static VariantType GetVariantType(byte[] data) { + if (data[0] == VT_INTEGER) { + return VariantType.INTEGER; + } else if (data[0] == VT_DOUBLE) { + return VariantType.DOUBLE; + } else if (data[0] == VT_BOOLEAN) { + return VariantType.BOOLEAN; + } else if (data[0] == VT_STRING) { + return VariantType.STRING; + } else { + throw new IllegalArgumentException("unknown type: " + data[0]); + } + } + + public static long asLong(byte[] data) { + return ByteBuffer.wrap(data, 1, 8).order(ByteOrder.LITTLE_ENDIAN).getLong(); + } + + public static byte[] fromLong(long v) { + ByteBuffer buffer = ByteBuffer.allocate(9).order(ByteOrder.LITTLE_ENDIAN); + return buffer.put(VT_INTEGER).putLong(v).array(); + } + + public static double asDouble(byte[] data) { + return ByteBuffer.wrap(data, 1, 8).order(ByteOrder.LITTLE_ENDIAN).getDouble(); + } + + public static byte[] fromDouble(double v) { + ByteBuffer buffer = ByteBuffer.allocate(9).order(ByteOrder.LITTLE_ENDIAN); + return buffer.put(VT_DOUBLE).putDouble(v).array(); + } + + public static String asString(byte[] data) { + int length = ByteBuffer.wrap(data, 1, 4).order(ByteOrder.LITTLE_ENDIAN).getInt(); + return new String(data, 5, length, Constants.UTF8_CHARSET); + } + + public static byte[] fromString(String v) { + byte[] vBytes = v.getBytes(Constants.UTF8_CHARSET); + ByteBuffer buffer = ByteBuffer.allocate(1 + 4 + vBytes.length).order(ByteOrder.LITTLE_ENDIAN); + return buffer.put(VT_STRING).putInt(vBytes.length).put(vBytes).array(); + } + + public static boolean asBoolean(byte[] data) { + return data[1] != 0; + } + + public static byte[] fromBoolean(boolean v) { + return new byte[]{VT_BOOLEAN, (byte) (v?1:0)}; + } + + public static Object getValue(byte[] data) { + if (data[0] == VT_INTEGER) { + return asLong(data); + } else if (data[0] == VT_DOUBLE) { + return asDouble(data); + } else if (data[0] == VT_STRING) { + return asString(data); + } else if (data[0] == VT_BOOLEAN) { + return asBoolean(data); + } else { + throw new IllegalArgumentException("unknown type: " + data[0]); + } + } + + public static byte[] toVariant(ColumnValue value) { + switch (value.getType()) { + case STRING: + return fromString(value.asString()); + case INTEGER: + return fromLong(value.asLong()); + case DOUBLE: + return fromDouble(value.asDouble()); + case BOOLEAN: + return fromBoolean(value.asBoolean()); + default: + throw new IllegalArgumentException("unsupported type:" + value.getType().name()); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelProtocolBuilder.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelProtocolBuilder.java new file mode 100644 index 0000000..3acc35d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelProtocolBuilder.java @@ -0,0 +1,155 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import java.util.ArrayList; +import java.util.List; + +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelType; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelClientConfig; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; + +public class TunnelProtocolBuilder { + public static TunnelServiceApi.TunnelType buildTunnelType(TunnelType tunnelType) { + switch (tunnelType) { + case BaseData: + return TunnelServiceApi.TunnelType.BaseData; + case Stream: + return TunnelServiceApi.TunnelType.Stream; + case BaseAndStream: + return TunnelServiceApi.TunnelType.BaseAndStream; + default: + throw new IllegalArgumentException("unknown tunnelType: " + tunnelType.name()); + } + } + + public static TunnelServiceApi.Tunnel buildTunnel(String tableName, String tunnelName, TunnelType tunnelType) { + TunnelServiceApi.Tunnel.Builder builder = TunnelServiceApi.Tunnel.newBuilder(); + builder.setTableName(tableName); + builder.setTunnelName(tunnelName); + builder.setTunnelType(buildTunnelType(tunnelType)); + return builder.build(); + } + + public static TunnelServiceApi.CreateTunnelRequest buildCreateTunnelRequest(CreateTunnelRequest request) { + TunnelServiceApi.CreateTunnelRequest.Builder builder = TunnelServiceApi.CreateTunnelRequest.newBuilder(); + builder.setTunnel(buildTunnel(request.getTableName(), request.getTunnelName(), request.getTunnelType())); + return builder.build(); + } + + public static TunnelServiceApi.ListTunnelRequest buildListTunnelRequest(ListTunnelRequest request) { + TunnelServiceApi.ListTunnelRequest.Builder builder = TunnelServiceApi.ListTunnelRequest.newBuilder(); + builder.setTableName(request.getTableName()); + return builder.build(); + } + + public static TunnelServiceApi.DescribeTunnelRequest buildDescribeTunnelRequest(DescribeTunnelRequest request) { + TunnelServiceApi.DescribeTunnelRequest.Builder builder = TunnelServiceApi.DescribeTunnelRequest.newBuilder(); + builder.setTableName(request.getTableName()); + builder.setTunnelName(request.getTunnelName()); + return builder.build(); + } + + public static TunnelServiceApi.DeleteTunnelRequest buildDeleteTunnelRequest(DeleteTunnelRequest request) { + TunnelServiceApi.DeleteTunnelRequest.Builder builder = TunnelServiceApi.DeleteTunnelRequest.newBuilder(); + builder.setTableName(request.getTableName()); + builder.setTunnelName(request.getTunnelName()); + return builder.build(); + } + + public static TunnelServiceApi.ClientConfig buildClientConfig(TunnelClientConfig config) { + TunnelServiceApi.ClientConfig.Builder builder = TunnelServiceApi.ClientConfig.newBuilder(); + builder.setTimeout(config.getTimeout()); + builder.setClientTag(config.getClientTag()); + return builder.build(); + } + + public static TunnelServiceApi.ConnectRequest buildConnectTunnelRequest(ConnectTunnelRequest request) { + TunnelServiceApi.ConnectRequest.Builder builder = TunnelServiceApi.ConnectRequest.newBuilder(); + builder.setTunnelId(request.getTunnelId()); + builder.setClientConfig(buildClientConfig(request.getConfig())); + return builder.build(); + } + + public static TunnelServiceApi.ChannelStatus buildChannelStatus(ChannelStatus status) { + switch (status) { + case OPEN: + return TunnelServiceApi.ChannelStatus.OPEN; + case CLOSING: + return TunnelServiceApi.ChannelStatus.CLOSING; + case CLOSE: + return TunnelServiceApi.ChannelStatus.CLOSE; + case TERMINATED: + return TunnelServiceApi.ChannelStatus.TERMINATED; + default: + throw new IllegalArgumentException("unknown channel status: " + status.name()); + } + } + + public static TunnelServiceApi.Channel buildChannel(Channel channel) { + TunnelServiceApi.Channel.Builder builder = TunnelServiceApi.Channel.newBuilder(); + builder.setChannelId(channel.getChannelId()); + builder.setVersion(channel.getVersion()); + builder.setStatus(buildChannelStatus(channel.getStatus())); + return builder.build(); + } + + public static List buildChannels(List channels) { + List retList = new ArrayList(); + for (Channel channel : channels) { + retList.add(buildChannel(channel)); + } + return retList; + } + + public static TunnelServiceApi.HeartbeatRequest buildHeartbeatRequest(HeartbeatRequest request) { + TunnelServiceApi.HeartbeatRequest.Builder builder = TunnelServiceApi.HeartbeatRequest.newBuilder(); + builder.setTunnelId(request.getTunnelId()); + builder.setClientId(request.getClientId()); + builder.addAllChannels(buildChannels(request.getChannels())); + return builder.build(); + } + + public static TunnelServiceApi.ShutdownRequest buildShutdownTunnelRequest(ShutdownTunnelRequest request) { + TunnelServiceApi.ShutdownRequest.Builder builder = TunnelServiceApi.ShutdownRequest.newBuilder(); + builder.setTunnelId(request.getTunnelId()); + builder.setClientId(request.getClientId()); + return builder.build(); + } + + public static TunnelServiceApi.GetCheckpointRequest buildGetCheckpointRequest(GetCheckpointRequest request) { + TunnelServiceApi.GetCheckpointRequest.Builder builder = TunnelServiceApi.GetCheckpointRequest.newBuilder(); + builder.setTunnelId(request.getTunnelId()); + builder.setClientId(request.getClientId()); + builder.setChannelId(request.getChannelId()); + return builder.build(); + } + + public static TunnelServiceApi.ReadRecordsRequest buildReadRecordsRequest(ReadRecordsRequest request) { + TunnelServiceApi.ReadRecordsRequest.Builder builder = TunnelServiceApi.ReadRecordsRequest.newBuilder(); + builder.setTunnelId(request.getTunneId()); + builder.setClientId(request.getClientId()); + builder.setChannelId(request.getChannelId()); + builder.setToken(request.getToken()); + return builder.build(); + } + + public static TunnelServiceApi.CheckpointRequest buildCheckpointRequest(CheckpointRequest request) { + TunnelServiceApi.CheckpointRequest.Builder builder = TunnelServiceApi.CheckpointRequest.newBuilder(); + builder.setTunnelId(request.getTunnelId()); + builder.setClientId(request.getClientId()); + builder.setChannelId(request.getChannelId()); + builder.setCheckpoint(request.getCheckpoint()); + builder.setSequenceNumber(request.getSequenceNumber()); + return builder.build(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelServiceApi.java b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelServiceApi.java new file mode 100644 index 0000000..addccdb --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/TunnelServiceApi.java @@ -0,0 +1,19882 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tunnel_service_api.proto + +package com.alicloud.openservices.tablestore.core.protocol; + +public final class TunnelServiceApi { + private TunnelServiceApi() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public enum TunnelType + implements com.google.protobuf.ProtocolMessageEnum { + BaseData(0, 1), + Stream(1, 2), + BaseAndStream(2, 3), + ; + + public static final int BaseData_VALUE = 1; + public static final int Stream_VALUE = 2; + public static final int BaseAndStream_VALUE = 3; + + + public final int getNumber() { return value; } + + public static TunnelType valueOf(int value) { + switch (value) { + case 1: return BaseData; + case 2: return Stream; + case 3: return BaseAndStream; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public TunnelType findValueByNumber(int number) { + return TunnelType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.getDescriptor().getEnumTypes().get(0); + } + + private static final TunnelType[] VALUES = { + BaseData, Stream, BaseAndStream, + }; + + public static TunnelType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private TunnelType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.TunnelType) + } + + public enum ChannelStatus + implements com.google.protobuf.ProtocolMessageEnum { + OPEN(0, 1), + CLOSING(1, 2), + CLOSE(2, 3), + TERMINATED(3, 4), + ; + + public static final int OPEN_VALUE = 1; + public static final int CLOSING_VALUE = 2; + public static final int CLOSE_VALUE = 3; + public static final int TERMINATED_VALUE = 4; + + + public final int getNumber() { return value; } + + public static ChannelStatus valueOf(int value) { + switch (value) { + case 1: return OPEN; + case 2: return CLOSING; + case 3: return CLOSE; + case 4: return TERMINATED; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ChannelStatus findValueByNumber(int number) { + return ChannelStatus.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.getDescriptor().getEnumTypes().get(1); + } + + private static final ChannelStatus[] VALUES = { + OPEN, CLOSING, CLOSE, TERMINATED, + }; + + public static ChannelStatus valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private ChannelStatus(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ChannelStatus) + } + + public enum ActionType + implements com.google.protobuf.ProtocolMessageEnum { + PUT_ROW(0, 1), + UPDATE_ROW(1, 2), + DELETE_ROW(2, 3), + ; + + public static final int PUT_ROW_VALUE = 1; + public static final int UPDATE_ROW_VALUE = 2; + public static final int DELETE_ROW_VALUE = 3; + + + public final int getNumber() { return value; } + + public static ActionType valueOf(int value) { + switch (value) { + case 1: return PUT_ROW; + case 2: return UPDATE_ROW; + case 3: return DELETE_ROW; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ActionType findValueByNumber(int number) { + return ActionType.valueOf(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(index); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.getDescriptor().getEnumTypes().get(2); + } + + private static final ActionType[] VALUES = { + PUT_ROW, UPDATE_ROW, DELETE_ROW, + }; + + public static ActionType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + return VALUES[desc.getIndex()]; + } + + private final int index; + private final int value; + + private ActionType(int index, int value) { + this.index = index; + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.alicloud.openservices.tablestore.core.protocol.ActionType) + } + + public interface ErrorOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string code = 1; + boolean hasCode(); + String getCode(); + + // optional string message = 2; + boolean hasMessage(); + String getMessage(); + + // optional string tunnel_id = 3; + boolean hasTunnelId(); + String getTunnelId(); + } + public static final class Error extends + com.google.protobuf.GeneratedMessage + implements ErrorOrBuilder { + // Use Error.newBuilder() to construct. + private Error(Builder builder) { + super(builder); + } + private Error(boolean noInit) {} + + private static final Error defaultInstance; + public static Error getDefaultInstance() { + return defaultInstance; + } + + public Error getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; + } + + private int bitField0_; + // required string code = 1; + public static final int CODE_FIELD_NUMBER = 1; + private java.lang.Object code_; + public boolean hasCode() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getCode() { + java.lang.Object ref = code_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + code_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getCodeBytes() { + java.lang.Object ref = code_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + code_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string message = 2; + public static final int MESSAGE_FIELD_NUMBER = 2; + private java.lang.Object message_; + public boolean hasMessage() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getMessage() { + java.lang.Object ref = message_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + message_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string tunnel_id = 3; + public static final int TUNNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + code_ = ""; + message_ = ""; + tunnelId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasCode()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getCodeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getMessageBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTunnelIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getCodeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getMessageBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTunnelIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ErrorOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + code_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + message_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.code_ = code_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.message_ = message_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.tunnelId_ = tunnelId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.getDefaultInstance()) return this; + if (other.hasCode()) { + setCode(other.getCode()); + } + if (other.hasMessage()) { + setMessage(other.getMessage()); + } + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasCode()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + code_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + message_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + tunnelId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string code = 1; + private java.lang.Object code_ = ""; + public boolean hasCode() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getCode() { + java.lang.Object ref = code_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + code_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setCode(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + code_ = value; + onChanged(); + return this; + } + public Builder clearCode() { + bitField0_ = (bitField0_ & ~0x00000001); + code_ = getDefaultInstance().getCode(); + onChanged(); + return this; + } + void setCode(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + code_ = value; + onChanged(); + } + + // optional string message = 2; + private java.lang.Object message_ = ""; + public boolean hasMessage() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getMessage() { + java.lang.Object ref = message_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + message_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setMessage(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + message_ = value; + onChanged(); + return this; + } + public Builder clearMessage() { + bitField0_ = (bitField0_ & ~0x00000002); + message_ = getDefaultInstance().getMessage(); + onChanged(); + return this; + } + void setMessage(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + message_ = value; + onChanged(); + } + + // optional string tunnel_id = 3; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000004); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + tunnelId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Error) + } + + static { + defaultInstance = new Error(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Error) + } + + public interface TunnelOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required string tunnel_name = 3; + boolean hasTunnelName(); + String getTunnelName(); + + // required .com.alicloud.openservices.tablestore.core.protocol.TunnelType tunnel_type = 4; + boolean hasTunnelType(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType getTunnelType(); + } + public static final class Tunnel extends + com.google.protobuf.GeneratedMessage + implements TunnelOrBuilder { + // Use Tunnel.newBuilder() to construct. + private Tunnel(Builder builder) { + super(builder); + } + private Tunnel(boolean noInit) {} + + private static final Tunnel defaultInstance; + public static Tunnel getDefaultInstance() { + return defaultInstance; + } + + public Tunnel getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string tunnel_name = 3; + public static final int TUNNEL_NAME_FIELD_NUMBER = 3; + private java.lang.Object tunnelName_; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelNameBytes() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required .com.alicloud.openservices.tablestore.core.protocol.TunnelType tunnel_type = 4; + public static final int TUNNEL_TYPE_FIELD_NUMBER = 4; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType tunnelType_; + public boolean hasTunnelType() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType getTunnelType() { + return tunnelType_; + } + + private void initFields() { + tableName_ = ""; + tunnelName_ = ""; + tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTunnelName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTunnelType()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(3, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(4, tunnelType_.getNumber()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, tunnelType_.getNumber()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + tunnelName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.tunnelName_ = tunnelName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.tunnelType_ = tunnelType_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasTunnelName()) { + setTunnelName(other.getTunnelName()); + } + if (other.hasTunnelType()) { + setTunnelType(other.getTunnelType()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasTunnelName()) { + + return false; + } + if (!hasTunnelType()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000002; + tunnelName_ = input.readBytes(); + break; + } + case 32: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType value = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(4, rawValue); + } else { + bitField0_ |= 0x00000004; + tunnelType_ = value; + } + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required string tunnel_name = 3; + private java.lang.Object tunnelName_ = ""; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + tunnelName_ = value; + onChanged(); + return this; + } + public Builder clearTunnelName() { + bitField0_ = (bitField0_ & ~0x00000002); + tunnelName_ = getDefaultInstance().getTunnelName(); + onChanged(); + return this; + } + void setTunnelName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + tunnelName_ = value; + onChanged(); + } + + // required .com.alicloud.openservices.tablestore.core.protocol.TunnelType tunnel_type = 4; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; + public boolean hasTunnelType() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType getTunnelType() { + return tunnelType_; + } + public Builder setTunnelType(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + tunnelType_ = value; + onChanged(); + return this; + } + public Builder clearTunnelType() { + bitField0_ = (bitField0_ & ~0x00000004); + tunnelType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelType.BaseData; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Tunnel) + } + + static { + defaultInstance = new Tunnel(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Tunnel) + } + + public interface CreateTunnelRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.Tunnel tunnel = 1; + boolean hasTunnel(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getTunnel(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder getTunnelOrBuilder(); + } + public static final class CreateTunnelRequest extends + com.google.protobuf.GeneratedMessage + implements CreateTunnelRequestOrBuilder { + // Use CreateTunnelRequest.newBuilder() to construct. + private CreateTunnelRequest(Builder builder) { + super(builder); + } + private CreateTunnelRequest(boolean noInit) {} + + private static final CreateTunnelRequest defaultInstance; + public static CreateTunnelRequest getDefaultInstance() { + return defaultInstance; + } + + public CreateTunnelRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.Tunnel tunnel = 1; + public static final int TUNNEL_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel tunnel_; + public boolean hasTunnel() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getTunnel() { + return tunnel_; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder getTunnelOrBuilder() { + return tunnel_; + } + + private void initFields() { + tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnel()) { + memoizedIsInitialized = 0; + return false; + } + if (!getTunnel().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, tunnel_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tunnel_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTunnelFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tunnelBuilder_ == null) { + tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); + } else { + tunnelBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (tunnelBuilder_ == null) { + result.tunnel_ = tunnel_; + } else { + result.tunnel_ = tunnelBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.getDefaultInstance()) return this; + if (other.hasTunnel()) { + mergeTunnel(other.getTunnel()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnel()) { + + return false; + } + if (!getTunnel().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.newBuilder(); + if (hasTunnel()) { + subBuilder.mergeFrom(getTunnel()); + } + input.readMessage(subBuilder, extensionRegistry); + setTunnel(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.Tunnel tunnel = 1; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder> tunnelBuilder_; + public boolean hasTunnel() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel getTunnel() { + if (tunnelBuilder_ == null) { + return tunnel_; + } else { + return tunnelBuilder_.getMessage(); + } + } + public Builder setTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel value) { + if (tunnelBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tunnel_ = value; + onChanged(); + } else { + tunnelBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setTunnel( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder builderForValue) { + if (tunnelBuilder_ == null) { + tunnel_ = builderForValue.build(); + onChanged(); + } else { + tunnelBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel value) { + if (tunnelBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + tunnel_ != com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance()) { + tunnel_ = + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.newBuilder(tunnel_).mergeFrom(value).buildPartial(); + } else { + tunnel_ = value; + } + onChanged(); + } else { + tunnelBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearTunnel() { + if (tunnelBuilder_ == null) { + tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.getDefaultInstance(); + onChanged(); + } else { + tunnelBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder getTunnelBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getTunnelFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder getTunnelOrBuilder() { + if (tunnelBuilder_ != null) { + return tunnelBuilder_.getMessageOrBuilder(); + } else { + return tunnel_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder> + getTunnelFieldBuilder() { + if (tunnelBuilder_ == null) { + tunnelBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelOrBuilder>( + tunnel_, + getParentForChildren(), + isClean()); + tunnel_ = null; + } + return tunnelBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelRequest) + } + + static { + defaultInstance = new CreateTunnelRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelRequest) + } + + public interface CreateTunnelResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + } + public static final class CreateTunnelResponse extends + com.google.protobuf.GeneratedMessage + implements CreateTunnelResponseOrBuilder { + // Use CreateTunnelResponse.newBuilder() to construct. + private CreateTunnelResponse(Builder builder) { + super(builder); + } + private CreateTunnelResponse(boolean noInit) {} + + private static final CreateTunnelResponse defaultInstance; + public static CreateTunnelResponse getDefaultInstance() { + return defaultInstance; + } + + public CreateTunnelResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tunnelId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelResponse) + } + + static { + defaultInstance = new CreateTunnelResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CreateTunnelResponse) + } + + public interface DeleteTunnelRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required string tunnel_name = 2; + boolean hasTunnelName(); + String getTunnelName(); + + // optional string tunnel_id = 3; + boolean hasTunnelId(); + String getTunnelId(); + } + public static final class DeleteTunnelRequest extends + com.google.protobuf.GeneratedMessage + implements DeleteTunnelRequestOrBuilder { + // Use DeleteTunnelRequest.newBuilder() to construct. + private DeleteTunnelRequest(Builder builder) { + super(builder); + } + private DeleteTunnelRequest(boolean noInit) {} + + private static final DeleteTunnelRequest defaultInstance; + public static DeleteTunnelRequest getDefaultInstance() { + return defaultInstance; + } + + public DeleteTunnelRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string tunnel_name = 2; + public static final int TUNNEL_NAME_FIELD_NUMBER = 2; + private java.lang.Object tunnelName_; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelNameBytes() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string tunnel_id = 3; + public static final int TUNNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + tunnelName_ = ""; + tunnelId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTunnelName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTunnelIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTunnelIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + tunnelName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.tunnelName_ = tunnelName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.tunnelId_ = tunnelId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasTunnelName()) { + setTunnelName(other.getTunnelName()); + } + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasTunnelName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + tunnelName_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + tunnelId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required string tunnel_name = 2; + private java.lang.Object tunnelName_ = ""; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + tunnelName_ = value; + onChanged(); + return this; + } + public Builder clearTunnelName() { + bitField0_ = (bitField0_ & ~0x00000002); + tunnelName_ = getDefaultInstance().getTunnelName(); + onChanged(); + return this; + } + void setTunnelName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + tunnelName_ = value; + onChanged(); + } + + // optional string tunnel_id = 3; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000004); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + tunnelId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelRequest) + } + + static { + defaultInstance = new DeleteTunnelRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelRequest) + } + + public interface DeleteTunnelResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class DeleteTunnelResponse extends + com.google.protobuf.GeneratedMessage + implements DeleteTunnelResponseOrBuilder { + // Use DeleteTunnelResponse.newBuilder() to construct. + private DeleteTunnelResponse(Builder builder) { + super(builder); + } + private DeleteTunnelResponse(boolean noInit) {} + + private static final DeleteTunnelResponse defaultInstance; + public static DeleteTunnelResponse getDefaultInstance() { + return defaultInstance; + } + + public DeleteTunnelResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelResponse) + } + + static { + defaultInstance = new DeleteTunnelResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DeleteTunnelResponse) + } + + public interface ListTunnelRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string table_name = 1; + boolean hasTableName(); + String getTableName(); + } + public static final class ListTunnelRequest extends + com.google.protobuf.GeneratedMessage + implements ListTunnelRequestOrBuilder { + // Use ListTunnelRequest.newBuilder() to construct. + private ListTunnelRequest(Builder builder) { + super(builder); + } + private ListTunnelRequest(boolean noInit) {} + + private static final ListTunnelRequest defaultInstance; + public static ListTunnelRequest getDefaultInstance() { + return defaultInstance; + } + + public ListTunnelRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_fieldAccessorTable; + } + + private int bitField0_; + // optional string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelRequest) + } + + static { + defaultInstance = new ListTunnelRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelRequest) + } + + public interface TunnelInfoOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string tunnel_type = 2; + boolean hasTunnelType(); + String getTunnelType(); + + // required string table_name = 3; + boolean hasTableName(); + String getTableName(); + + // required string instance_name = 4; + boolean hasInstanceName(); + String getInstanceName(); + + // required string stream_id = 5; + boolean hasStreamId(); + String getStreamId(); + + // required string stage = 6; + boolean hasStage(); + String getStage(); + + // optional bool expired = 7; + boolean hasExpired(); + boolean getExpired(); + + // optional string tunnel_name = 8; + boolean hasTunnelName(); + String getTunnelName(); + + // optional bool public = 9; + boolean hasPublic(); + boolean getPublic(); + } + public static final class TunnelInfo extends + com.google.protobuf.GeneratedMessage + implements TunnelInfoOrBuilder { + // Use TunnelInfo.newBuilder() to construct. + private TunnelInfo(Builder builder) { + super(builder); + } + private TunnelInfo(boolean noInit) {} + + private static final TunnelInfo defaultInstance; + public static TunnelInfo getDefaultInstance() { + return defaultInstance; + } + + public TunnelInfo getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string tunnel_type = 2; + public static final int TUNNEL_TYPE_FIELD_NUMBER = 2; + private java.lang.Object tunnelType_; + public boolean hasTunnelType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelType() { + java.lang.Object ref = tunnelType_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelType_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelTypeBytes() { + java.lang.Object ref = tunnelType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string table_name = 3; + public static final int TABLE_NAME_FIELD_NUMBER = 3; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string instance_name = 4; + public static final int INSTANCE_NAME_FIELD_NUMBER = 4; + private java.lang.Object instanceName_; + public boolean hasInstanceName() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getInstanceName() { + java.lang.Object ref = instanceName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + instanceName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getInstanceNameBytes() { + java.lang.Object ref = instanceName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + instanceName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string stream_id = 5; + public static final int STREAM_ID_FIELD_NUMBER = 5; + private java.lang.Object streamId_; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + streamId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStreamIdBytes() { + java.lang.Object ref = streamId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + streamId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string stage = 6; + public static final int STAGE_FIELD_NUMBER = 6; + private java.lang.Object stage_; + public boolean hasStage() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public String getStage() { + java.lang.Object ref = stage_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + stage_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getStageBytes() { + java.lang.Object ref = stage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + stage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bool expired = 7; + public static final int EXPIRED_FIELD_NUMBER = 7; + private boolean expired_; + public boolean hasExpired() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public boolean getExpired() { + return expired_; + } + + // optional string tunnel_name = 8; + public static final int TUNNEL_NAME_FIELD_NUMBER = 8; + private java.lang.Object tunnelName_; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelNameBytes() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bool public = 9; + public static final int PUBLIC_FIELD_NUMBER = 9; + private boolean public_; + public boolean hasPublic() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public boolean getPublic() { + return public_; + } + + private void initFields() { + tunnelId_ = ""; + tunnelType_ = ""; + tableName_ = ""; + instanceName_ = ""; + streamId_ = ""; + stage_ = ""; + expired_ = false; + tunnelName_ = ""; + public_ = false; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTunnelType()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasInstanceName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasStreamId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasStage()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTunnelTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTableNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getInstanceNameBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(6, getStageBytes()); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBool(7, expired_); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeBytes(8, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + output.writeBool(9, public_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTunnelTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTableNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getInstanceNameBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, getStreamIdBytes()); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(6, getStageBytes()); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(7, expired_); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(8, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(9, public_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + tunnelType_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + instanceName_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + streamId_ = ""; + bitField0_ = (bitField0_ & ~0x00000010); + stage_ = ""; + bitField0_ = (bitField0_ & ~0x00000020); + expired_ = false; + bitField0_ = (bitField0_ & ~0x00000040); + tunnelName_ = ""; + bitField0_ = (bitField0_ & ~0x00000080); + public_ = false; + bitField0_ = (bitField0_ & ~0x00000100); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.tunnelType_ = tunnelType_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.instanceName_ = instanceName_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.streamId_ = streamId_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.stage_ = stage_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.expired_ = expired_; + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000080; + } + result.tunnelName_ = tunnelName_; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000100; + } + result.public_ = public_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasTunnelType()) { + setTunnelType(other.getTunnelType()); + } + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasInstanceName()) { + setInstanceName(other.getInstanceName()); + } + if (other.hasStreamId()) { + setStreamId(other.getStreamId()); + } + if (other.hasStage()) { + setStage(other.getStage()); + } + if (other.hasExpired()) { + setExpired(other.getExpired()); + } + if (other.hasTunnelName()) { + setTunnelName(other.getTunnelName()); + } + if (other.hasPublic()) { + setPublic(other.getPublic()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasTunnelType()) { + + return false; + } + if (!hasTableName()) { + + return false; + } + if (!hasInstanceName()) { + + return false; + } + if (!hasStreamId()) { + + return false; + } + if (!hasStage()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + tunnelType_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + tableName_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + instanceName_ = input.readBytes(); + break; + } + case 42: { + bitField0_ |= 0x00000010; + streamId_ = input.readBytes(); + break; + } + case 50: { + bitField0_ |= 0x00000020; + stage_ = input.readBytes(); + break; + } + case 56: { + bitField0_ |= 0x00000040; + expired_ = input.readBool(); + break; + } + case 66: { + bitField0_ |= 0x00000080; + tunnelName_ = input.readBytes(); + break; + } + case 72: { + bitField0_ |= 0x00000100; + public_ = input.readBool(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string tunnel_type = 2; + private java.lang.Object tunnelType_ = ""; + public boolean hasTunnelType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelType() { + java.lang.Object ref = tunnelType_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelType_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelType(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + tunnelType_ = value; + onChanged(); + return this; + } + public Builder clearTunnelType() { + bitField0_ = (bitField0_ & ~0x00000002); + tunnelType_ = getDefaultInstance().getTunnelType(); + onChanged(); + return this; + } + void setTunnelType(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + tunnelType_ = value; + onChanged(); + } + + // required string table_name = 3; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000004); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + tableName_ = value; + onChanged(); + } + + // required string instance_name = 4; + private java.lang.Object instanceName_ = ""; + public boolean hasInstanceName() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getInstanceName() { + java.lang.Object ref = instanceName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + instanceName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setInstanceName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + instanceName_ = value; + onChanged(); + return this; + } + public Builder clearInstanceName() { + bitField0_ = (bitField0_ & ~0x00000008); + instanceName_ = getDefaultInstance().getInstanceName(); + onChanged(); + return this; + } + void setInstanceName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + instanceName_ = value; + onChanged(); + } + + // required string stream_id = 5; + private java.lang.Object streamId_ = ""; + public boolean hasStreamId() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public String getStreamId() { + java.lang.Object ref = streamId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + streamId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStreamId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + streamId_ = value; + onChanged(); + return this; + } + public Builder clearStreamId() { + bitField0_ = (bitField0_ & ~0x00000010); + streamId_ = getDefaultInstance().getStreamId(); + onChanged(); + return this; + } + void setStreamId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000010; + streamId_ = value; + onChanged(); + } + + // required string stage = 6; + private java.lang.Object stage_ = ""; + public boolean hasStage() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public String getStage() { + java.lang.Object ref = stage_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + stage_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setStage(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000020; + stage_ = value; + onChanged(); + return this; + } + public Builder clearStage() { + bitField0_ = (bitField0_ & ~0x00000020); + stage_ = getDefaultInstance().getStage(); + onChanged(); + return this; + } + void setStage(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000020; + stage_ = value; + onChanged(); + } + + // optional bool expired = 7; + private boolean expired_ ; + public boolean hasExpired() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public boolean getExpired() { + return expired_; + } + public Builder setExpired(boolean value) { + bitField0_ |= 0x00000040; + expired_ = value; + onChanged(); + return this; + } + public Builder clearExpired() { + bitField0_ = (bitField0_ & ~0x00000040); + expired_ = false; + onChanged(); + return this; + } + + // optional string tunnel_name = 8; + private java.lang.Object tunnelName_ = ""; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000080; + tunnelName_ = value; + onChanged(); + return this; + } + public Builder clearTunnelName() { + bitField0_ = (bitField0_ & ~0x00000080); + tunnelName_ = getDefaultInstance().getTunnelName(); + onChanged(); + return this; + } + void setTunnelName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000080; + tunnelName_ = value; + onChanged(); + } + + // optional bool public = 9; + private boolean public_ ; + public boolean hasPublic() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public boolean getPublic() { + return public_; + } + public Builder setPublic(boolean value) { + bitField0_ |= 0x00000100; + public_ = value; + onChanged(); + return this; + } + public Builder clearPublic() { + bitField0_ = (bitField0_ & ~0x00000100); + public_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TunnelInfo) + } + + static { + defaultInstance = new TunnelInfo(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TunnelInfo) + } + + public interface ListTunnelResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnels = 1; + java.util.List + getTunnelsList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnels(int index); + int getTunnelsCount(); + java.util.List + getTunnelsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelsOrBuilder( + int index); + } + public static final class ListTunnelResponse extends + com.google.protobuf.GeneratedMessage + implements ListTunnelResponseOrBuilder { + // Use ListTunnelResponse.newBuilder() to construct. + private ListTunnelResponse(Builder builder) { + super(builder); + } + private ListTunnelResponse(boolean noInit) {} + + private static final ListTunnelResponse defaultInstance; + public static ListTunnelResponse getDefaultInstance() { + return defaultInstance; + } + + public ListTunnelResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnels = 1; + public static final int TUNNELS_FIELD_NUMBER = 1; + private java.util.List tunnels_; + public java.util.List getTunnelsList() { + return tunnels_; + } + public java.util.List + getTunnelsOrBuilderList() { + return tunnels_; + } + public int getTunnelsCount() { + return tunnels_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnels(int index) { + return tunnels_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelsOrBuilder( + int index) { + return tunnels_.get(index); + } + + private void initFields() { + tunnels_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getTunnelsCount(); i++) { + if (!getTunnels(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < tunnels_.size(); i++) { + output.writeMessage(1, tunnels_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < tunnels_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tunnels_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTunnelsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tunnelsBuilder_ == null) { + tunnels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + tunnelsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse(this); + int from_bitField0_ = bitField0_; + if (tunnelsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + tunnels_ = java.util.Collections.unmodifiableList(tunnels_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tunnels_ = tunnels_; + } else { + result.tunnels_ = tunnelsBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.getDefaultInstance()) return this; + if (tunnelsBuilder_ == null) { + if (!other.tunnels_.isEmpty()) { + if (tunnels_.isEmpty()) { + tunnels_ = other.tunnels_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTunnelsIsMutable(); + tunnels_.addAll(other.tunnels_); + } + onChanged(); + } + } else { + if (!other.tunnels_.isEmpty()) { + if (tunnelsBuilder_.isEmpty()) { + tunnelsBuilder_.dispose(); + tunnelsBuilder_ = null; + tunnels_ = other.tunnels_; + bitField0_ = (bitField0_ & ~0x00000001); + tunnelsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getTunnelsFieldBuilder() : null; + } else { + tunnelsBuilder_.addAllMessages(other.tunnels_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getTunnelsCount(); i++) { + if (!getTunnels(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addTunnels(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnels = 1; + private java.util.List tunnels_ = + java.util.Collections.emptyList(); + private void ensureTunnelsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + tunnels_ = new java.util.ArrayList(tunnels_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> tunnelsBuilder_; + + public java.util.List getTunnelsList() { + if (tunnelsBuilder_ == null) { + return java.util.Collections.unmodifiableList(tunnels_); + } else { + return tunnelsBuilder_.getMessageList(); + } + } + public int getTunnelsCount() { + if (tunnelsBuilder_ == null) { + return tunnels_.size(); + } else { + return tunnelsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnels(int index) { + if (tunnelsBuilder_ == null) { + return tunnels_.get(index); + } else { + return tunnelsBuilder_.getMessage(index); + } + } + public Builder setTunnels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { + if (tunnelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTunnelsIsMutable(); + tunnels_.set(index, value); + onChanged(); + } else { + tunnelsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setTunnels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { + if (tunnelsBuilder_ == null) { + ensureTunnelsIsMutable(); + tunnels_.set(index, builderForValue.build()); + onChanged(); + } else { + tunnelsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addTunnels(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { + if (tunnelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTunnelsIsMutable(); + tunnels_.add(value); + onChanged(); + } else { + tunnelsBuilder_.addMessage(value); + } + return this; + } + public Builder addTunnels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { + if (tunnelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTunnelsIsMutable(); + tunnels_.add(index, value); + onChanged(); + } else { + tunnelsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addTunnels( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { + if (tunnelsBuilder_ == null) { + ensureTunnelsIsMutable(); + tunnels_.add(builderForValue.build()); + onChanged(); + } else { + tunnelsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addTunnels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { + if (tunnelsBuilder_ == null) { + ensureTunnelsIsMutable(); + tunnels_.add(index, builderForValue.build()); + onChanged(); + } else { + tunnelsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllTunnels( + java.lang.Iterable values) { + if (tunnelsBuilder_ == null) { + ensureTunnelsIsMutable(); + super.addAll(values, tunnels_); + onChanged(); + } else { + tunnelsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearTunnels() { + if (tunnelsBuilder_ == null) { + tunnels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + tunnelsBuilder_.clear(); + } + return this; + } + public Builder removeTunnels(int index) { + if (tunnelsBuilder_ == null) { + ensureTunnelsIsMutable(); + tunnels_.remove(index); + onChanged(); + } else { + tunnelsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder getTunnelsBuilder( + int index) { + return getTunnelsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelsOrBuilder( + int index) { + if (tunnelsBuilder_ == null) { + return tunnels_.get(index); } else { + return tunnelsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getTunnelsOrBuilderList() { + if (tunnelsBuilder_ != null) { + return tunnelsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tunnels_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder addTunnelsBuilder() { + return getTunnelsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder addTunnelsBuilder( + int index) { + return getTunnelsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()); + } + public java.util.List + getTunnelsBuilderList() { + return getTunnelsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> + getTunnelsFieldBuilder() { + if (tunnelsBuilder_ == null) { + tunnelsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder>( + tunnels_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + tunnels_ = null; + } + return tunnelsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelResponse) + } + + static { + defaultInstance = new ListTunnelResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ListTunnelResponse) + } + + public interface DescribeTunnelRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string table_name = 1; + boolean hasTableName(); + String getTableName(); + + // required string tunnel_name = 2; + boolean hasTunnelName(); + String getTunnelName(); + + // optional string tunnel_id = 3; + boolean hasTunnelId(); + String getTunnelId(); + } + public static final class DescribeTunnelRequest extends + com.google.protobuf.GeneratedMessage + implements DescribeTunnelRequestOrBuilder { + // Use DescribeTunnelRequest.newBuilder() to construct. + private DescribeTunnelRequest(Builder builder) { + super(builder); + } + private DescribeTunnelRequest(boolean noInit) {} + + private static final DescribeTunnelRequest defaultInstance; + public static DescribeTunnelRequest getDefaultInstance() { + return defaultInstance; + } + + public DescribeTunnelRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string table_name = 1; + public static final int TABLE_NAME_FIELD_NUMBER = 1; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string tunnel_name = 2; + public static final int TUNNEL_NAME_FIELD_NUMBER = 2; + private java.lang.Object tunnelName_; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelNameBytes() { + java.lang.Object ref = tunnelName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string tunnel_id = 3; + public static final int TUNNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tableName_ = ""; + tunnelName_ = ""; + tunnelId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTableName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTunnelName()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTunnelIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTableNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getTunnelNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTunnelIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + tunnelName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.tunnelName_ = tunnelName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.tunnelId_ = tunnelId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.getDefaultInstance()) return this; + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasTunnelName()) { + setTunnelName(other.getTunnelName()); + } + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTableName()) { + + return false; + } + if (!hasTunnelName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tableName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + tunnelName_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + tunnelId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string table_name = 1; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000001); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tableName_ = value; + onChanged(); + } + + // required string tunnel_name = 2; + private java.lang.Object tunnelName_ = ""; + public boolean hasTunnelName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getTunnelName() { + java.lang.Object ref = tunnelName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + tunnelName_ = value; + onChanged(); + return this; + } + public Builder clearTunnelName() { + bitField0_ = (bitField0_ & ~0x00000002); + tunnelName_ = getDefaultInstance().getTunnelName(); + onChanged(); + return this; + } + void setTunnelName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + tunnelName_ = value; + onChanged(); + } + + // optional string tunnel_id = 3; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000004); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + tunnelId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelRequest) + } + + static { + defaultInstance = new DescribeTunnelRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelRequest) + } + + public interface ChannelInfoOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string channel_id = 1; + boolean hasChannelId(); + String getChannelId(); + + // optional string channel_type = 2; + boolean hasChannelType(); + String getChannelType(); + + // optional string channel_status = 3; + boolean hasChannelStatus(); + String getChannelStatus(); + + // optional string client_id = 4; + boolean hasClientId(); + String getClientId(); + + // optional int64 channel_rpo = 5; + boolean hasChannelRpo(); + long getChannelRpo(); + + // optional int64 channel_count = 6; + boolean hasChannelCount(); + long getChannelCount(); + } + public static final class ChannelInfo extends + com.google.protobuf.GeneratedMessage + implements ChannelInfoOrBuilder { + // Use ChannelInfo.newBuilder() to construct. + private ChannelInfo(Builder builder) { + super(builder); + } + private ChannelInfo(boolean noInit) {} + + private static final ChannelInfo defaultInstance; + public static ChannelInfo getDefaultInstance() { + return defaultInstance; + } + + public ChannelInfo getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_fieldAccessorTable; + } + + private int bitField0_; + // required string channel_id = 1; + public static final int CHANNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelIdBytes() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string channel_type = 2; + public static final int CHANNEL_TYPE_FIELD_NUMBER = 2; + private java.lang.Object channelType_; + public boolean hasChannelType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getChannelType() { + java.lang.Object ref = channelType_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelType_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelTypeBytes() { + java.lang.Object ref = channelType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string channel_status = 3; + public static final int CHANNEL_STATUS_FIELD_NUMBER = 3; + private java.lang.Object channelStatus_; + public boolean hasChannelStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelStatus() { + java.lang.Object ref = channelStatus_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelStatus_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelStatusBytes() { + java.lang.Object ref = channelStatus_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelStatus_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string client_id = 4; + public static final int CLIENT_ID_FIELD_NUMBER = 4; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int64 channel_rpo = 5; + public static final int CHANNEL_RPO_FIELD_NUMBER = 5; + private long channelRpo_; + public boolean hasChannelRpo() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getChannelRpo() { + return channelRpo_; + } + + // optional int64 channel_count = 6; + public static final int CHANNEL_COUNT_FIELD_NUMBER = 6; + private long channelCount_; + public boolean hasChannelCount() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public long getChannelCount() { + return channelCount_; + } + + private void initFields() { + channelId_ = ""; + channelType_ = ""; + channelStatus_ = ""; + clientId_ = ""; + channelRpo_ = 0L; + channelCount_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasChannelId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getChannelTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getChannelStatusBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getClientIdBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt64(5, channelRpo_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt64(6, channelCount_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getChannelTypeBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getChannelStatusBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getClientIdBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(5, channelRpo_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(6, channelCount_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + channelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + channelType_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + channelStatus_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + channelRpo_ = 0L; + bitField0_ = (bitField0_ & ~0x00000010); + channelCount_ = 0L; + bitField0_ = (bitField0_ & ~0x00000020); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.channelId_ = channelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.channelType_ = channelType_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.channelStatus_ = channelStatus_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.clientId_ = clientId_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.channelRpo_ = channelRpo_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.channelCount_ = channelCount_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance()) return this; + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + if (other.hasChannelType()) { + setChannelType(other.getChannelType()); + } + if (other.hasChannelStatus()) { + setChannelStatus(other.getChannelStatus()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + if (other.hasChannelRpo()) { + setChannelRpo(other.getChannelRpo()); + } + if (other.hasChannelCount()) { + setChannelCount(other.getChannelCount()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasChannelId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + channelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + channelType_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + channelStatus_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + clientId_ = input.readBytes(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + channelRpo_ = input.readInt64(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + channelCount_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required string channel_id = 1; + private java.lang.Object channelId_ = ""; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000001); + channelId_ = getDefaultInstance().getChannelId(); + onChanged(); + return this; + } + void setChannelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + channelId_ = value; + onChanged(); + } + + // optional string channel_type = 2; + private java.lang.Object channelType_ = ""; + public boolean hasChannelType() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getChannelType() { + java.lang.Object ref = channelType_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelType_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelType(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + channelType_ = value; + onChanged(); + return this; + } + public Builder clearChannelType() { + bitField0_ = (bitField0_ & ~0x00000002); + channelType_ = getDefaultInstance().getChannelType(); + onChanged(); + return this; + } + void setChannelType(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + channelType_ = value; + onChanged(); + } + + // optional string channel_status = 3; + private java.lang.Object channelStatus_ = ""; + public boolean hasChannelStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelStatus() { + java.lang.Object ref = channelStatus_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelStatus_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelStatus(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + channelStatus_ = value; + onChanged(); + return this; + } + public Builder clearChannelStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + channelStatus_ = getDefaultInstance().getChannelStatus(); + onChanged(); + return this; + } + void setChannelStatus(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + channelStatus_ = value; + onChanged(); + } + + // optional string client_id = 4; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000008); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + clientId_ = value; + onChanged(); + } + + // optional int64 channel_rpo = 5; + private long channelRpo_ ; + public boolean hasChannelRpo() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getChannelRpo() { + return channelRpo_; + } + public Builder setChannelRpo(long value) { + bitField0_ |= 0x00000010; + channelRpo_ = value; + onChanged(); + return this; + } + public Builder clearChannelRpo() { + bitField0_ = (bitField0_ & ~0x00000010); + channelRpo_ = 0L; + onChanged(); + return this; + } + + // optional int64 channel_count = 6; + private long channelCount_ ; + public boolean hasChannelCount() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public long getChannelCount() { + return channelCount_; + } + public Builder setChannelCount(long value) { + bitField0_ |= 0x00000020; + channelCount_ = value; + onChanged(); + return this; + } + public Builder clearChannelCount() { + bitField0_ = (bitField0_ & ~0x00000020); + channelCount_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ChannelInfo) + } + + static { + defaultInstance = new ChannelInfo(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ChannelInfo) + } + + public interface DescribeTunnelResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnel = 1; + boolean hasTunnel(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnel(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelOrBuilder(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.ChannelInfo channels = 2; + java.util.List + getChannelsList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getChannels(int index); + int getChannelsCount(); + java.util.List + getChannelsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder getChannelsOrBuilder( + int index); + + // optional int64 tunnel_rpo = 3; + boolean hasTunnelRpo(); + long getTunnelRpo(); + } + public static final class DescribeTunnelResponse extends + com.google.protobuf.GeneratedMessage + implements DescribeTunnelResponseOrBuilder { + // Use DescribeTunnelResponse.newBuilder() to construct. + private DescribeTunnelResponse(Builder builder) { + super(builder); + } + private DescribeTunnelResponse(boolean noInit) {} + + private static final DescribeTunnelResponse defaultInstance; + public static DescribeTunnelResponse getDefaultInstance() { + return defaultInstance; + } + + public DescribeTunnelResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnel = 1; + public static final int TUNNEL_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo tunnel_; + public boolean hasTunnel() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnel() { + return tunnel_; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelOrBuilder() { + return tunnel_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.ChannelInfo channels = 2; + public static final int CHANNELS_FIELD_NUMBER = 2; + private java.util.List channels_; + public java.util.List getChannelsList() { + return channels_; + } + public java.util.List + getChannelsOrBuilderList() { + return channels_; + } + public int getChannelsCount() { + return channels_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getChannels(int index) { + return channels_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder getChannelsOrBuilder( + int index) { + return channels_.get(index); + } + + // optional int64 tunnel_rpo = 3; + public static final int TUNNEL_RPO_FIELD_NUMBER = 3; + private long tunnelRpo_; + public boolean hasTunnelRpo() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getTunnelRpo() { + return tunnelRpo_; + } + + private void initFields() { + tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); + channels_ = java.util.Collections.emptyList(); + tunnelRpo_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnel()) { + memoizedIsInitialized = 0; + return false; + } + if (!getTunnel().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getChannelsCount(); i++) { + if (!getChannels(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, tunnel_); + } + for (int i = 0; i < channels_.size(); i++) { + output.writeMessage(2, channels_.get(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(3, tunnelRpo_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, tunnel_); + } + for (int i = 0; i < channels_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, channels_.get(i)); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, tunnelRpo_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getTunnelFieldBuilder(); + getChannelsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (tunnelBuilder_ == null) { + tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); + } else { + tunnelBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (channelsBuilder_ == null) { + channels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + channelsBuilder_.clear(); + } + tunnelRpo_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (tunnelBuilder_ == null) { + result.tunnel_ = tunnel_; + } else { + result.tunnel_ = tunnelBuilder_.build(); + } + if (channelsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + channels_ = java.util.Collections.unmodifiableList(channels_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.channels_ = channels_; + } else { + result.channels_ = channelsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + result.tunnelRpo_ = tunnelRpo_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.getDefaultInstance()) return this; + if (other.hasTunnel()) { + mergeTunnel(other.getTunnel()); + } + if (channelsBuilder_ == null) { + if (!other.channels_.isEmpty()) { + if (channels_.isEmpty()) { + channels_ = other.channels_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureChannelsIsMutable(); + channels_.addAll(other.channels_); + } + onChanged(); + } + } else { + if (!other.channels_.isEmpty()) { + if (channelsBuilder_.isEmpty()) { + channelsBuilder_.dispose(); + channelsBuilder_ = null; + channels_ = other.channels_; + bitField0_ = (bitField0_ & ~0x00000002); + channelsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getChannelsFieldBuilder() : null; + } else { + channelsBuilder_.addAllMessages(other.channels_); + } + } + } + if (other.hasTunnelRpo()) { + setTunnelRpo(other.getTunnelRpo()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnel()) { + + return false; + } + if (!getTunnel().isInitialized()) { + + return false; + } + for (int i = 0; i < getChannelsCount(); i++) { + if (!getChannels(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder(); + if (hasTunnel()) { + subBuilder.mergeFrom(getTunnel()); + } + input.readMessage(subBuilder, extensionRegistry); + setTunnel(subBuilder.buildPartial()); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addChannels(subBuilder.buildPartial()); + break; + } + case 24: { + bitField0_ |= 0x00000004; + tunnelRpo_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.TunnelInfo tunnel = 1; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> tunnelBuilder_; + public boolean hasTunnel() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo getTunnel() { + if (tunnelBuilder_ == null) { + return tunnel_; + } else { + return tunnelBuilder_.getMessage(); + } + } + public Builder setTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { + if (tunnelBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + tunnel_ = value; + onChanged(); + } else { + tunnelBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setTunnel( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder builderForValue) { + if (tunnelBuilder_ == null) { + tunnel_ = builderForValue.build(); + onChanged(); + } else { + tunnelBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeTunnel(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo value) { + if (tunnelBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + tunnel_ != com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance()) { + tunnel_ = + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.newBuilder(tunnel_).mergeFrom(value).buildPartial(); + } else { + tunnel_ = value; + } + onChanged(); + } else { + tunnelBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearTunnel() { + if (tunnelBuilder_ == null) { + tunnel_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.getDefaultInstance(); + onChanged(); + } else { + tunnelBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder getTunnelBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getTunnelFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder getTunnelOrBuilder() { + if (tunnelBuilder_ != null) { + return tunnelBuilder_.getMessageOrBuilder(); + } else { + return tunnel_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder> + getTunnelFieldBuilder() { + if (tunnelBuilder_ == null) { + tunnelBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfoOrBuilder>( + tunnel_, + getParentForChildren(), + isClean()); + tunnel_ = null; + } + return tunnelBuilder_; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.ChannelInfo channels = 2; + private java.util.List channels_ = + java.util.Collections.emptyList(); + private void ensureChannelsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + channels_ = new java.util.ArrayList(channels_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder> channelsBuilder_; + + public java.util.List getChannelsList() { + if (channelsBuilder_ == null) { + return java.util.Collections.unmodifiableList(channels_); + } else { + return channelsBuilder_.getMessageList(); + } + } + public int getChannelsCount() { + if (channelsBuilder_ == null) { + return channels_.size(); + } else { + return channelsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo getChannels(int index) { + if (channelsBuilder_ == null) { + return channels_.get(index); + } else { + return channelsBuilder_.getMessage(index); + } + } + public Builder setChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.set(index, value); + onChanged(); + } else { + channelsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.set(index, builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addChannels(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.add(value); + onChanged(); + } else { + channelsBuilder_.addMessage(value); + } + return this; + } + public Builder addChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.add(index, value); + onChanged(); + } else { + channelsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addChannels( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.add(builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.add(index, builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllChannels( + java.lang.Iterable values) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + super.addAll(values, channels_); + onChanged(); + } else { + channelsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearChannels() { + if (channelsBuilder_ == null) { + channels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + channelsBuilder_.clear(); + } + return this; + } + public Builder removeChannels(int index) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.remove(index); + onChanged(); + } else { + channelsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder getChannelsBuilder( + int index) { + return getChannelsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder getChannelsOrBuilder( + int index) { + if (channelsBuilder_ == null) { + return channels_.get(index); } else { + return channelsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getChannelsOrBuilderList() { + if (channelsBuilder_ != null) { + return channelsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(channels_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder addChannelsBuilder() { + return getChannelsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder addChannelsBuilder( + int index) { + return getChannelsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.getDefaultInstance()); + } + public java.util.List + getChannelsBuilderList() { + return getChannelsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder> + getChannelsFieldBuilder() { + if (channelsBuilder_ == null) { + channelsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfoOrBuilder>( + channels_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + channels_ = null; + } + return channelsBuilder_; + } + + // optional int64 tunnel_rpo = 3; + private long tunnelRpo_ ; + public boolean hasTunnelRpo() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getTunnelRpo() { + return tunnelRpo_; + } + public Builder setTunnelRpo(long value) { + bitField0_ |= 0x00000004; + tunnelRpo_ = value; + onChanged(); + return this; + } + public Builder clearTunnelRpo() { + bitField0_ = (bitField0_ & ~0x00000004); + tunnelRpo_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelResponse) + } + + static { + defaultInstance = new DescribeTunnelResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.DescribeTunnelResponse) + } + + public interface GetRpoRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + } + public static final class GetRpoRequest extends + com.google.protobuf.GeneratedMessage + implements GetRpoRequestOrBuilder { + // Use GetRpoRequest.newBuilder() to construct. + private GetRpoRequest(Builder builder) { + super(builder); + } + private GetRpoRequest(boolean noInit) {} + + private static final GetRpoRequest defaultInstance; + public static GetRpoRequest getDefaultInstance() { + return defaultInstance; + } + + public GetRpoRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_fieldAccessorTable; + } + + private int bitField0_; + // optional string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tunnelId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetRpoRequest) + } + + static { + defaultInstance = new GetRpoRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetRpoRequest) + } + + public interface GetRpoResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional bytes rpo_infos = 1; + boolean hasRpoInfos(); + com.google.protobuf.ByteString getRpoInfos(); + + // optional bytes tunnel_rpo_infos = 2; + boolean hasTunnelRpoInfos(); + com.google.protobuf.ByteString getTunnelRpoInfos(); + } + public static final class GetRpoResponse extends + com.google.protobuf.GeneratedMessage + implements GetRpoResponseOrBuilder { + // Use GetRpoResponse.newBuilder() to construct. + private GetRpoResponse(Builder builder) { + super(builder); + } + private GetRpoResponse(boolean noInit) {} + + private static final GetRpoResponse defaultInstance; + public static GetRpoResponse getDefaultInstance() { + return defaultInstance; + } + + public GetRpoResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_fieldAccessorTable; + } + + private int bitField0_; + // optional bytes rpo_infos = 1; + public static final int RPO_INFOS_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString rpoInfos_; + public boolean hasRpoInfos() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.google.protobuf.ByteString getRpoInfos() { + return rpoInfos_; + } + + // optional bytes tunnel_rpo_infos = 2; + public static final int TUNNEL_RPO_INFOS_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString tunnelRpoInfos_; + public boolean hasTunnelRpoInfos() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getTunnelRpoInfos() { + return tunnelRpoInfos_; + } + + private void initFields() { + rpoInfos_ = com.google.protobuf.ByteString.EMPTY; + tunnelRpoInfos_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, rpoInfos_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, tunnelRpoInfos_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, rpoInfos_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, tunnelRpoInfos_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + rpoInfos_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + tunnelRpoInfos_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.rpoInfos_ = rpoInfos_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.tunnelRpoInfos_ = tunnelRpoInfos_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.getDefaultInstance()) return this; + if (other.hasRpoInfos()) { + setRpoInfos(other.getRpoInfos()); + } + if (other.hasTunnelRpoInfos()) { + setTunnelRpoInfos(other.getTunnelRpoInfos()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + rpoInfos_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + tunnelRpoInfos_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional bytes rpo_infos = 1; + private com.google.protobuf.ByteString rpoInfos_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRpoInfos() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.google.protobuf.ByteString getRpoInfos() { + return rpoInfos_; + } + public Builder setRpoInfos(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + rpoInfos_ = value; + onChanged(); + return this; + } + public Builder clearRpoInfos() { + bitField0_ = (bitField0_ & ~0x00000001); + rpoInfos_ = getDefaultInstance().getRpoInfos(); + onChanged(); + return this; + } + + // optional bytes tunnel_rpo_infos = 2; + private com.google.protobuf.ByteString tunnelRpoInfos_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasTunnelRpoInfos() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getTunnelRpoInfos() { + return tunnelRpoInfos_; + } + public Builder setTunnelRpoInfos(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + tunnelRpoInfos_ = value; + onChanged(); + return this; + } + public Builder clearTunnelRpoInfos() { + bitField0_ = (bitField0_ & ~0x00000002); + tunnelRpoInfos_ = getDefaultInstance().getTunnelRpoInfos(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetRpoResponse) + } + + static { + defaultInstance = new GetRpoResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetRpoResponse) + } + + public interface ClientConfigOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int64 timeout = 1; + boolean hasTimeout(); + long getTimeout(); + + // optional string client_tag = 2; + boolean hasClientTag(); + String getClientTag(); + } + public static final class ClientConfig extends + com.google.protobuf.GeneratedMessage + implements ClientConfigOrBuilder { + // Use ClientConfig.newBuilder() to construct. + private ClientConfig(Builder builder) { + super(builder); + } + private ClientConfig(boolean noInit) {} + + private static final ClientConfig defaultInstance; + public static ClientConfig getDefaultInstance() { + return defaultInstance; + } + + public ClientConfig getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_fieldAccessorTable; + } + + private int bitField0_; + // optional int64 timeout = 1; + public static final int TIMEOUT_FIELD_NUMBER = 1; + private long timeout_; + public boolean hasTimeout() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getTimeout() { + return timeout_; + } + + // optional string client_tag = 2; + public static final int CLIENT_TAG_FIELD_NUMBER = 2; + private java.lang.Object clientTag_; + public boolean hasClientTag() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientTag() { + java.lang.Object ref = clientTag_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientTag_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientTagBytes() { + java.lang.Object ref = clientTag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientTag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + timeout_ = 0L; + clientTag_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, timeout_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientTagBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, timeout_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientTagBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + timeout_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + clientTag_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.timeout_ = timeout_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientTag_ = clientTag_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDefaultInstance()) return this; + if (other.hasTimeout()) { + setTimeout(other.getTimeout()); + } + if (other.hasClientTag()) { + setClientTag(other.getClientTag()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + timeout_ = input.readInt64(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientTag_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // optional int64 timeout = 1; + private long timeout_ ; + public boolean hasTimeout() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getTimeout() { + return timeout_; + } + public Builder setTimeout(long value) { + bitField0_ |= 0x00000001; + timeout_ = value; + onChanged(); + return this; + } + public Builder clearTimeout() { + bitField0_ = (bitField0_ & ~0x00000001); + timeout_ = 0L; + onChanged(); + return this; + } + + // optional string client_tag = 2; + private java.lang.Object clientTag_ = ""; + public boolean hasClientTag() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientTag() { + java.lang.Object ref = clientTag_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientTag_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientTag(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientTag_ = value; + onChanged(); + return this; + } + public Builder clearClientTag() { + bitField0_ = (bitField0_ & ~0x00000002); + clientTag_ = getDefaultInstance().getClientTag(); + onChanged(); + return this; + } + void setClientTag(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientTag_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ClientConfig) + } + + static { + defaultInstance = new ClientConfig(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ClientConfig) + } + + public interface ConnectRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // optional .com.alicloud.openservices.tablestore.core.protocol.ClientConfig client_config = 2; + boolean hasClientConfig(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig getClientConfig(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfigOrBuilder getClientConfigOrBuilder(); + } + public static final class ConnectRequest extends + com.google.protobuf.GeneratedMessage + implements ConnectRequestOrBuilder { + // Use ConnectRequest.newBuilder() to construct. + private ConnectRequest(Builder builder) { + super(builder); + } + private ConnectRequest(boolean noInit) {} + + private static final ConnectRequest defaultInstance; + public static ConnectRequest getDefaultInstance() { + return defaultInstance; + } + + public ConnectRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ClientConfig client_config = 2; + public static final int CLIENT_CONFIG_FIELD_NUMBER = 2; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig clientConfig_; + public boolean hasClientConfig() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig getClientConfig() { + return clientConfig_; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfigOrBuilder getClientConfigOrBuilder() { + return clientConfig_; + } + + private void initFields() { + tunnelId_ = ""; + clientConfig_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, clientConfig_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, clientConfig_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getClientConfigFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (clientConfigBuilder_ == null) { + clientConfig_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDefaultInstance(); + } else { + clientConfigBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (clientConfigBuilder_ == null) { + result.clientConfig_ = clientConfig_; + } else { + result.clientConfig_ = clientConfigBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientConfig()) { + mergeClientConfig(other.getClientConfig()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.newBuilder(); + if (hasClientConfig()) { + subBuilder.mergeFrom(getClientConfig()); + } + input.readMessage(subBuilder, extensionRegistry); + setClientConfig(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // optional .com.alicloud.openservices.tablestore.core.protocol.ClientConfig client_config = 2; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig clientConfig_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfigOrBuilder> clientConfigBuilder_; + public boolean hasClientConfig() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig getClientConfig() { + if (clientConfigBuilder_ == null) { + return clientConfig_; + } else { + return clientConfigBuilder_.getMessage(); + } + } + public Builder setClientConfig(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig value) { + if (clientConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + clientConfig_ = value; + onChanged(); + } else { + clientConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setClientConfig( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.Builder builderForValue) { + if (clientConfigBuilder_ == null) { + clientConfig_ = builderForValue.build(); + onChanged(); + } else { + clientConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeClientConfig(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig value) { + if (clientConfigBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + clientConfig_ != com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDefaultInstance()) { + clientConfig_ = + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.newBuilder(clientConfig_).mergeFrom(value).buildPartial(); + } else { + clientConfig_ = value; + } + onChanged(); + } else { + clientConfigBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearClientConfig() { + if (clientConfigBuilder_ == null) { + clientConfig_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.getDefaultInstance(); + onChanged(); + } else { + clientConfigBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.Builder getClientConfigBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getClientConfigFieldBuilder().getBuilder(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfigOrBuilder getClientConfigOrBuilder() { + if (clientConfigBuilder_ != null) { + return clientConfigBuilder_.getMessageOrBuilder(); + } else { + return clientConfig_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfigOrBuilder> + getClientConfigFieldBuilder() { + if (clientConfigBuilder_ == null) { + clientConfigBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfigOrBuilder>( + clientConfig_, + getParentForChildren(), + isClean()); + clientConfig_ = null; + } + return clientConfigBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ConnectRequest) + } + + static { + defaultInstance = new ConnectRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ConnectRequest) + } + + public interface ConnectResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string client_id = 1; + boolean hasClientId(); + String getClientId(); + } + public static final class ConnectResponse extends + com.google.protobuf.GeneratedMessage + implements ConnectResponseOrBuilder { + // Use ConnectResponse.newBuilder() to construct. + private ConnectResponse(Builder builder) { + super(builder); + } + private ConnectResponse(boolean noInit) {} + + private static final ConnectResponse defaultInstance; + public static ConnectResponse getDefaultInstance() { + return defaultInstance; + } + + public ConnectResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string client_id = 1; + public static final int CLIENT_ID_FIELD_NUMBER = 1; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + clientId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getClientIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getClientIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.clientId_ = clientId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse.getDefaultInstance()) return this; + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasClientId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + clientId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string client_id = 1; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + clientId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ConnectResponse) + } + + static { + defaultInstance = new ConnectResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ConnectResponse) + } + + public interface ChannelOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string channel_id = 1; + boolean hasChannelId(); + String getChannelId(); + + // required int64 version = 2; + boolean hasVersion(); + long getVersion(); + + // required .com.alicloud.openservices.tablestore.core.protocol.ChannelStatus status = 3; + boolean hasStatus(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus getStatus(); + + // optional bytes detail = 4; + boolean hasDetail(); + com.google.protobuf.ByteString getDetail(); + } + public static final class Channel extends + com.google.protobuf.GeneratedMessage + implements ChannelOrBuilder { + // Use Channel.newBuilder() to construct. + private Channel(Builder builder) { + super(builder); + } + private Channel(boolean noInit) {} + + private static final Channel defaultInstance; + public static Channel getDefaultInstance() { + return defaultInstance; + } + + public Channel getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_fieldAccessorTable; + } + + private int bitField0_; + // required string channel_id = 1; + public static final int CHANNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelIdBytes() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int64 version = 2; + public static final int VERSION_FIELD_NUMBER = 2; + private long version_; + public boolean hasVersion() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getVersion() { + return version_; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.ChannelStatus status = 3; + public static final int STATUS_FIELD_NUMBER = 3; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus status_; + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus getStatus() { + return status_; + } + + // optional bytes detail = 4; + public static final int DETAIL_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString detail_; + public boolean hasDetail() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getDetail() { + return detail_; + } + + private void initFields() { + channelId_ = ""; + version_ = 0L; + status_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus.OPEN; + detail_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasChannelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasVersion()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasStatus()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, version_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeEnum(3, status_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, detail_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, version_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(3, status_.getNumber()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, detail_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + channelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + version_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + status_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus.OPEN; + bitField0_ = (bitField0_ & ~0x00000004); + detail_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.channelId_ = channelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.version_ = version_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.status_ = status_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.detail_ = detail_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.getDefaultInstance()) return this; + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + if (other.hasVersion()) { + setVersion(other.getVersion()); + } + if (other.hasStatus()) { + setStatus(other.getStatus()); + } + if (other.hasDetail()) { + setDetail(other.getDetail()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasChannelId()) { + + return false; + } + if (!hasVersion()) { + + return false; + } + if (!hasStatus()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + channelId_ = input.readBytes(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + version_ = input.readInt64(); + break; + } + case 24: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus value = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(3, rawValue); + } else { + bitField0_ |= 0x00000004; + status_ = value; + } + break; + } + case 34: { + bitField0_ |= 0x00000008; + detail_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string channel_id = 1; + private java.lang.Object channelId_ = ""; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000001); + channelId_ = getDefaultInstance().getChannelId(); + onChanged(); + return this; + } + void setChannelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + channelId_ = value; + onChanged(); + } + + // required int64 version = 2; + private long version_ ; + public boolean hasVersion() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getVersion() { + return version_; + } + public Builder setVersion(long value) { + bitField0_ |= 0x00000002; + version_ = value; + onChanged(); + return this; + } + public Builder clearVersion() { + bitField0_ = (bitField0_ & ~0x00000002); + version_ = 0L; + onChanged(); + return this; + } + + // required .com.alicloud.openservices.tablestore.core.protocol.ChannelStatus status = 3; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus status_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus.OPEN; + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus getStatus() { + return status_; + } + public Builder setStatus(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + status_ = value; + onChanged(); + return this; + } + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + status_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelStatus.OPEN; + onChanged(); + return this; + } + + // optional bytes detail = 4; + private com.google.protobuf.ByteString detail_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasDetail() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getDetail() { + return detail_; + } + public Builder setDetail(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + detail_ = value; + onChanged(); + return this; + } + public Builder clearDetail() { + bitField0_ = (bitField0_ & ~0x00000008); + detail_ = getDefaultInstance().getDetail(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Channel) + } + + static { + defaultInstance = new Channel(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Channel) + } + + public interface HeartbeatRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string client_id = 2; + boolean hasClientId(); + String getClientId(); + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Channel channels = 3; + java.util.List + getChannelsList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel getChannels(int index); + int getChannelsCount(); + java.util.List + getChannelsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder getChannelsOrBuilder( + int index); + } + public static final class HeartbeatRequest extends + com.google.protobuf.GeneratedMessage + implements HeartbeatRequestOrBuilder { + // Use HeartbeatRequest.newBuilder() to construct. + private HeartbeatRequest(Builder builder) { + super(builder); + } + private HeartbeatRequest(boolean noInit) {} + + private static final HeartbeatRequest defaultInstance; + public static HeartbeatRequest getDefaultInstance() { + return defaultInstance; + } + + public HeartbeatRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string client_id = 2; + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Channel channels = 3; + public static final int CHANNELS_FIELD_NUMBER = 3; + private java.util.List channels_; + public java.util.List getChannelsList() { + return channels_; + } + public java.util.List + getChannelsOrBuilderList() { + return channels_; + } + public int getChannelsCount() { + return channels_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel getChannels(int index) { + return channels_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder getChannelsOrBuilder( + int index) { + return channels_.get(index); + } + + private void initFields() { + tunnelId_ = ""; + clientId_ = ""; + channels_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getChannelsCount(); i++) { + if (!getChannels(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientIdBytes()); + } + for (int i = 0; i < channels_.size(); i++) { + output.writeMessage(3, channels_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientIdBytes()); + } + for (int i = 0; i < channels_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, channels_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getChannelsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + if (channelsBuilder_ == null) { + channels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + } else { + channelsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientId_ = clientId_; + if (channelsBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004)) { + channels_ = java.util.Collections.unmodifiableList(channels_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.channels_ = channels_; + } else { + result.channels_ = channelsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + if (channelsBuilder_ == null) { + if (!other.channels_.isEmpty()) { + if (channels_.isEmpty()) { + channels_ = other.channels_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureChannelsIsMutable(); + channels_.addAll(other.channels_); + } + onChanged(); + } + } else { + if (!other.channels_.isEmpty()) { + if (channelsBuilder_.isEmpty()) { + channelsBuilder_.dispose(); + channelsBuilder_ = null; + channels_ = other.channels_; + bitField0_ = (bitField0_ & ~0x00000004); + channelsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getChannelsFieldBuilder() : null; + } else { + channelsBuilder_.addAllMessages(other.channels_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasClientId()) { + + return false; + } + for (int i = 0; i < getChannelsCount(); i++) { + if (!getChannels(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientId_ = input.readBytes(); + break; + } + case 26: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addChannels(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string client_id = 2; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000002); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Channel channels = 3; + private java.util.List channels_ = + java.util.Collections.emptyList(); + private void ensureChannelsIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + channels_ = new java.util.ArrayList(channels_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder> channelsBuilder_; + + public java.util.List getChannelsList() { + if (channelsBuilder_ == null) { + return java.util.Collections.unmodifiableList(channels_); + } else { + return channelsBuilder_.getMessageList(); + } + } + public int getChannelsCount() { + if (channelsBuilder_ == null) { + return channels_.size(); + } else { + return channelsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel getChannels(int index) { + if (channelsBuilder_ == null) { + return channels_.get(index); + } else { + return channelsBuilder_.getMessage(index); + } + } + public Builder setChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.set(index, value); + onChanged(); + } else { + channelsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.set(index, builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addChannels(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.add(value); + onChanged(); + } else { + channelsBuilder_.addMessage(value); + } + return this; + } + public Builder addChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.add(index, value); + onChanged(); + } else { + channelsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addChannels( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.add(builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.add(index, builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllChannels( + java.lang.Iterable values) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + super.addAll(values, channels_); + onChanged(); + } else { + channelsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearChannels() { + if (channelsBuilder_ == null) { + channels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + channelsBuilder_.clear(); + } + return this; + } + public Builder removeChannels(int index) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.remove(index); + onChanged(); + } else { + channelsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder getChannelsBuilder( + int index) { + return getChannelsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder getChannelsOrBuilder( + int index) { + if (channelsBuilder_ == null) { + return channels_.get(index); } else { + return channelsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getChannelsOrBuilderList() { + if (channelsBuilder_ != null) { + return channelsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(channels_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder addChannelsBuilder() { + return getChannelsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder addChannelsBuilder( + int index) { + return getChannelsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.getDefaultInstance()); + } + public java.util.List + getChannelsBuilderList() { + return getChannelsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder> + getChannelsFieldBuilder() { + if (channelsBuilder_ == null) { + channelsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder>( + channels_, + ((bitField0_ & 0x00000004) == 0x00000004), + getParentForChildren(), + isClean()); + channels_ = null; + } + return channelsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.HeartbeatRequest) + } + + static { + defaultInstance = new HeartbeatRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.HeartbeatRequest) + } + + public interface HeartbeatResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Channel channels = 1; + java.util.List + getChannelsList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel getChannels(int index); + int getChannelsCount(); + java.util.List + getChannelsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder getChannelsOrBuilder( + int index); + } + public static final class HeartbeatResponse extends + com.google.protobuf.GeneratedMessage + implements HeartbeatResponseOrBuilder { + // Use HeartbeatResponse.newBuilder() to construct. + private HeartbeatResponse(Builder builder) { + super(builder); + } + private HeartbeatResponse(boolean noInit) {} + + private static final HeartbeatResponse defaultInstance; + public static HeartbeatResponse getDefaultInstance() { + return defaultInstance; + } + + public HeartbeatResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_fieldAccessorTable; + } + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Channel channels = 1; + public static final int CHANNELS_FIELD_NUMBER = 1; + private java.util.List channels_; + public java.util.List getChannelsList() { + return channels_; + } + public java.util.List + getChannelsOrBuilderList() { + return channels_; + } + public int getChannelsCount() { + return channels_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel getChannels(int index) { + return channels_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder getChannelsOrBuilder( + int index) { + return channels_.get(index); + } + + private void initFields() { + channels_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + for (int i = 0; i < getChannelsCount(); i++) { + if (!getChannels(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < channels_.size(); i++) { + output.writeMessage(1, channels_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < channels_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, channels_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getChannelsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (channelsBuilder_ == null) { + channels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + channelsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse(this); + int from_bitField0_ = bitField0_; + if (channelsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + channels_ = java.util.Collections.unmodifiableList(channels_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.channels_ = channels_; + } else { + result.channels_ = channelsBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse.getDefaultInstance()) return this; + if (channelsBuilder_ == null) { + if (!other.channels_.isEmpty()) { + if (channels_.isEmpty()) { + channels_ = other.channels_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureChannelsIsMutable(); + channels_.addAll(other.channels_); + } + onChanged(); + } + } else { + if (!other.channels_.isEmpty()) { + if (channelsBuilder_.isEmpty()) { + channelsBuilder_.dispose(); + channelsBuilder_ = null; + channels_ = other.channels_; + bitField0_ = (bitField0_ & ~0x00000001); + channelsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getChannelsFieldBuilder() : null; + } else { + channelsBuilder_.addAllMessages(other.channels_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getChannelsCount(); i++) { + if (!getChannels(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addChannels(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Channel channels = 1; + private java.util.List channels_ = + java.util.Collections.emptyList(); + private void ensureChannelsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + channels_ = new java.util.ArrayList(channels_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder> channelsBuilder_; + + public java.util.List getChannelsList() { + if (channelsBuilder_ == null) { + return java.util.Collections.unmodifiableList(channels_); + } else { + return channelsBuilder_.getMessageList(); + } + } + public int getChannelsCount() { + if (channelsBuilder_ == null) { + return channels_.size(); + } else { + return channelsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel getChannels(int index) { + if (channelsBuilder_ == null) { + return channels_.get(index); + } else { + return channelsBuilder_.getMessage(index); + } + } + public Builder setChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.set(index, value); + onChanged(); + } else { + channelsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.set(index, builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addChannels(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.add(value); + onChanged(); + } else { + channelsBuilder_.addMessage(value); + } + return this; + } + public Builder addChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel value) { + if (channelsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureChannelsIsMutable(); + channels_.add(index, value); + onChanged(); + } else { + channelsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addChannels( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.add(builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addChannels( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder builderForValue) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.add(index, builderForValue.build()); + onChanged(); + } else { + channelsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllChannels( + java.lang.Iterable values) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + super.addAll(values, channels_); + onChanged(); + } else { + channelsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearChannels() { + if (channelsBuilder_ == null) { + channels_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + channelsBuilder_.clear(); + } + return this; + } + public Builder removeChannels(int index) { + if (channelsBuilder_ == null) { + ensureChannelsIsMutable(); + channels_.remove(index); + onChanged(); + } else { + channelsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder getChannelsBuilder( + int index) { + return getChannelsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder getChannelsOrBuilder( + int index) { + if (channelsBuilder_ == null) { + return channels_.get(index); } else { + return channelsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getChannelsOrBuilderList() { + if (channelsBuilder_ != null) { + return channelsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(channels_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder addChannelsBuilder() { + return getChannelsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder addChannelsBuilder( + int index) { + return getChannelsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.getDefaultInstance()); + } + public java.util.List + getChannelsBuilderList() { + return getChannelsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder> + getChannelsFieldBuilder() { + if (channelsBuilder_ == null) { + channelsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelOrBuilder>( + channels_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + channels_ = null; + } + return channelsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.HeartbeatResponse) + } + + static { + defaultInstance = new HeartbeatResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.HeartbeatResponse) + } + + public interface ShutdownRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string client_id = 2; + boolean hasClientId(); + String getClientId(); + } + public static final class ShutdownRequest extends + com.google.protobuf.GeneratedMessage + implements ShutdownRequestOrBuilder { + // Use ShutdownRequest.newBuilder() to construct. + private ShutdownRequest(Builder builder) { + super(builder); + } + private ShutdownRequest(boolean noInit) {} + + private static final ShutdownRequest defaultInstance; + public static ShutdownRequest getDefaultInstance() { + return defaultInstance; + } + + public ShutdownRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string client_id = 2; + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tunnelId_ = ""; + clientId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientId_ = clientId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasClientId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string client_id = 2; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000002); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ShutdownRequest) + } + + static { + defaultInstance = new ShutdownRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ShutdownRequest) + } + + public interface ShutdownResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class ShutdownResponse extends + com.google.protobuf.GeneratedMessage + implements ShutdownResponseOrBuilder { + // Use ShutdownResponse.newBuilder() to construct. + private ShutdownResponse(Builder builder) { + super(builder); + } + private ShutdownResponse(boolean noInit) {} + + private static final ShutdownResponse defaultInstance; + public static ShutdownResponse getDefaultInstance() { + return defaultInstance; + } + + public ShutdownResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ShutdownResponse) + } + + static { + defaultInstance = new ShutdownResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ShutdownResponse) + } + + public interface LockChannelRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string client_id = 2; + boolean hasClientId(); + String getClientId(); + + // required string channel_id = 3; + boolean hasChannelId(); + String getChannelId(); + + // required string lock_id = 4; + boolean hasLockId(); + String getLockId(); + + // required int64 timeout = 5; + boolean hasTimeout(); + long getTimeout(); + } + public static final class LockChannelRequest extends + com.google.protobuf.GeneratedMessage + implements LockChannelRequestOrBuilder { + // Use LockChannelRequest.newBuilder() to construct. + private LockChannelRequest(Builder builder) { + super(builder); + } + private LockChannelRequest(boolean noInit) {} + + private static final LockChannelRequest defaultInstance; + public static LockChannelRequest getDefaultInstance() { + return defaultInstance; + } + + public LockChannelRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string client_id = 2; + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string channel_id = 3; + public static final int CHANNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelIdBytes() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string lock_id = 4; + public static final int LOCK_ID_FIELD_NUMBER = 4; + private java.lang.Object lockId_; + public boolean hasLockId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getLockId() { + java.lang.Object ref = lockId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + lockId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getLockIdBytes() { + java.lang.Object ref = lockId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + lockId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int64 timeout = 5; + public static final int TIMEOUT_FIELD_NUMBER = 5; + private long timeout_; + public boolean hasTimeout() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getTimeout() { + return timeout_; + } + + private void initFields() { + tunnelId_ = ""; + clientId_ = ""; + channelId_ = ""; + lockId_ = ""; + timeout_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasChannelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLockId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasTimeout()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getLockIdBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt64(5, timeout_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getLockIdBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(5, timeout_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + channelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + lockId_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + timeout_ = 0L; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientId_ = clientId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.channelId_ = channelId_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.lockId_ = lockId_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.timeout_ = timeout_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + if (other.hasLockId()) { + setLockId(other.getLockId()); + } + if (other.hasTimeout()) { + setTimeout(other.getTimeout()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasClientId()) { + + return false; + } + if (!hasChannelId()) { + + return false; + } + if (!hasLockId()) { + + return false; + } + if (!hasTimeout()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientId_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + channelId_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + lockId_ = input.readBytes(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + timeout_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string client_id = 2; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000002); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + } + + // required string channel_id = 3; + private java.lang.Object channelId_ = ""; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000004); + channelId_ = getDefaultInstance().getChannelId(); + onChanged(); + return this; + } + void setChannelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + } + + // required string lock_id = 4; + private java.lang.Object lockId_ = ""; + public boolean hasLockId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getLockId() { + java.lang.Object ref = lockId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + lockId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setLockId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + lockId_ = value; + onChanged(); + return this; + } + public Builder clearLockId() { + bitField0_ = (bitField0_ & ~0x00000008); + lockId_ = getDefaultInstance().getLockId(); + onChanged(); + return this; + } + void setLockId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + lockId_ = value; + onChanged(); + } + + // required int64 timeout = 5; + private long timeout_ ; + public boolean hasTimeout() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getTimeout() { + return timeout_; + } + public Builder setTimeout(long value) { + bitField0_ |= 0x00000010; + timeout_ = value; + onChanged(); + return this; + } + public Builder clearTimeout() { + bitField0_ = (bitField0_ & ~0x00000010); + timeout_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.LockChannelRequest) + } + + static { + defaultInstance = new LockChannelRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.LockChannelRequest) + } + + public interface LockChannelResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class LockChannelResponse extends + com.google.protobuf.GeneratedMessage + implements LockChannelResponseOrBuilder { + // Use LockChannelResponse.newBuilder() to construct. + private LockChannelResponse(Builder builder) { + super(builder); + } + private LockChannelResponse(boolean noInit) {} + + private static final LockChannelResponse defaultInstance; + public static LockChannelResponse getDefaultInstance() { + return defaultInstance; + } + + public LockChannelResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.LockChannelResponse) + } + + static { + defaultInstance = new LockChannelResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.LockChannelResponse) + } + + public interface UnlockChannelRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string client_id = 2; + boolean hasClientId(); + String getClientId(); + + // required string channel_id = 3; + boolean hasChannelId(); + String getChannelId(); + + // required string lock_id = 4; + boolean hasLockId(); + String getLockId(); + } + public static final class UnlockChannelRequest extends + com.google.protobuf.GeneratedMessage + implements UnlockChannelRequestOrBuilder { + // Use UnlockChannelRequest.newBuilder() to construct. + private UnlockChannelRequest(Builder builder) { + super(builder); + } + private UnlockChannelRequest(boolean noInit) {} + + private static final UnlockChannelRequest defaultInstance; + public static UnlockChannelRequest getDefaultInstance() { + return defaultInstance; + } + + public UnlockChannelRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string client_id = 2; + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string channel_id = 3; + public static final int CHANNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelIdBytes() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string lock_id = 4; + public static final int LOCK_ID_FIELD_NUMBER = 4; + private java.lang.Object lockId_; + public boolean hasLockId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getLockId() { + java.lang.Object ref = lockId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + lockId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getLockIdBytes() { + java.lang.Object ref = lockId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + lockId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tunnelId_ = ""; + clientId_ = ""; + channelId_ = ""; + lockId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasChannelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasLockId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getLockIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getLockIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + channelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + lockId_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientId_ = clientId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.channelId_ = channelId_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.lockId_ = lockId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + if (other.hasLockId()) { + setLockId(other.getLockId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasClientId()) { + + return false; + } + if (!hasChannelId()) { + + return false; + } + if (!hasLockId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientId_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + channelId_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + lockId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string client_id = 2; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000002); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + } + + // required string channel_id = 3; + private java.lang.Object channelId_ = ""; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000004); + channelId_ = getDefaultInstance().getChannelId(); + onChanged(); + return this; + } + void setChannelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + } + + // required string lock_id = 4; + private java.lang.Object lockId_ = ""; + public boolean hasLockId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getLockId() { + java.lang.Object ref = lockId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + lockId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setLockId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + lockId_ = value; + onChanged(); + return this; + } + public Builder clearLockId() { + bitField0_ = (bitField0_ & ~0x00000008); + lockId_ = getDefaultInstance().getLockId(); + onChanged(); + return this; + } + void setLockId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + lockId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UnlockChannelRequest) + } + + static { + defaultInstance = new UnlockChannelRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UnlockChannelRequest) + } + + public interface UnlockChannelResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class UnlockChannelResponse extends + com.google.protobuf.GeneratedMessage + implements UnlockChannelResponseOrBuilder { + // Use UnlockChannelResponse.newBuilder() to construct. + private UnlockChannelResponse(Builder builder) { + super(builder); + } + private UnlockChannelResponse(boolean noInit) {} + + private static final UnlockChannelResponse defaultInstance; + public static UnlockChannelResponse getDefaultInstance() { + return defaultInstance; + } + + public UnlockChannelResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.UnlockChannelResponse) + } + + static { + defaultInstance = new UnlockChannelResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.UnlockChannelResponse) + } + + public interface GetCheckpointRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string client_id = 2; + boolean hasClientId(); + String getClientId(); + + // required string channel_id = 3; + boolean hasChannelId(); + String getChannelId(); + } + public static final class GetCheckpointRequest extends + com.google.protobuf.GeneratedMessage + implements GetCheckpointRequestOrBuilder { + // Use GetCheckpointRequest.newBuilder() to construct. + private GetCheckpointRequest(Builder builder) { + super(builder); + } + private GetCheckpointRequest(boolean noInit) {} + + private static final GetCheckpointRequest defaultInstance; + public static GetCheckpointRequest getDefaultInstance() { + return defaultInstance; + } + + public GetCheckpointRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string client_id = 2; + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string channel_id = 3; + public static final int CHANNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelIdBytes() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tunnelId_ = ""; + clientId_ = ""; + channelId_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasChannelId()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getChannelIdBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getChannelIdBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + channelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientId_ = clientId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.channelId_ = channelId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasClientId()) { + + return false; + } + if (!hasChannelId()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientId_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + channelId_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string client_id = 2; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000002); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + } + + // required string channel_id = 3; + private java.lang.Object channelId_ = ""; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000004); + channelId_ = getDefaultInstance().getChannelId(); + onChanged(); + return this; + } + void setChannelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetCheckpointRequest) + } + + static { + defaultInstance = new GetCheckpointRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetCheckpointRequest) + } + + public interface GetCheckpointResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string checkpoint = 1; + boolean hasCheckpoint(); + String getCheckpoint(); + + // required int64 sequence_number = 2; + boolean hasSequenceNumber(); + long getSequenceNumber(); + } + public static final class GetCheckpointResponse extends + com.google.protobuf.GeneratedMessage + implements GetCheckpointResponseOrBuilder { + // Use GetCheckpointResponse.newBuilder() to construct. + private GetCheckpointResponse(Builder builder) { + super(builder); + } + private GetCheckpointResponse(boolean noInit) {} + + private static final GetCheckpointResponse defaultInstance; + public static GetCheckpointResponse getDefaultInstance() { + return defaultInstance; + } + + public GetCheckpointResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_fieldAccessorTable; + } + + private int bitField0_; + // required string checkpoint = 1; + public static final int CHECKPOINT_FIELD_NUMBER = 1; + private java.lang.Object checkpoint_; + public boolean hasCheckpoint() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getCheckpoint() { + java.lang.Object ref = checkpoint_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + checkpoint_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getCheckpointBytes() { + java.lang.Object ref = checkpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + checkpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int64 sequence_number = 2; + public static final int SEQUENCE_NUMBER_FIELD_NUMBER = 2; + private long sequenceNumber_; + public boolean hasSequenceNumber() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getSequenceNumber() { + return sequenceNumber_; + } + + private void initFields() { + checkpoint_ = ""; + sequenceNumber_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasCheckpoint()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasSequenceNumber()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getCheckpointBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, sequenceNumber_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getCheckpointBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, sequenceNumber_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + checkpoint_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + sequenceNumber_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.checkpoint_ = checkpoint_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.sequenceNumber_ = sequenceNumber_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse.getDefaultInstance()) return this; + if (other.hasCheckpoint()) { + setCheckpoint(other.getCheckpoint()); + } + if (other.hasSequenceNumber()) { + setSequenceNumber(other.getSequenceNumber()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasCheckpoint()) { + + return false; + } + if (!hasSequenceNumber()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + checkpoint_ = input.readBytes(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + sequenceNumber_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required string checkpoint = 1; + private java.lang.Object checkpoint_ = ""; + public boolean hasCheckpoint() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getCheckpoint() { + java.lang.Object ref = checkpoint_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + checkpoint_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setCheckpoint(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + checkpoint_ = value; + onChanged(); + return this; + } + public Builder clearCheckpoint() { + bitField0_ = (bitField0_ & ~0x00000001); + checkpoint_ = getDefaultInstance().getCheckpoint(); + onChanged(); + return this; + } + void setCheckpoint(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + checkpoint_ = value; + onChanged(); + } + + // required int64 sequence_number = 2; + private long sequenceNumber_ ; + public boolean hasSequenceNumber() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getSequenceNumber() { + return sequenceNumber_; + } + public Builder setSequenceNumber(long value) { + bitField0_ |= 0x00000002; + sequenceNumber_ = value; + onChanged(); + return this; + } + public Builder clearSequenceNumber() { + bitField0_ = (bitField0_ & ~0x00000002); + sequenceNumber_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.GetCheckpointResponse) + } + + static { + defaultInstance = new GetCheckpointResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.GetCheckpointResponse) + } + + public interface CheckpointRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string client_id = 2; + boolean hasClientId(); + String getClientId(); + + // required string channel_id = 3; + boolean hasChannelId(); + String getChannelId(); + + // required string checkpoint = 4; + boolean hasCheckpoint(); + String getCheckpoint(); + + // required int64 sequence_number = 5; + boolean hasSequenceNumber(); + long getSequenceNumber(); + } + public static final class CheckpointRequest extends + com.google.protobuf.GeneratedMessage + implements CheckpointRequestOrBuilder { + // Use CheckpointRequest.newBuilder() to construct. + private CheckpointRequest(Builder builder) { + super(builder); + } + private CheckpointRequest(boolean noInit) {} + + private static final CheckpointRequest defaultInstance; + public static CheckpointRequest getDefaultInstance() { + return defaultInstance; + } + + public CheckpointRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string client_id = 2; + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string channel_id = 3; + public static final int CHANNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelIdBytes() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string checkpoint = 4; + public static final int CHECKPOINT_FIELD_NUMBER = 4; + private java.lang.Object checkpoint_; + public boolean hasCheckpoint() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getCheckpoint() { + java.lang.Object ref = checkpoint_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + checkpoint_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getCheckpointBytes() { + java.lang.Object ref = checkpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + checkpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required int64 sequence_number = 5; + public static final int SEQUENCE_NUMBER_FIELD_NUMBER = 5; + private long sequenceNumber_; + public boolean hasSequenceNumber() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getSequenceNumber() { + return sequenceNumber_; + } + + private void initFields() { + tunnelId_ = ""; + clientId_ = ""; + channelId_ = ""; + checkpoint_ = ""; + sequenceNumber_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasChannelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasCheckpoint()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasSequenceNumber()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getCheckpointBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt64(5, sequenceNumber_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getCheckpointBytes()); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(5, sequenceNumber_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + channelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + checkpoint_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + sequenceNumber_ = 0L; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientId_ = clientId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.channelId_ = channelId_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.checkpoint_ = checkpoint_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.sequenceNumber_ = sequenceNumber_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + if (other.hasCheckpoint()) { + setCheckpoint(other.getCheckpoint()); + } + if (other.hasSequenceNumber()) { + setSequenceNumber(other.getSequenceNumber()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasClientId()) { + + return false; + } + if (!hasChannelId()) { + + return false; + } + if (!hasCheckpoint()) { + + return false; + } + if (!hasSequenceNumber()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientId_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + channelId_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + checkpoint_ = input.readBytes(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + sequenceNumber_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string client_id = 2; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000002); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + } + + // required string channel_id = 3; + private java.lang.Object channelId_ = ""; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000004); + channelId_ = getDefaultInstance().getChannelId(); + onChanged(); + return this; + } + void setChannelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + } + + // required string checkpoint = 4; + private java.lang.Object checkpoint_ = ""; + public boolean hasCheckpoint() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getCheckpoint() { + java.lang.Object ref = checkpoint_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + checkpoint_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setCheckpoint(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + checkpoint_ = value; + onChanged(); + return this; + } + public Builder clearCheckpoint() { + bitField0_ = (bitField0_ & ~0x00000008); + checkpoint_ = getDefaultInstance().getCheckpoint(); + onChanged(); + return this; + } + void setCheckpoint(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + checkpoint_ = value; + onChanged(); + } + + // required int64 sequence_number = 5; + private long sequenceNumber_ ; + public boolean hasSequenceNumber() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getSequenceNumber() { + return sequenceNumber_; + } + public Builder setSequenceNumber(long value) { + bitField0_ |= 0x00000010; + sequenceNumber_ = value; + onChanged(); + return this; + } + public Builder clearSequenceNumber() { + bitField0_ = (bitField0_ & ~0x00000010); + sequenceNumber_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CheckpointRequest) + } + + static { + defaultInstance = new CheckpointRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CheckpointRequest) + } + + public interface CheckpointResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + public static final class CheckpointResponse extends + com.google.protobuf.GeneratedMessage + implements CheckpointResponseOrBuilder { + // Use CheckpointResponse.newBuilder() to construct. + private CheckpointResponse(Builder builder) { + super(builder); + } + private CheckpointResponse(boolean noInit) {} + + private static final CheckpointResponse defaultInstance; + public static CheckpointResponse getDefaultInstance() { + return defaultInstance; + } + + public CheckpointResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_fieldAccessorTable; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + } + } + } + + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.CheckpointResponse) + } + + static { + defaultInstance = new CheckpointResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.CheckpointResponse) + } + + public interface ReadRecordsRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string tunnel_id = 1; + boolean hasTunnelId(); + String getTunnelId(); + + // required string client_id = 2; + boolean hasClientId(); + String getClientId(); + + // required string channel_id = 3; + boolean hasChannelId(); + String getChannelId(); + + // required string token = 4; + boolean hasToken(); + String getToken(); + } + public static final class ReadRecordsRequest extends + com.google.protobuf.GeneratedMessage + implements ReadRecordsRequestOrBuilder { + // Use ReadRecordsRequest.newBuilder() to construct. + private ReadRecordsRequest(Builder builder) { + super(builder); + } + private ReadRecordsRequest(boolean noInit) {} + + private static final ReadRecordsRequest defaultInstance; + public static ReadRecordsRequest getDefaultInstance() { + return defaultInstance; + } + + public ReadRecordsRequest getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_fieldAccessorTable; + } + + private int bitField0_; + // required string tunnel_id = 1; + public static final int TUNNEL_ID_FIELD_NUMBER = 1; + private java.lang.Object tunnelId_; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tunnelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTunnelIdBytes() { + java.lang.Object ref = tunnelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tunnelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string client_id = 2; + public static final int CLIENT_ID_FIELD_NUMBER = 2; + private java.lang.Object clientId_; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + clientId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getClientIdBytes() { + java.lang.Object ref = clientId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + clientId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string channel_id = 3; + public static final int CHANNEL_ID_FIELD_NUMBER = 3; + private java.lang.Object channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + channelId_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getChannelIdBytes() { + java.lang.Object ref = channelId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + channelId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string token = 4; + public static final int TOKEN_FIELD_NUMBER = 4; + private java.lang.Object token_; + public boolean hasToken() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getToken() { + java.lang.Object ref = token_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + token_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTokenBytes() { + java.lang.Object ref = token_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + token_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + tunnelId_ = ""; + clientId_ = ""; + channelId_ = ""; + token_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasTunnelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasClientId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasChannelId()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasToken()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getTokenBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTunnelIdBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getClientIdBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getChannelIdBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getTokenBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tunnelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + clientId_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + channelId_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + token_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tunnelId_ = tunnelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.clientId_ = clientId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.channelId_ = channelId_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.token_ = token_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest.getDefaultInstance()) return this; + if (other.hasTunnelId()) { + setTunnelId(other.getTunnelId()); + } + if (other.hasClientId()) { + setClientId(other.getClientId()); + } + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + if (other.hasToken()) { + setToken(other.getToken()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasTunnelId()) { + + return false; + } + if (!hasClientId()) { + + return false; + } + if (!hasChannelId()) { + + return false; + } + if (!hasToken()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + tunnelId_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + clientId_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + channelId_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + token_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string tunnel_id = 1; + private java.lang.Object tunnelId_ = ""; + public boolean hasTunnelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getTunnelId() { + java.lang.Object ref = tunnelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tunnelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTunnelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + return this; + } + public Builder clearTunnelId() { + bitField0_ = (bitField0_ & ~0x00000001); + tunnelId_ = getDefaultInstance().getTunnelId(); + onChanged(); + return this; + } + void setTunnelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + tunnelId_ = value; + onChanged(); + } + + // required string client_id = 2; + private java.lang.Object clientId_ = ""; + public boolean hasClientId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getClientId() { + java.lang.Object ref = clientId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + clientId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setClientId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + return this; + } + public Builder clearClientId() { + bitField0_ = (bitField0_ & ~0x00000002); + clientId_ = getDefaultInstance().getClientId(); + onChanged(); + return this; + } + void setClientId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + clientId_ = value; + onChanged(); + } + + // required string channel_id = 3; + private java.lang.Object channelId_ = ""; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getChannelId() { + java.lang.Object ref = channelId_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + channelId_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setChannelId(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000004); + channelId_ = getDefaultInstance().getChannelId(); + onChanged(); + return this; + } + void setChannelId(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + channelId_ = value; + onChanged(); + } + + // required string token = 4; + private java.lang.Object token_ = ""; + public boolean hasToken() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getToken() { + java.lang.Object ref = token_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + token_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setToken(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + token_ = value; + onChanged(); + return this; + } + public Builder clearToken() { + bitField0_ = (bitField0_ & ~0x00000008); + token_ = getDefaultInstance().getToken(); + onChanged(); + return this; + } + void setToken(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + token_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ReadRecordsRequest) + } + + static { + defaultInstance = new ReadRecordsRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ReadRecordsRequest) + } + + public interface RecordOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .com.alicloud.openservices.tablestore.core.protocol.ActionType action_type = 1; + boolean hasActionType(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType getActionType(); + + // required bytes record = 2; + boolean hasRecord(); + com.google.protobuf.ByteString getRecord(); + } + public static final class Record extends + com.google.protobuf.GeneratedMessage + implements RecordOrBuilder { + // Use Record.newBuilder() to construct. + private Record(Builder builder) { + super(builder); + } + private Record(boolean noInit) {} + + private static final Record defaultInstance; + public static Record getDefaultInstance() { + return defaultInstance; + } + + public Record getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_fieldAccessorTable; + } + + private int bitField0_; + // required .com.alicloud.openservices.tablestore.core.protocol.ActionType action_type = 1; + public static final int ACTION_TYPE_FIELD_NUMBER = 1; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType actionType_; + public boolean hasActionType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType getActionType() { + return actionType_; + } + + // required bytes record = 2; + public static final int RECORD_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString record_; + public boolean hasRecord() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRecord() { + return record_; + } + + private void initFields() { + actionType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType.PUT_ROW; + record_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasActionType()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasRecord()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeEnum(1, actionType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, record_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, actionType_.getNumber()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, record_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.RecordOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + actionType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType.PUT_ROW; + bitField0_ = (bitField0_ & ~0x00000001); + record_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.actionType_ = actionType_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.record_ = record_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.getDefaultInstance()) return this; + if (other.hasActionType()) { + setActionType(other.getActionType()); + } + if (other.hasRecord()) { + setRecord(other.getRecord()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasActionType()) { + + return false; + } + if (!hasRecord()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + int rawValue = input.readEnum(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType value = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + actionType_ = value; + } + break; + } + case 18: { + bitField0_ |= 0x00000002; + record_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required .com.alicloud.openservices.tablestore.core.protocol.ActionType action_type = 1; + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType actionType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType.PUT_ROW; + public boolean hasActionType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType getActionType() { + return actionType_; + } + public Builder setActionType(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + actionType_ = value; + onChanged(); + return this; + } + public Builder clearActionType() { + bitField0_ = (bitField0_ & ~0x00000001); + actionType_ = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ActionType.PUT_ROW; + onChanged(); + return this; + } + + // required bytes record = 2; + private com.google.protobuf.ByteString record_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRecord() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getRecord() { + return record_; + } + public Builder setRecord(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + record_ = value; + onChanged(); + return this; + } + public Builder clearRecord() { + bitField0_ = (bitField0_ & ~0x00000002); + record_ = getDefaultInstance().getRecord(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Record) + } + + static { + defaultInstance = new Record(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Record) + } + + public interface ReadRecordsResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Record records = 1; + java.util.List + getRecordsList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record getRecords(int index); + int getRecordsCount(); + java.util.List + getRecordsOrBuilderList(); + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.RecordOrBuilder getRecordsOrBuilder( + int index); + + // required string next_token = 2; + boolean hasNextToken(); + String getNextToken(); + } + public static final class ReadRecordsResponse extends + com.google.protobuf.GeneratedMessage + implements ReadRecordsResponseOrBuilder { + // Use ReadRecordsResponse.newBuilder() to construct. + private ReadRecordsResponse(Builder builder) { + super(builder); + } + private ReadRecordsResponse(boolean noInit) {} + + private static final ReadRecordsResponse defaultInstance; + public static ReadRecordsResponse getDefaultInstance() { + return defaultInstance; + } + + public ReadRecordsResponse getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_fieldAccessorTable; + } + + private int bitField0_; + // repeated .com.alicloud.openservices.tablestore.core.protocol.Record records = 1; + public static final int RECORDS_FIELD_NUMBER = 1; + private java.util.List records_; + public java.util.List getRecordsList() { + return records_; + } + public java.util.List + getRecordsOrBuilderList() { + return records_; + } + public int getRecordsCount() { + return records_.size(); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record getRecords(int index) { + return records_.get(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.RecordOrBuilder getRecordsOrBuilder( + int index) { + return records_.get(index); + } + + // required string next_token = 2; + public static final int NEXT_TOKEN_FIELD_NUMBER = 2; + private java.lang.Object nextToken_; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getNextToken() { + java.lang.Object ref = nextToken_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + nextToken_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNextTokenBytes() { + java.lang.Object ref = nextToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + nextToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + records_ = java.util.Collections.emptyList(); + nextToken_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasNextToken()) { + memoizedIsInitialized = 0; + return false; + } + for (int i = 0; i < getRecordsCount(); i++) { + if (!getRecords(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < records_.size(); i++) { + output.writeMessage(1, records_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(2, getNextTokenBytes()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < records_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, records_.get(i)); + } + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getNextTokenBytes()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getRecordsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (recordsBuilder_ == null) { + records_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + recordsBuilder_.clear(); + } + nextToken_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (recordsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + records_ = java.util.Collections.unmodifiableList(records_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.records_ = records_; + } else { + result.records_ = recordsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000001; + } + result.nextToken_ = nextToken_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse.getDefaultInstance()) return this; + if (recordsBuilder_ == null) { + if (!other.records_.isEmpty()) { + if (records_.isEmpty()) { + records_ = other.records_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureRecordsIsMutable(); + records_.addAll(other.records_); + } + onChanged(); + } + } else { + if (!other.records_.isEmpty()) { + if (recordsBuilder_.isEmpty()) { + recordsBuilder_.dispose(); + recordsBuilder_ = null; + records_ = other.records_; + bitField0_ = (bitField0_ & ~0x00000001); + recordsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getRecordsFieldBuilder() : null; + } else { + recordsBuilder_.addAllMessages(other.records_); + } + } + } + if (other.hasNextToken()) { + setNextToken(other.getNextToken()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasNextToken()) { + + return false; + } + for (int i = 0; i < getRecordsCount(); i++) { + if (!getRecords(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder subBuilder = com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addRecords(subBuilder.buildPartial()); + break; + } + case 18: { + bitField0_ |= 0x00000002; + nextToken_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // repeated .com.alicloud.openservices.tablestore.core.protocol.Record records = 1; + private java.util.List records_ = + java.util.Collections.emptyList(); + private void ensureRecordsIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + records_ = new java.util.ArrayList(records_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.RecordOrBuilder> recordsBuilder_; + + public java.util.List getRecordsList() { + if (recordsBuilder_ == null) { + return java.util.Collections.unmodifiableList(records_); + } else { + return recordsBuilder_.getMessageList(); + } + } + public int getRecordsCount() { + if (recordsBuilder_ == null) { + return records_.size(); + } else { + return recordsBuilder_.getCount(); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record getRecords(int index) { + if (recordsBuilder_ == null) { + return records_.get(index); + } else { + return recordsBuilder_.getMessage(index); + } + } + public Builder setRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record value) { + if (recordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRecordsIsMutable(); + records_.set(index, value); + onChanged(); + } else { + recordsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder builderForValue) { + if (recordsBuilder_ == null) { + ensureRecordsIsMutable(); + records_.set(index, builderForValue.build()); + onChanged(); + } else { + recordsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addRecords(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record value) { + if (recordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRecordsIsMutable(); + records_.add(value); + onChanged(); + } else { + recordsBuilder_.addMessage(value); + } + return this; + } + public Builder addRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record value) { + if (recordsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRecordsIsMutable(); + records_.add(index, value); + onChanged(); + } else { + recordsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addRecords( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder builderForValue) { + if (recordsBuilder_ == null) { + ensureRecordsIsMutable(); + records_.add(builderForValue.build()); + onChanged(); + } else { + recordsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addRecords( + int index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder builderForValue) { + if (recordsBuilder_ == null) { + ensureRecordsIsMutable(); + records_.add(index, builderForValue.build()); + onChanged(); + } else { + recordsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllRecords( + java.lang.Iterable values) { + if (recordsBuilder_ == null) { + ensureRecordsIsMutable(); + super.addAll(values, records_); + onChanged(); + } else { + recordsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearRecords() { + if (recordsBuilder_ == null) { + records_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + recordsBuilder_.clear(); + } + return this; + } + public Builder removeRecords(int index) { + if (recordsBuilder_ == null) { + ensureRecordsIsMutable(); + records_.remove(index); + onChanged(); + } else { + recordsBuilder_.remove(index); + } + return this; + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder getRecordsBuilder( + int index) { + return getRecordsFieldBuilder().getBuilder(index); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.RecordOrBuilder getRecordsOrBuilder( + int index) { + if (recordsBuilder_ == null) { + return records_.get(index); } else { + return recordsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getRecordsOrBuilderList() { + if (recordsBuilder_ != null) { + return recordsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(records_); + } + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder addRecordsBuilder() { + return getRecordsFieldBuilder().addBuilder( + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.getDefaultInstance()); + } + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder addRecordsBuilder( + int index) { + return getRecordsFieldBuilder().addBuilder( + index, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.getDefaultInstance()); + } + public java.util.List + getRecordsBuilderList() { + return getRecordsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.RecordOrBuilder> + getRecordsFieldBuilder() { + if (recordsBuilder_ == null) { + recordsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder, com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.RecordOrBuilder>( + records_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + records_ = null; + } + return recordsBuilder_; + } + + // required string next_token = 2; + private java.lang.Object nextToken_ = ""; + public boolean hasNextToken() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getNextToken() { + java.lang.Object ref = nextToken_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + nextToken_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setNextToken(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + nextToken_ = value; + onChanged(); + return this; + } + public Builder clearNextToken() { + bitField0_ = (bitField0_ & ~0x00000002); + nextToken_ = getDefaultInstance().getNextToken(); + onChanged(); + return this; + } + void setNextToken(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + nextToken_ = value; + onChanged(); + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.ReadRecordsResponse) + } + + static { + defaultInstance = new ReadRecordsResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.ReadRecordsResponse) + } + + public interface TokenOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required int64 version = 1; + boolean hasVersion(); + long getVersion(); + + // required bytes content = 2; + boolean hasContent(); + com.google.protobuf.ByteString getContent(); + } + public static final class Token extends + com.google.protobuf.GeneratedMessage + implements TokenOrBuilder { + // Use Token.newBuilder() to construct. + private Token(Builder builder) { + super(builder); + } + private Token(boolean noInit) {} + + private static final Token defaultInstance; + public static Token getDefaultInstance() { + return defaultInstance; + } + + public Token getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_fieldAccessorTable; + } + + private int bitField0_; + // required int64 version = 1; + public static final int VERSION_FIELD_NUMBER = 1; + private long version_; + public boolean hasVersion() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getVersion() { + return version_; + } + + // required bytes content = 2; + public static final int CONTENT_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString content_; + public boolean hasContent() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getContent() { + return content_; + } + + private void initFields() { + version_ = 0L; + content_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasVersion()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasContent()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, version_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, content_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, version_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, content_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + version_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + content_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.version_ = version_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.content_ = content_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token.getDefaultInstance()) return this; + if (other.hasVersion()) { + setVersion(other.getVersion()); + } + if (other.hasContent()) { + setContent(other.getContent()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasVersion()) { + + return false; + } + if (!hasContent()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + version_ = input.readInt64(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + content_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required int64 version = 1; + private long version_ ; + public boolean hasVersion() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getVersion() { + return version_; + } + public Builder setVersion(long value) { + bitField0_ |= 0x00000001; + version_ = value; + onChanged(); + return this; + } + public Builder clearVersion() { + bitField0_ = (bitField0_ & ~0x00000001); + version_ = 0L; + onChanged(); + return this; + } + + // required bytes content = 2; + private com.google.protobuf.ByteString content_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasContent() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getContent() { + return content_; + } + public Builder setContent(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + content_ = value; + onChanged(); + return this; + } + public Builder clearContent() { + bitField0_ = (bitField0_ & ~0x00000002); + content_ = getDefaultInstance().getContent(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.Token) + } + + static { + defaultInstance = new Token(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.Token) + } + + public interface TokenContentOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional bytes primary_key = 1; + boolean hasPrimaryKey(); + com.google.protobuf.ByteString getPrimaryKey(); + + // optional string iterator = 2; + boolean hasIterator(); + String getIterator(); + + // optional int64 timestamp = 3; + boolean hasTimestamp(); + long getTimestamp(); + } + public static final class TokenContent extends + com.google.protobuf.GeneratedMessage + implements TokenContentOrBuilder { + // Use TokenContent.newBuilder() to construct. + private TokenContent(Builder builder) { + super(builder); + } + private TokenContent(boolean noInit) {} + + private static final TokenContent defaultInstance; + public static TokenContent getDefaultInstance() { + return defaultInstance; + } + + public TokenContent getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_fieldAccessorTable; + } + + private int bitField0_; + // optional bytes primary_key = 1; + public static final int PRIMARY_KEY_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString primaryKey_; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + + // optional string iterator = 2; + public static final int ITERATOR_FIELD_NUMBER = 2; + private java.lang.Object iterator_; + public boolean hasIterator() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIterator() { + java.lang.Object ref = iterator_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + iterator_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIteratorBytes() { + java.lang.Object ref = iterator_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + iterator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int64 timestamp = 3; + public static final int TIMESTAMP_FIELD_NUMBER = 3; + private long timestamp_; + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getTimestamp() { + return timestamp_; + } + + private void initFields() { + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + iterator_ = ""; + timestamp_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, primaryKey_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIteratorBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, timestamp_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, primaryKey_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIteratorBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, timestamp_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + iterator_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + timestamp_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.primaryKey_ = primaryKey_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.iterator_ = iterator_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.timestamp_ = timestamp_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent.getDefaultInstance()) return this; + if (other.hasPrimaryKey()) { + setPrimaryKey(other.getPrimaryKey()); + } + if (other.hasIterator()) { + setIterator(other.getIterator()); + } + if (other.hasTimestamp()) { + setTimestamp(other.getTimestamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + primaryKey_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + iterator_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + timestamp_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional bytes primary_key = 1; + private com.google.protobuf.ByteString primaryKey_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + public Builder setPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + primaryKey_ = value; + onChanged(); + return this; + } + public Builder clearPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000001); + primaryKey_ = getDefaultInstance().getPrimaryKey(); + onChanged(); + return this; + } + + // optional string iterator = 2; + private java.lang.Object iterator_ = ""; + public boolean hasIterator() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIterator() { + java.lang.Object ref = iterator_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + iterator_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIterator(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + iterator_ = value; + onChanged(); + return this; + } + public Builder clearIterator() { + bitField0_ = (bitField0_ & ~0x00000002); + iterator_ = getDefaultInstance().getIterator(); + onChanged(); + return this; + } + void setIterator(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + iterator_ = value; + onChanged(); + } + + // optional int64 timestamp = 3; + private long timestamp_ ; + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getTimestamp() { + return timestamp_; + } + public Builder setTimestamp(long value) { + bitField0_ |= 0x00000004; + timestamp_ = value; + onChanged(); + return this; + } + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000004); + timestamp_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TokenContent) + } + + static { + defaultInstance = new TokenContent(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TokenContent) + } + + public interface TokenContentV2OrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional bytes primary_key = 1; + boolean hasPrimaryKey(); + com.google.protobuf.ByteString getPrimaryKey(); + + // optional string iterator = 2; + boolean hasIterator(); + String getIterator(); + + // optional int64 timestamp = 3; + boolean hasTimestamp(); + long getTimestamp(); + + // optional int64 total_count = 4; + boolean hasTotalCount(); + long getTotalCount(); + } + public static final class TokenContentV2 extends + com.google.protobuf.GeneratedMessage + implements TokenContentV2OrBuilder { + // Use TokenContentV2.newBuilder() to construct. + private TokenContentV2(Builder builder) { + super(builder); + } + private TokenContentV2(boolean noInit) {} + + private static final TokenContentV2 defaultInstance; + public static TokenContentV2 getDefaultInstance() { + return defaultInstance; + } + + public TokenContentV2 getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_fieldAccessorTable; + } + + private int bitField0_; + // optional bytes primary_key = 1; + public static final int PRIMARY_KEY_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString primaryKey_; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + + // optional string iterator = 2; + public static final int ITERATOR_FIELD_NUMBER = 2; + private java.lang.Object iterator_; + public boolean hasIterator() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIterator() { + java.lang.Object ref = iterator_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + iterator_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getIteratorBytes() { + java.lang.Object ref = iterator_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + iterator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int64 timestamp = 3; + public static final int TIMESTAMP_FIELD_NUMBER = 3; + private long timestamp_; + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getTimestamp() { + return timestamp_; + } + + // optional int64 total_count = 4; + public static final int TOTAL_COUNT_FIELD_NUMBER = 4; + private long totalCount_; + public boolean hasTotalCount() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getTotalCount() { + return totalCount_; + } + + private void initFields() { + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + iterator_ = ""; + timestamp_ = 0L; + totalCount_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, primaryKey_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getIteratorBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, timestamp_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt64(4, totalCount_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, primaryKey_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getIteratorBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, timestamp_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(4, totalCount_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2OrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_fieldAccessorTable; + } + + // Construct using com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + primaryKey_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + iterator_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + timestamp_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + totalCount_ = 0L; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2.getDescriptor(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 getDefaultInstanceForType() { + return com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2.getDefaultInstance(); + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 build() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 buildPartial() { + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 result = new com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.primaryKey_ = primaryKey_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.iterator_ = iterator_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.timestamp_ = timestamp_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.totalCount_ = totalCount_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2) { + return mergeFrom((com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2 other) { + if (other == com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2.getDefaultInstance()) return this; + if (other.hasPrimaryKey()) { + setPrimaryKey(other.getPrimaryKey()); + } + if (other.hasIterator()) { + setIterator(other.getIterator()); + } + if (other.hasTimestamp()) { + setTimestamp(other.getTimestamp()); + } + if (other.hasTotalCount()) { + setTotalCount(other.getTotalCount()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + primaryKey_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + iterator_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + timestamp_ = input.readInt64(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + totalCount_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional bytes primary_key = 1; + private com.google.protobuf.ByteString primaryKey_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasPrimaryKey() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.google.protobuf.ByteString getPrimaryKey() { + return primaryKey_; + } + public Builder setPrimaryKey(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + primaryKey_ = value; + onChanged(); + return this; + } + public Builder clearPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000001); + primaryKey_ = getDefaultInstance().getPrimaryKey(); + onChanged(); + return this; + } + + // optional string iterator = 2; + private java.lang.Object iterator_ = ""; + public boolean hasIterator() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getIterator() { + java.lang.Object ref = iterator_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + iterator_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setIterator(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + iterator_ = value; + onChanged(); + return this; + } + public Builder clearIterator() { + bitField0_ = (bitField0_ & ~0x00000002); + iterator_ = getDefaultInstance().getIterator(); + onChanged(); + return this; + } + void setIterator(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + iterator_ = value; + onChanged(); + } + + // optional int64 timestamp = 3; + private long timestamp_ ; + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getTimestamp() { + return timestamp_; + } + public Builder setTimestamp(long value) { + bitField0_ |= 0x00000004; + timestamp_ = value; + onChanged(); + return this; + } + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000004); + timestamp_ = 0L; + onChanged(); + return this; + } + + // optional int64 total_count = 4; + private long totalCount_ ; + public boolean hasTotalCount() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getTotalCount() { + return totalCount_; + } + public Builder setTotalCount(long value) { + bitField0_ |= 0x00000008; + totalCount_ = value; + onChanged(); + return this; + } + public Builder clearTotalCount() { + bitField0_ = (bitField0_ & ~0x00000008); + totalCount_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alicloud.openservices.tablestore.core.protocol.TokenContentV2) + } + + static { + defaultInstance = new TokenContentV2(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alicloud.openservices.tablestore.core.protocol.TokenContentV2) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\030tunnel_service_api.proto\0222com.alicloud" + + ".openservices.tablestore.core.protocol\"9" + + "\n\005Error\022\014\n\004code\030\001 \002(\t\022\017\n\007message\030\002 \001(\t\022\021" + + "\n\ttunnel_id\030\003 \001(\t\"\206\001\n\006Tunnel\022\022\n\ntable_na" + + "me\030\001 \002(\t\022\023\n\013tunnel_name\030\003 \002(\t\022S\n\013tunnel_" + + "type\030\004 \002(\0162>.com.alicloud.openservices.t" + + "ablestore.core.protocol.TunnelType\"a\n\023Cr" + + "eateTunnelRequest\022J\n\006tunnel\030\001 \002(\0132:.com." + + "alicloud.openservices.tablestore.core.pr" + + "otocol.Tunnel\")\n\024CreateTunnelResponse\022\021\n", + "\ttunnel_id\030\001 \002(\t\"Q\n\023DeleteTunnelRequest\022" + + "\022\n\ntable_name\030\001 \002(\t\022\023\n\013tunnel_name\030\002 \002(\t" + + "\022\021\n\ttunnel_id\030\003 \001(\t\"\026\n\024DeleteTunnelRespo" + + "nse\"\'\n\021ListTunnelRequest\022\022\n\ntable_name\030\001" + + " \001(\t\"\267\001\n\nTunnelInfo\022\021\n\ttunnel_id\030\001 \002(\t\022\023" + + "\n\013tunnel_type\030\002 \002(\t\022\022\n\ntable_name\030\003 \002(\t\022" + + "\025\n\rinstance_name\030\004 \002(\t\022\021\n\tstream_id\030\005 \002(" + + "\t\022\r\n\005stage\030\006 \002(\t\022\017\n\007expired\030\007 \001(\010\022\023\n\013tun" + + "nel_name\030\010 \001(\t\022\016\n\006public\030\t \001(\010\"e\n\022ListTu" + + "nnelResponse\022O\n\007tunnels\030\001 \003(\0132>.com.alic", + "loud.openservices.tablestore.core.protoc" + + "ol.TunnelInfo\"S\n\025DescribeTunnelRequest\022\022" + + "\n\ntable_name\030\001 \002(\t\022\023\n\013tunnel_name\030\002 \002(\t\022" + + "\021\n\ttunnel_id\030\003 \001(\t\"\216\001\n\013ChannelInfo\022\022\n\nch" + + "annel_id\030\001 \002(\t\022\024\n\014channel_type\030\002 \001(\t\022\026\n\016" + + "channel_status\030\003 \001(\t\022\021\n\tclient_id\030\004 \001(\t\022" + + "\023\n\013channel_rpo\030\005 \001(\003\022\025\n\rchannel_count\030\006 " + + "\001(\003\"\317\001\n\026DescribeTunnelResponse\022N\n\006tunnel" + + "\030\001 \002(\0132>.com.alicloud.openservices.table" + + "store.core.protocol.TunnelInfo\022Q\n\010channe", + "ls\030\002 \003(\0132?.com.alicloud.openservices.tab" + + "lestore.core.protocol.ChannelInfo\022\022\n\ntun" + + "nel_rpo\030\003 \001(\003\"\"\n\rGetRpoRequest\022\021\n\ttunnel" + + "_id\030\001 \001(\t\"=\n\016GetRpoResponse\022\021\n\trpo_infos" + + "\030\001 \001(\014\022\030\n\020tunnel_rpo_infos\030\002 \001(\014\"3\n\014Clie" + + "ntConfig\022\017\n\007timeout\030\001 \001(\003\022\022\n\nclient_tag\030" + + "\002 \001(\t\"|\n\016ConnectRequest\022\021\n\ttunnel_id\030\001 \002" + + "(\t\022W\n\rclient_config\030\002 \001(\0132@.com.alicloud" + + ".openservices.tablestore.core.protocol.C" + + "lientConfig\"$\n\017ConnectResponse\022\021\n\tclient", + "_id\030\001 \002(\t\"\221\001\n\007Channel\022\022\n\nchannel_id\030\001 \002(" + + "\t\022\017\n\007version\030\002 \002(\003\022Q\n\006status\030\003 \002(\0162A.com" + + ".alicloud.openservices.tablestore.core.p" + + "rotocol.ChannelStatus\022\016\n\006detail\030\004 \001(\014\"\207\001" + + "\n\020HeartbeatRequest\022\021\n\ttunnel_id\030\001 \002(\t\022\021\n" + + "\tclient_id\030\002 \002(\t\022M\n\010channels\030\003 \003(\0132;.com" + + ".alicloud.openservices.tablestore.core.p" + + "rotocol.Channel\"b\n\021HeartbeatResponse\022M\n\010" + + "channels\030\001 \003(\0132;.com.alicloud.openservic" + + "es.tablestore.core.protocol.Channel\"7\n\017S", + "hutdownRequest\022\021\n\ttunnel_id\030\001 \002(\t\022\021\n\tcli" + + "ent_id\030\002 \002(\t\"\022\n\020ShutdownResponse\"p\n\022Lock" + + "ChannelRequest\022\021\n\ttunnel_id\030\001 \002(\t\022\021\n\tcli" + + "ent_id\030\002 \002(\t\022\022\n\nchannel_id\030\003 \002(\t\022\017\n\007lock" + + "_id\030\004 \002(\t\022\017\n\007timeout\030\005 \002(\003\"\025\n\023LockChanne" + + "lResponse\"a\n\024UnlockChannelRequest\022\021\n\ttun" + + "nel_id\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022\022\n\nchann" + + "el_id\030\003 \002(\t\022\017\n\007lock_id\030\004 \002(\t\"\027\n\025UnlockCh" + + "annelResponse\"P\n\024GetCheckpointRequest\022\021\n" + + "\ttunnel_id\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022\022\n\nc", + "hannel_id\030\003 \002(\t\"D\n\025GetCheckpointResponse" + + "\022\022\n\ncheckpoint\030\001 \002(\t\022\027\n\017sequence_number\030" + + "\002 \002(\003\"z\n\021CheckpointRequest\022\021\n\ttunnel_id\030" + + "\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022\022\n\nchannel_id\030\003" + + " \002(\t\022\022\n\ncheckpoint\030\004 \002(\t\022\027\n\017sequence_num" + + "ber\030\005 \002(\003\"\024\n\022CheckpointResponse\"]\n\022ReadR" + + "ecordsRequest\022\021\n\ttunnel_id\030\001 \002(\t\022\021\n\tclie" + + "nt_id\030\002 \002(\t\022\022\n\nchannel_id\030\003 \002(\t\022\r\n\005token" + + "\030\004 \002(\t\"m\n\006Record\022S\n\013action_type\030\001 \002(\0162>." + + "com.alicloud.openservices.tablestore.cor", + "e.protocol.ActionType\022\016\n\006record\030\002 \002(\014\"v\n" + + "\023ReadRecordsResponse\022K\n\007records\030\001 \003(\0132:." + + "com.alicloud.openservices.tablestore.cor" + + "e.protocol.Record\022\022\n\nnext_token\030\002 \002(\t\")\n" + + "\005Token\022\017\n\007version\030\001 \002(\003\022\017\n\007content\030\002 \002(\014" + + "\"H\n\014TokenContent\022\023\n\013primary_key\030\001 \001(\014\022\020\n" + + "\010iterator\030\002 \001(\t\022\021\n\ttimestamp\030\003 \001(\003\"_\n\016To" + + "kenContentV2\022\023\n\013primary_key\030\001 \001(\014\022\020\n\010ite" + + "rator\030\002 \001(\t\022\021\n\ttimestamp\030\003 \001(\003\022\023\n\013total_" + + "count\030\004 \001(\003*9\n\nTunnelType\022\014\n\010BaseData\020\001\022", + "\n\n\006Stream\020\002\022\021\n\rBaseAndStream\020\003*A\n\rChanne" + + "lStatus\022\010\n\004OPEN\020\001\022\013\n\007CLOSING\020\002\022\t\n\005CLOSE\020" + + "\003\022\016\n\nTERMINATED\020\004*9\n\nActionType\022\013\n\007PUT_R" + + "OW\020\001\022\016\n\nUPDATE_ROW\020\002\022\016\n\nDELETE_ROW\020\003" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Error_descriptor, + new java.lang.String[] { "Code", "Message", "TunnelId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Error.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Tunnel_descriptor, + new java.lang.String[] { "TableName", "TunnelName", "TunnelType", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Tunnel.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelRequest_descriptor, + new java.lang.String[] { "Tunnel", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CreateTunnelResponse_descriptor, + new java.lang.String[] { "TunnelId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CreateTunnelResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelRequest_descriptor, + new java.lang.String[] { "TableName", "TunnelName", "TunnelId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DeleteTunnelResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DeleteTunnelResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelRequest_descriptor, + new java.lang.String[] { "TableName", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TunnelInfo_descriptor, + new java.lang.String[] { "TunnelId", "TunnelType", "TableName", "InstanceName", "StreamId", "Stage", "Expired", "TunnelName", "Public", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TunnelInfo.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ListTunnelResponse_descriptor, + new java.lang.String[] { "Tunnels", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ListTunnelResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelRequest_descriptor, + new java.lang.String[] { "TableName", "TunnelName", "TunnelId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ChannelInfo_descriptor, + new java.lang.String[] { "ChannelId", "ChannelType", "ChannelStatus", "ClientId", "ChannelRpo", "ChannelCount", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ChannelInfo.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_DescribeTunnelResponse_descriptor, + new java.lang.String[] { "Tunnel", "Channels", "TunnelRpo", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.DescribeTunnelResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoRequest_descriptor, + new java.lang.String[] { "TunnelId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetRpoResponse_descriptor, + new java.lang.String[] { "RpoInfos", "TunnelRpoInfos", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetRpoResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_descriptor = + getDescriptor().getMessageTypes().get(14); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ClientConfig_descriptor, + new java.lang.String[] { "Timeout", "ClientTag", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ClientConfig.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientConfig", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ConnectResponse_descriptor, + new java.lang.String[] { "ClientId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ConnectResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Channel_descriptor, + new java.lang.String[] { "ChannelId", "Version", "Status", "Detail", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Channel.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientId", "Channels", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_HeartbeatResponse_descriptor, + new java.lang.String[] { "Channels", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.HeartbeatResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_descriptor = + getDescriptor().getMessageTypes().get(20); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_descriptor = + getDescriptor().getMessageTypes().get(21); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ShutdownResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ShutdownResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_descriptor = + getDescriptor().getMessageTypes().get(22); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientId", "ChannelId", "LockId", "Timeout", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_descriptor = + getDescriptor().getMessageTypes().get(23); + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_LockChannelResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.LockChannelResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_descriptor = + getDescriptor().getMessageTypes().get(24); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientId", "ChannelId", "LockId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_descriptor = + getDescriptor().getMessageTypes().get(25); + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_UnlockChannelResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.UnlockChannelResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_descriptor = + getDescriptor().getMessageTypes().get(26); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientId", "ChannelId", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_descriptor = + getDescriptor().getMessageTypes().get(27); + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_GetCheckpointResponse_descriptor, + new java.lang.String[] { "Checkpoint", "SequenceNumber", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.GetCheckpointResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_descriptor = + getDescriptor().getMessageTypes().get(28); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientId", "ChannelId", "Checkpoint", "SequenceNumber", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_descriptor = + getDescriptor().getMessageTypes().get(29); + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_CheckpointResponse_descriptor, + new java.lang.String[] { }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.CheckpointResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_descriptor = + getDescriptor().getMessageTypes().get(30); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsRequest_descriptor, + new java.lang.String[] { "TunnelId", "ClientId", "ChannelId", "Token", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsRequest.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_descriptor = + getDescriptor().getMessageTypes().get(31); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Record_descriptor, + new java.lang.String[] { "ActionType", "Record", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Record.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_descriptor = + getDescriptor().getMessageTypes().get(32); + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_ReadRecordsResponse_descriptor, + new java.lang.String[] { "Records", "NextToken", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.ReadRecordsResponse.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_descriptor = + getDescriptor().getMessageTypes().get(33); + internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_Token_descriptor, + new java.lang.String[] { "Version", "Content", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.Token.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_descriptor = + getDescriptor().getMessageTypes().get(34); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContent_descriptor, + new java.lang.String[] { "PrimaryKey", "Iterator", "Timestamp", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContent.Builder.class); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_descriptor = + getDescriptor().getMessageTypes().get(35); + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alicloud_openservices_tablestore_core_protocol_TokenContentV2_descriptor, + new java.lang.String[] { "PrimaryKey", "Iterator", "Timestamp", "TotalCount", }, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2.class, + com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi.TokenContentV2.Builder.class); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_filter.proto b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_filter.proto new file mode 100644 index 0000000..d8a8727 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_filter.proto @@ -0,0 +1,47 @@ +syntax = "proto2"; + +package com.alicloud.openservices.tablestore.core.protocol; + +enum FilterType { + FT_SINGLE_COLUMN_VALUE = 1; + FT_COMPOSITE_COLUMN_VALUE = 2; + FT_COLUMN_PAGINATION = 3; +} + +enum ComparatorType { + CT_EQUAL = 1; + CT_NOT_EQUAL = 2; + CT_GREATER_THAN = 3; + CT_GREATER_EQUAL = 4; + CT_LESS_THAN = 5; + CT_LESS_EQUAL = 6; +} + +message SingleColumnValueFilter { + required ComparatorType comparator = 1; + required string column_name = 2; + required bytes column_value = 3; + required bool filter_if_missing = 4; + required bool latest_version_only = 5; +} + +enum LogicalOperator { + LO_NOT = 1; + LO_AND = 2; + LO_OR = 3; +} + +message CompositeColumnValueFilter { + required LogicalOperator combinator = 1; + repeated Filter sub_filters = 2; +} + +message ColumnPaginationFilter { + required int32 offset = 1; + required int32 limit = 2; +} + +message Filter { + required FilterType type = 1; + required bytes filter = 2; // Serialized string of filter of the type +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_internal_api.proto b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_internal_api.proto new file mode 100644 index 0000000..7da7096 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/ots_internal_api.proto @@ -0,0 +1,488 @@ +syntax = "proto2"; + +package com.alicloud.openservices.tablestore.core.protocol; + +message Error { + required string code = 1; + optional string message = 2; +} + +enum PrimaryKeyType { + INTEGER = 1; + STRING = 2; + BINARY = 3; +} + +enum DefinedColumnType { + DCT_INTEGER = 1; + DCT_DOUBLE = 2; + DCT_BOOLEAN = 3; + DCT_STRING = 4; + DCT_BLOB = 7; +} + +enum PrimaryKeyOption { + AUTO_INCREMENT = 1; +} + +message PrimaryKeySchema { + required string name = 1; + required PrimaryKeyType type = 2; + optional PrimaryKeyOption option = 3; +} + +message DefinedColumnSchema { + required string name = 1; + required DefinedColumnType type = 2; +} + +message TableOptions { + optional int32 time_to_live = 1; + optional int32 max_versions = 2; + optional int64 deviation_cell_version_in_sec = 5; +} + +enum IndexUpdateMode { + IUM_ASYNC_INDEX = 0; + IUM_SYNC_INDEX = 1; +} + +enum IndexType { + IT_GLOBAL_INDEX = 0; + IT_LOCAL_INDEX = 1; +} + +message IndexMeta { + required string name = 1; + repeated string primary_key = 2; + repeated string defined_column = 3; + required IndexUpdateMode index_update_mode = 4; + required IndexType index_type = 5; +} + +message TableMeta { + required string table_name = 1; + repeated PrimaryKeySchema primary_key = 2; + repeated DefinedColumnSchema defined_column = 3; +} + +enum RowExistenceExpectation { + IGNORE = 0; + EXPECT_EXIST = 1; + EXPECT_NOT_EXIST = 2; +} + +message Condition { + required RowExistenceExpectation row_existence = 1; + optional bytes column_condition = 2; +} + +message CapacityUnit { + optional int32 read = 1; + optional int32 write = 2; +} + +message ReservedThroughputDetails { + required CapacityUnit capacity_unit = 1; + required int64 last_increase_time = 2; + optional int64 last_decrease_time = 3; +} + +message ReservedThroughput { + required CapacityUnit capacity_unit = 1; +} + +message ConsumedCapacity { + required CapacityUnit capacity_unit = 1; +} + +message StreamSpecification { + required bool enable_stream = 1; + optional int32 expiration_time = 2; +} + +message StreamDetails { + required bool enable_stream = 1; + optional string stream_id = 2; + optional int32 expiration_time = 3; + optional int64 last_enable_time = 4; +} + +message CreateTableRequest { + required TableMeta table_meta = 1; + required ReservedThroughput reserved_throughput = 2; + optional TableOptions table_options = 3; + optional StreamSpecification stream_spec = 5; + repeated IndexMeta index_metas = 7; +} + +message CreateTableResponse { +} + +message CreateIndexRequest { + required string main_table_name = 1; + required IndexMeta index_meta = 2; + optional bool include_base_data = 3; +} + +message CreateIndexResponse { +} + +message DropIndexRequest { + required string main_table_name = 1; + required string index_name = 2; +} + +message DropIndexResponse { +} + +message UpdateTableRequest { + required string table_name = 1; + optional ReservedThroughput reserved_throughput = 2; + optional TableOptions table_options = 3; + optional StreamSpecification stream_spec = 4; +} + +message UpdateTableResponse { + required ReservedThroughputDetails reserved_throughput_details = 1; + required TableOptions table_options = 2; + optional StreamDetails stream_details = 3; +} +message DescribeTableRequest { + required string table_name = 1; +} + +message DescribeTableResponse { + required TableMeta table_meta = 1; + required ReservedThroughputDetails reserved_throughput_details = 2; + required TableOptions table_options = 3; + optional StreamDetails stream_details = 5; + repeated bytes shard_splits = 6; + repeated IndexMeta index_metas = 8; +} +message ListTableRequest { +} + +message ListTableResponse { + repeated string table_names = 1; +} +message DeleteTableRequest { + required string table_name = 1; +} + +message DeleteTableResponse { +} +message LoadTableRequest { + required string table_name = 1; +} + +message LoadTableResponse { +} +message UnloadTableRequest { + required string table_name = 1; +} + +message UnloadTableResponse { + +} +message TimeRange { + optional int64 start_time = 1; + optional int64 end_time = 2; + optional int64 specific_time = 3; +} + +enum ReturnType { + RT_NONE = 0; + RT_PK = 1; + RT_AFTER_MODIFY = 2; +} + +message ReturnContent { + optional ReturnType return_type = 1; + repeated string return_column_names = 2; +} + +message GetRowRequest { + required string table_name = 1; + required bytes primary_key = 2; + repeated string columns_to_get = 3; + optional TimeRange time_range = 4; + optional int32 max_versions = 5; + optional bytes filter = 7; + optional string start_column = 8; + optional string end_column = 9; + optional bytes token = 10; + optional string transaction_id = 11; +} + +message GetRowResponse { + required ConsumedCapacity consumed = 1; + required bytes row = 2; + optional bytes next_token = 3; +} +message UpdateRowRequest { + required string table_name = 1; + required bytes row_change = 2; + required Condition condition = 3; + optional ReturnContent return_content = 4; + optional string transaction_id = 5; +} + +message UpdateRowResponse { + required ConsumedCapacity consumed = 1; + optional bytes row = 2; +} +message PutRowRequest { + required string table_name = 1; + required bytes row = 2; + required Condition condition = 3; + optional ReturnContent return_content = 4; + optional string transaction_id = 5; +} + +message PutRowResponse { + required ConsumedCapacity consumed = 1; + optional bytes row = 2; +} +message DeleteRowRequest { + required string table_name = 1; + required bytes primary_key = 2; + required Condition condition = 3; + optional ReturnContent return_content = 4; + optional string transaction_id = 5; +} + +message DeleteRowResponse { + required ConsumedCapacity consumed = 1; + optional bytes row = 2; +} +message TableInBatchGetRowRequest { + required string table_name = 1; + repeated bytes primary_key = 2; + repeated bytes token = 3; + repeated string columns_to_get = 4; + optional TimeRange time_range = 5; + optional int32 max_versions = 6; + optional bytes filter = 8; + optional string start_column = 9; + optional string end_column = 10; +} + +message BatchGetRowRequest { + repeated TableInBatchGetRowRequest tables = 1; +} + +message RowInBatchGetRowResponse { + required bool is_ok = 1; + optional Error error = 2; + optional ConsumedCapacity consumed = 3; + optional bytes row = 4; + optional bytes next_token = 5; +} + +message TableInBatchGetRowResponse { + required string table_name = 1; + repeated RowInBatchGetRowResponse rows = 2; +} + +message BatchGetRowResponse { + repeated TableInBatchGetRowResponse tables = 1; +} + +enum OperationType { + PUT = 1; + UPDATE = 2; + DELETE = 3; +} + +message RowInBatchWriteRowRequest { + required OperationType type = 1; + required bytes row_change = 2; + required Condition condition = 3; + optional ReturnContent return_content = 4; +} + +message TableInBatchWriteRowRequest { + required string table_name = 1; + repeated RowInBatchWriteRowRequest rows = 2; +} + +message BatchWriteRowRequest { + repeated TableInBatchWriteRowRequest tables = 1; + optional string transaction_id = 2; +} + +message RowInBatchWriteRowResponse { + required bool is_ok = 1; + optional Error error = 2; + optional ConsumedCapacity consumed = 3; + optional bytes row = 4; +} + +message TableInBatchWriteRowResponse { + required string table_name = 1; + repeated RowInBatchWriteRowResponse rows = 2; +} + +message BatchWriteRowResponse { + repeated TableInBatchWriteRowResponse tables = 1; +} +enum Direction { + FORWARD = 0; + BACKWARD = 1; +} + +message GetRangeRequest { + required string table_name = 1; + required Direction direction = 2; + repeated string columns_to_get = 3; + optional TimeRange time_range = 4; + optional int32 max_versions = 5; + optional int32 limit = 6; + required bytes inclusive_start_primary_key = 7; + required bytes exclusive_end_primary_key = 8; + optional bytes filter = 10; + optional string start_column = 11; + optional string end_column = 12; + optional bytes token = 13; + optional string transaction_id = 14; +} + +message GetRangeResponse { + required ConsumedCapacity consumed = 1; + required bytes rows = 2; + optional bytes next_start_primary_key = 3; + optional bytes next_token = 4; +} + +message StartLocalTransactionRequest { + required string table_name = 1; + required bytes key = 2; +} + +message StartLocalTransactionResponse { + required string transaction_id = 1; +}; + +message CommitTransactionRequest { + required string transaction_id = 1; +} + +message CommitTransactionResponse { +}; + +message AbortTransactionRequest { + required string transaction_id = 1; +} + +message AbortTransactionResponse { +}; + + +message ListStreamRequest { + optional string table_name = 1; +} + +message Stream { + required string stream_id = 1; + required string table_name = 2; + required int64 creation_time = 3; +} + +message ListStreamResponse { + repeated Stream streams = 1; +} + +message StreamShard { + required string shard_id = 1; + optional string parent_id = 2; + optional string parent_sibling_id = 3; +} + +enum StreamStatus { + STREAM_ENABLING = 1; + STREAM_ACTIVE = 2; +} + +message DescribeStreamRequest { + required string stream_id = 1; + optional string inclusive_start_shard_id = 2; + optional int32 shard_limit = 3; +} + +message DescribeStreamResponse { + required string stream_id = 1; + required int32 expiration_time = 2; + required string table_name = 3; + required int64 creation_time = 4; + required StreamStatus stream_status = 5; + repeated StreamShard shards = 6; + optional string next_shard_id = 7; +} + +message GetShardIteratorRequest { + required string stream_id = 1; + required string shard_id = 2; +} + +message GetShardIteratorResponse { + required string shard_iterator = 1; +} + +message GetStreamRecordRequest { + required string shard_iterator = 1; + optional int32 limit = 2; +} + +enum ActionType { + PUT_ROW = 1; + UPDATE_ROW = 2; + DELETE_ROW = 3; +} + +message GetStreamRecordResponse { + message StreamRecord { + required ActionType action_type = 1; + required bytes record = 2; + } + repeated StreamRecord stream_records = 1; + optional string next_shard_iterator = 2; +} + +message ComputeSplitPointsBySizeRequest { + required string table_name = 1; + required int64 split_size = 2; // in 100MB + optional int64 split_size_unit_in_byte = 3; +} + +message ComputeSplitPointsBySizeResponse { + required ConsumedCapacity consumed = 1; + repeated PrimaryKeySchema schema = 2; + + /** + * Split points between splits, in the increasing order + * + * A split is a consecutive range of primary keys, + * whose data size is about split_size specified in the request. + * The size could be hard to be precise. + * + * A split point is an array of primary-key column w.r.t. table schema, + * which is never longer than that of table schema. + * Tailing -inf will be omitted to reduce transmission payloads. + */ + repeated bytes split_points = 3; + + /** + * Locations where splits lies in. + * + * By the managed nature of TableStore, these locations are no more than hints. + * If a location is not suitable to be seen, an empty string will be placed. + */ + message SplitLocation { + required string location = 1; + required sint64 repeat = 2; + } + repeated SplitLocation locations = 4; +} +/* -------------------------------------- */ + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/search.proto b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/search.proto new file mode 100644 index 0000000..378dfba --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/search.proto @@ -0,0 +1,333 @@ +syntax = "proto2"; + +package com.alicloud.openservices.tablestore.core.protocol; + +enum QueryType { + MATCH_QUERY = 1; + MATCH_PHRASE_QUERY = 2; + TERM_QUERY = 3; + RANGE_QUERY = 4; + PREFIX_QUERY = 5; + BOOL_QUERY = 6; + CONST_SCORE_QUERY = 7; + FUNCTION_SCORE_QUERY = 8; + NESTED_QUERY = 9; + WILDCARD_QUERY = 10; + MATCH_ALL_QUERY = 11; + GEO_BOUNDING_BOX_QUERY = 12; + GEO_DISTANCE_QUERY = 13; + GEO_POLYGON_QUERY = 14; + TERMS_QUERY = 15; +} + +enum QueryOperator { + OR = 1; + AND = 2; +} + +message MatchQuery { + optional string field_name = 1; + optional string text = 2; + optional int32 minimum_should_match = 3; + optional QueryOperator operator = 4; +} + +message MatchPhraseQuery { + optional string field_name = 1; + optional string text = 2; +} + +message MatchAllQuery { +} + +message TermQuery { + optional string field_name = 1; + optional bytes term = 2; +} + +message TermsQuery { + optional string field_name = 1; + repeated bytes terms = 2; +} + +message RangeQuery { + optional string field_name = 1; + optional bytes range_from = 2; // variant value + optional bytes range_to = 3; // variant value + optional bool include_lower = 4; + optional bool include_upper = 5; +} + +message PrefixQuery { + optional string field_name = 1; + optional string prefix = 2; +} + +message WildcardQuery { + optional string field_name = 1; + optional string value = 2; +} + +message BoolQuery { + repeated Query must_queries = 1; + repeated Query must_not_queries = 2; + repeated Query filter_queries = 3; + repeated Query should_queries = 4; + optional int32 minimum_should_match = 5; +} + +message ConstScoreQuery { + optional Query filter = 1; +} + +message FieldValueFactor { + optional string field_name = 1; +} + +message FunctionScoreQuery { + optional Query query = 1; + optional FieldValueFactor field_value_factor = 2; +} + +enum ScoreMode { + SCORE_MODE_NONE = 1; + SCORE_MODE_AVG = 2; + SCORE_MODE_MAX = 3; + SCORE_MODE_TOTAL = 4; + SCORE_MODE_MIN = 5; +} + +message NestedQuery { + optional string path = 1; + optional Query query = 2; + optional ScoreMode score_mode = 3; +} + +message GeoBoundingBoxQuery { + optional string field_name = 1; + optional string top_left = 2; + optional string bottom_right = 3; +} + +message GeoDistanceQuery { + optional string field_name = 1; + optional string center_point = 2; + optional double distance = 3; +} + +message GeoPolygonQuery { + optional string field_name = 1; + repeated string points = 2; +} + +message Query { + optional QueryType type = 1; + optional bytes query = 2; +} + +message Collapse { + optional string field_name = 1; +} + +message NestedFilter { + optional string path = 1; + optional Query filter = 2; +} + +enum SortOrder { + SORT_ORDER_ASC = 0; + SORT_ORDER_DESC = 1; +} + +enum SortMode { + SORT_MODE_MIN = 0; + SORT_MODE_MAX = 1; + SORT_MODE_AVG = 2; +} + +message ScoreSort { + optional SortOrder order = 1; +} + +message PrimaryKeySort { + optional SortOrder order = 1; +} + +message FieldSort { + optional string field_name = 1; + optional SortOrder order = 2; + optional SortMode mode = 3; + optional NestedFilter nested_filter = 4; +} + +enum GeoDistanceType { + GEO_DISTANCE_ARC = 0; + GEO_DISTANCE_PLANE = 1; +} + +message GeoDistanceSort { + optional string field_name = 1; + repeated string points = 2; + optional SortOrder order = 3; + optional SortMode mode = 4; + optional GeoDistanceType distance_type = 5; + optional NestedFilter nested_filter = 6; +} + +message Sorter { + optional FieldSort field_sort = 1; + optional GeoDistanceSort geo_distance_sort = 2; + optional ScoreSort score_sort = 3; + optional PrimaryKeySort pk_sort = 4; +} + +message Sort { + repeated Sorter sorter = 1; +} + +message SearchQuery { + optional int32 offset = 1; + optional int32 limit = 2; + optional Query query = 4; + optional Collapse collapse = 5; + optional Sort sort = 6; + optional bool getTotalCount = 8; + optional bytes token = 9; +} + +enum ColumnReturnType { + RETURN_ALL = 1; + RETURN_SPECIFIED = 2; + RETURN_NONE = 3; +} + +message ColumnsToGet { + optional ColumnReturnType return_type = 1; + repeated string column_names = 2; +} + +message SearchRequest { + optional string table_name = 1; + optional string index_name = 2; + optional ColumnsToGet columns_to_get = 3; + optional bytes search_query = 4; + repeated bytes routing_values = 5; +} + +/** + * Response֣ + **/ +message SearchResponse { + optional int64 total_hits = 1; + repeated bytes rows = 2; + optional bool is_all_succeeded = 3; + optional bytes next_token = 6; +} + +/* Create Search Index */ + +enum IndexOptions { + DOCS = 1; + FREQS = 2; + POSITIONS = 3; + OFFSETS = 4; +} + +enum FieldType { + LONG = 1; + DOUBLE = 2; + BOOLEAN = 3; + KEYWORD = 4; + TEXT = 5; + NESTED = 6; + GEO_POINT = 7; +} + +message FieldSchema { + optional string field_name = 1; + optional FieldType field_type = 2; + optional IndexOptions index_options = 3; + optional string analyzer = 4; + optional bool index = 5; + optional bool doc_values = 6; + optional bool store = 7; + repeated FieldSchema field_schemas = 8; // only for nested type + optional bool is_array = 9; +} + +message IndexSchema { + repeated FieldSchema field_schemas = 1; + optional IndexSetting index_setting = 2; + optional Sort index_sort = 3; +} + +message IndexSetting { + optional int32 number_of_shards = 1; + repeated string routing_fields = 2; + optional int32 routing_partition_size = 3; +} + +message CreateSearchIndexRequest { + required string table_name = 1; + required string index_name = 2; + optional IndexSchema schema = 3; +} + +message CreateSearchIndexResponse { +} + +/* List Search Index */ + +message IndexInfo { + optional string table_name = 1; + optional string index_name = 2; +} + +message ListSearchIndexRequest { + optional string table_name = 1; +} + +message ListSearchIndexResponse { + repeated IndexInfo indices = 1; +} + +/* Delete Search Index */ + +message DeleteSearchIndexRequest { + optional string table_name = 1; + optional string index_name = 2; +} + +message DeleteSearchIndexResponse { +} + +/* Describe Search Index */ + +enum SyncPhase { + FULL = 1; + INCR = 2; +} + +message SyncStat { + optional SyncPhase sync_phase = 1; + optional int64 current_sync_timestamp = 2; // ͬȣοTunnelService +} + +message MeteringInfo { + optional int64 storage_size = 1; + optional int64 doc_count = 2; + optional int64 reserved_read_cu = 3; + optional int64 timestamp = 4; +} + +message DescribeSearchIndexRequest { + optional string table_name = 1; + optional string index_name = 2; +} + +message DescribeSearchIndexResponse { + optional IndexSchema schema = 1; + optional SyncStat sync_stat = 2; + optional MeteringInfo metering_info = 3; +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/protocol/tunnel_service_api.proto b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/tunnel_service_api.proto new file mode 100644 index 0000000..6ee8a16 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/protocol/tunnel_service_api.proto @@ -0,0 +1,197 @@ +syntax = "proto2"; + +package com.alicloud.openservices.tablestore.core.protocol; + +enum TunnelType { + BaseData = 1; + Stream = 2; + BaseAndStream = 3; +} + +message Error { + required string code = 1; + optional string message = 2; + optional string tunnel_id = 3; +} + +message Tunnel { + required string table_name = 1; + required string tunnel_name = 3; + required TunnelType tunnel_type = 4; +} + +message CreateTunnelRequest { + required Tunnel tunnel = 1; +} + +message CreateTunnelResponse { + required string tunnel_id = 1; +} + +message DeleteTunnelRequest { + required string table_name = 1; + required string tunnel_name = 2; + optional string tunnel_id = 3; +} + +message DeleteTunnelResponse { +} + +message ListTunnelRequest { + optional string table_name = 1; +} + +message TunnelInfo { + required string tunnel_id = 1; + required string tunnel_type = 2; + required string table_name = 3; + required string instance_name = 4; + required string stream_id = 5; + required string stage = 6; + optional bool expired = 7; + optional string tunnel_name = 8; + optional bool public = 9; +} + +message ListTunnelResponse { + repeated TunnelInfo tunnels = 1; +} + +message DescribeTunnelRequest { + required string table_name = 1; + required string tunnel_name = 2; + optional string tunnel_id = 3; +} + +message ChannelInfo { + required string channel_id = 1; + optional string channel_type = 2; + optional string channel_status = 3; + optional string client_id = 4; + optional int64 channel_rpo = 5; + optional int64 channel_count = 6; +} + +message DescribeTunnelResponse { + required TunnelInfo tunnel = 1; + repeated ChannelInfo channels = 2; + optional int64 tunnel_rpo = 3; +} + +message GetRpoRequest { + optional string tunnel_id = 1; +} + +message GetRpoResponse { + optional bytes rpo_infos = 1; + optional bytes tunnel_rpo_infos = 2; +} + +message ClientConfig { + optional int64 timeout = 1; // seconds + optional string client_tag = 2; +} + +message ConnectRequest { + required string tunnel_id = 1; + optional ClientConfig client_config = 2; +} + +message ConnectResponse { + required string client_id = 1; +} + +enum ChannelStatus { + OPEN = 1; + CLOSING = 2; + CLOSE = 3; + TERMINATED = 4; +} + +message Channel { + required string channel_id = 1; + required int64 version = 2; + required ChannelStatus status = 3; + optional bytes detail = 4; // range等信息,或者是client向master汇报的一些信息,比如处理速度等。 +} + +message HeartbeatRequest { + required string tunnel_id = 1; + required string client_id = 2; + repeated Channel channels = 3; +} + +message HeartbeatResponse { + repeated Channel channels = 1; +} + +message ShutdownRequest { + required string tunnel_id = 1; + required string client_id = 2; +} + +message ShutdownResponse { +} + +message GetCheckpointRequest { + required string tunnel_id = 1; + required string client_id = 2; + required string channel_id = 3; +} + +message GetCheckpointResponse { + required string checkpoint = 1; + required int64 sequence_number = 2; +} + +message CheckpointRequest { + required string tunnel_id = 1; + required string client_id = 2; + required string channel_id = 3; + required string checkpoint = 4; + required int64 sequence_number = 5; +} + +message CheckpointResponse { +} + +message ReadRecordsRequest { + required string tunnel_id = 1; + required string client_id = 2; + required string channel_id = 3; + required string token = 4; +} + +enum ActionType { + PUT_ROW = 1; + UPDATE_ROW = 2; + DELETE_ROW = 3; +} + +message Record { + required ActionType action_type = 1; + required bytes record = 2; +} + +message ReadRecordsResponse { + repeated Record records = 1; + required string next_token = 2; +} + +message Token { + required int64 version = 1; + required bytes content = 2; +} + +message TokenContent { + optional bytes primary_key = 1; + optional string iterator = 2; + optional int64 timestamp = 3; +} + +message TokenContentV2 { + optional bytes primary_key = 1; + optional string iterator = 2; + optional int64 timestamp = 3; + optional int64 total_count = 4; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/Base64.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Base64.java new file mode 100644 index 0000000..04dc702 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Base64.java @@ -0,0 +1,173 @@ +package com.alicloud.openservices.tablestore.core.utils; + +public class Base64 { + private static final char[] encodeMap = initEncodeMap(); + private static final byte[] decodeMap = initDecodeMap(); + private static final byte PADDING = 127; + + private static char[] initEncodeMap() { + char[] map = new char[64]; + int i; + for (i = 0; i < 26; i++) map[i] = (char) ('A' + i); + for (i = 26; i < 52; i++) map[i] = (char) ('a' + (i - 26)); + for (i = 52; i < 62; i++) map[i] = (char) ('0' + (i - 52)); + map[62] = '+'; + map[63] = '/'; + + return map; + } + + private static byte[] initDecodeMap() { + byte[] map = new byte[128]; + int i; + for (i = 0; i < 128; i++) map[i] = -1; + + for (i = 'A'; i <= 'Z'; i++) map[i] = (byte) (i - 'A'); + for (i = 'a'; i <= 'z'; i++) map[i] = (byte) (i - 'a' + 26); + for (i = '0'; i <= '9'; i++) map[i] = (byte) (i - '0' + 52); + map['+'] = 62; + map['/'] = 63; + map['='] = PADDING; + + return map; + } + + public static char encode(int i) { + return encodeMap[i & 0x3F]; + } + + /** + * Encodes a byte array into a char array by doing base64 encoding. + * The caller must supply a big enough buffer. + * + * @return the value of {@code ptr+((len+2)/3)*4}, which is the new offset + * in the output buffer where the further bytes should be placed. + */ + public static int _printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr) { + for (int i = offset; i < len; i += 3) { + switch (len - i) { + case 1: + buf[ptr++] = encode(input[i] >> 2); + buf[ptr++] = encode(((input[i]) & 0x3) << 4); + buf[ptr++] = '='; + buf[ptr++] = '='; + break; + case 2: + buf[ptr++] = encode(input[i] >> 2); + buf[ptr++] = encode( + ((input[i] & 0x3) << 4) | + ((input[i + 1] >> 4) & 0xF)); + buf[ptr++] = encode((input[i + 1] & 0xF) << 2); + buf[ptr++] = '='; + break; + default: + buf[ptr++] = encode(input[i] >> 2); + buf[ptr++] = encode( + ((input[i] & 0x3) << 4) | + ((input[i + 1] >> 4) & 0xF)); + buf[ptr++] = encode( + ((input[i + 1] & 0xF) << 2) | + ((input[i + 2] >> 6) & 0x3)); + buf[ptr++] = encode(input[i + 2] & 0x3F); + break; + } + } + return ptr; + } + + public static String toBase64String(byte[] input, int offset, int len) { + char[] buf = new char[((len + 2) / 3) * 4]; + int ptr = _printBase64Binary(input, offset, len, buf, 0); + assert ptr == buf.length; + return new String(buf); + } + + public static String toBase64String(byte[] binaryData) { + return toBase64String(binaryData, 0, binaryData.length); + } + + /** + * computes the length of binary data speculatively. + *

+ *

+ * Our requirement is to createDefaultSigner byte[] of the exact length to store the binary data. + * If we do this in a straight-forward way, it takes two passes over the data. + * Experiments show that this is a non-trivial overhead (35% or so is spent on + * the first pass in calculating the length.) + *

+ *

+ * So the approach here is that we compute the length speculatively, without looking + * at the whole contents. The obtained speculative value is never less than the + * actual length of the binary data, but it may be bigger. So if the speculation + * goes wrong, we'll pay the cost of reallocation and buffer copying. + *

+ *

+ * If the base64 text is tightly packed with no indentation nor illegal char + * (like what most web services produce), then the speculation of this method + * will be correct, so we get the performance benefit. + */ + private static int guessLength(String text) { + final int len = text.length(); + + // compute the tail '=' chars + int j = len - 1; + for (; j >= 0; j--) { + byte code = decodeMap[text.charAt(j)]; + if (code == PADDING) + continue; + if (code == -1) + // most likely this base64 text is indented. go with the upper bound + return text.length() / 4 * 3; + break; + } + + j++; // text.charAt(j) is now at some base64 char, so +1 to make it the size + int padSize = len - j; + if (padSize > 2) // something is wrong with base64. be safe and go with the upper bound + return text.length() / 4 * 3; + + // so far this base64 looks like it's unindented tightly packed base64. + // take a chance and createDefaultSigner an array with the expected size + return text.length() / 4 * 3 - padSize; + } + + public static byte[] fromBase64String(String text) { + final int buflen = guessLength(text); + final byte[] out = new byte[buflen]; + int o = 0; + + final int len = text.length(); + int i; + + final byte[] quadruplet = new byte[4]; + int q = 0; + + // convert each quadruplet to three bytes. + for (i = 0; i < len; i++) { + char ch = text.charAt(i); + byte v = decodeMap[ch]; + + if (v != -1) + quadruplet[q++] = v; + + if (q == 4) { + // quadruplet is now filled. + out[o++] = (byte) ((quadruplet[0] << 2) | (quadruplet[1] >> 4)); + if (quadruplet[2] != PADDING) + out[o++] = (byte) ((quadruplet[1] << 4) | (quadruplet[2] >> 2)); + if (quadruplet[3] != PADDING) + out[o++] = (byte) ((quadruplet[2] << 6) | (quadruplet[3])); + q = 0; + } + } + + if (buflen == o) // speculation worked out to be OK + return out; + + // we overestimated, so need to createDefaultSigner a new buffer + byte[] nb = new byte[o]; + System.arraycopy(out, 0, nb, 0, o); + return nb; + } + +} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/BinaryUtil.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/BinaryUtil.java similarity index 71% rename from src/main/java/com/aliyun/openservices/ots/utils/BinaryUtil.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/BinaryUtil.java index 7d78bcd..95e4b34 100755 --- a/src/main/java/com/aliyun/openservices/ots/utils/BinaryUtil.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/BinaryUtil.java @@ -1,25 +1,22 @@ -package com.aliyun.openservices.ots.utils; +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ +package com.alicloud.openservices.tablestore.core.utils; + +import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import javax.xml.bind.DatatypeConverter; - public class BinaryUtil { private static MessageDigest messageDigestMd5; private static final Object LOCK = new Object(); - public static String toBase64String(byte[] binaryData) { - return DatatypeConverter.printBase64Binary(binaryData); - } - - public static byte[] fromBase64String(String base64String) { - return DatatypeConverter.parseBase64Binary(base64String); - } - - public static byte[] calculateMd5(byte[] binaryData) { - + //采用prototype模式,提高多线程高并发下的性能 if (messageDigestMd5 == null) { synchronized (LOCK) { @@ -45,4 +42,12 @@ public static byte[] calculateMd5(byte[] binaryData) { messageDigest.update(binaryData); return messageDigest.digest(); } + + public static String toString(ByteBuffer buffer) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < buffer.capacity(); i++) { + sb.append(" ").append(buffer.get(i) & 0xff); + } + return sb.toString(); + } } diff --git a/src/main/java/com/aliyun/openservices/ots/utils/Bytes.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Bytes.java similarity index 98% rename from src/main/java/com/aliyun/openservices/ots/utils/Bytes.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/Bytes.java index 31b3ba8..dbe9de8 100644 --- a/src/main/java/com/aliyun/openservices/ots/utils/Bytes.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Bytes.java @@ -1,6 +1,6 @@ -package com.aliyun.openservices.ots.utils; +package com.alicloud.openservices.tablestore.core.utils; -import com.aliyun.openservices.ots.internal.OTSConsts; +import com.alicloud.openservices.tablestore.core.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -293,7 +293,6 @@ public static String toString(final byte[] b) { * @param b1 The first byte array. * @param sep The separator to use. * @param b2 The second byte array. - * @return String b1+sep+b2 value */ public static String toString(final byte[] b1, String sep, @@ -319,7 +318,7 @@ public static String toString(final byte[] b, int off, int len) { return ""; } try { - return new String(b, off, len, OTSConsts.DEFAULT_ENCODING); + return new String(b, off, len, Constants.UTF8_ENCODING); } catch (UnsupportedEncodingException e) { LOG.error("UTF-8 not supported?", e); return null; @@ -452,7 +451,7 @@ public static byte[] toBytesBinary(String in) { */ public static byte[] toBytes(String s) { try { - return s.getBytes(OTSConsts.DEFAULT_ENCODING); + return s.getBytes(Constants.UTF8_ENCODING); } catch (UnsupportedEncodingException e) { LOG.error("UTF-8 not supported?", e); return null; @@ -807,7 +806,7 @@ public static short toShort(byte[] bytes, int offset, final int length) { } /** - * This method will get a sequence of bytes from pos , + * This method will get a sequence of bytes from pos to limit, * but will restore pos after. * * @param buf @@ -999,7 +998,7 @@ public static long readVLong(final byte[] buffer, final int offset) /** * @param left left operand * @param right right operand - * @return int 相等时返回0,left小于right时返回负值 + * @return 0 if equal, negative value if left is less than right, etc. */ public static int compareTo(final byte[] left, final byte[] right) { return compareByteArrayInLexOrder(left, 0, left.length, right, 0, right.length); @@ -1014,7 +1013,7 @@ public static int compareTo(final byte[] left, final byte[] right) { * @param offset2 Where to start comparing in the right buffer * @param length1 How much to compare from the left buffer * @param length2 How much to compare from the right buffer - * @return 相等时返回0,left小于right时返回负值 + * @return 0 if equal, negative value if left is less than right, etc. */ public static int compareTo(byte[] buffer1, int offset1, int length1, byte[] buffer2, int offset2, int length2) { diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/CalculateHelper.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/CalculateHelper.java new file mode 100644 index 0000000..f41aa75 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/CalculateHelper.java @@ -0,0 +1,20 @@ +package com.alicloud.openservices.tablestore.core.utils; + +import java.io.UnsupportedEncodingException; + +public class CalculateHelper { + + /** + * 计算字符串的大小(按照UTF-8编码) + * @param str + * @return 返回字符串的字节数 + * @throws IllegalStateException + */ + public static int calcStringSizeInBytes(String str) throws IllegalStateException { + try { + return str.getBytes("UTF-8").length; + } catch (UnsupportedEncodingException e) { + throw new IllegalStateException(e.getMessage(), e.getCause()); + } + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSCompressUtil.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/CompressUtil.java similarity index 94% rename from src/main/java/com/aliyun/openservices/ots/internal/OTSCompressUtil.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/CompressUtil.java index fbdc087..f006c23 100755 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSCompressUtil.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/CompressUtil.java @@ -1,4 +1,4 @@ -package com.aliyun.openservices.ots.internal; +package com.alicloud.openservices.tablestore.core.utils; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -7,13 +7,13 @@ import java.util.zip.Deflater; import java.util.zip.Inflater; -public class OTSCompressUtil { +public class CompressUtil { static final int MIN_BUFFER_SIZE = 10240; // 10KB public static byte[] compress(InputStream input, Deflater compresser) throws IOException{ - int avaiableLength = input.available(); - int estimateLength = avaiableLength > 0 ? avaiableLength : 1024; + int availableLength = input.available(); + int estimateLength = availableLength > 0 ? availableLength : 1024; ByteArrayOutputStream output = new ByteArrayOutputStream(estimateLength); try{ byte[] in = new byte[estimateLength]; diff --git a/src/main/java/com/aliyun/openservices/ots/utils/DateUtil.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/DateUtil.java similarity index 92% rename from src/main/java/com/aliyun/openservices/ots/utils/DateUtil.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/DateUtil.java index adefd92..6fcf745 100755 --- a/src/main/java/com/aliyun/openservices/ots/utils/DateUtil.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/DateUtil.java @@ -1,4 +1,4 @@ -package com.aliyun.openservices.ots.utils; +package com.alicloud.openservices.tablestore.core.utils; import java.util.Date; import java.util.Locale; @@ -74,6 +74,10 @@ public static Date parseRfc822Date(String dateString) { public static String formatIso8601Date(Date date) { return ISO8601_DATE_FORMATTER.print(date.getTime()); } + + public static String getCurrentIso8601Date() { + return formatIso8601Date(new Date()); + } public static Date parseIso8601Date(String dateString) { return ISO8601_DATE_FORMATTER.parseDateTime(dateString).toDate(); diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/FormatType.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/FormatType.java new file mode 100644 index 0000000..cb47705 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/FormatType.java @@ -0,0 +1,30 @@ +package com.alicloud.openservices.tablestore.core.utils; + +import java.util.Arrays; + +public enum FormatType { + + XML("application/xml", "text/xml"), + JSON("application/json", "text/json"), + RAW("application/octet-stream"), + FORM("application/x-www-form-urlencoded"); + + private String[] formats; + + FormatType(String... formats) { + this.formats = formats; + } + + public static String mapFormatToAccept(FormatType format) { + return format.formats[0]; + } + + public static FormatType mapAcceptToFormat(String accept) { + for (FormatType value : values()) { + if (Arrays.asList(value.formats).contains(accept)) { + return value; + } + } + return FormatType.RAW; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpRequest.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpRequest.java new file mode 100644 index 0000000..c8962e4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpRequest.java @@ -0,0 +1,214 @@ +package com.alicloud.openservices.tablestore.core.utils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.Collections; +import java.util.Map.Entry; + +public class HttpRequest { + + protected static final String CONTENT_TYPE = "Content-Type"; + protected static final String CONTENT_MD5 = "Content-MD5"; + protected static final String CONTENT_LENGTH = "Content-Length"; + + private String url = null; + private MethodType method = null; + protected FormatType httpContentType = null; + protected byte[] httpContent = null; + protected String encoding = null; + protected Map headers = null; + protected Integer connectTimeout = null; + protected Integer readTimeout = null; + + public HttpRequest(String strUrl) { + this.url = strUrl; + this.headers = new HashMap(); + } + + public HttpRequest(String strUrl, Map tmpHeaders) { + this.url = strUrl; + if (null != tmpHeaders) { this.headers = tmpHeaders; } + } + + public HttpRequest() { + } + + public String getUrl() { + return url; + } + + protected void setUrl(String url) { + this.url = url; + } + + public String getEncoding() { + return encoding; + } + + public void setEncoding(String encoding) { + this.encoding = encoding; + } + + public FormatType getHttpContentType() { + return httpContentType; + } + + public void setHttpContentType(FormatType httpContentType) { + this.httpContentType = httpContentType; + if (null != this.httpContent || null != httpContentType) { + this.headers.put(CONTENT_TYPE, getContentTypeValue(this.httpContentType, this.encoding)); + } else { + this.headers.remove(CONTENT_TYPE); + } + } + + public MethodType getMethod() { + return method; + } + + public void setMethod(MethodType method) { + this.method = method; + } + + public byte[] getHttpContent() { + return httpContent; + } + + public String getHeaderValue(String name) { + return this.headers.get(name); + } + + public Integer getConnectTimeout() { + return connectTimeout; + } + + public void setConnectTimeout(Integer connectTimeout) { + this.connectTimeout = connectTimeout; + } + + public Integer getReadTimeout() { + return readTimeout; + } + + public void setReadTimeout(Integer readTimeout) { + this.readTimeout = readTimeout; + } + + public void putHeaderParameter(String name, String value) { + if (null != name && null != value) { this.headers.put(name, value); } + } + + public void setHttpContent(byte[] content, String encoding, FormatType format) { + + if (null == content) { + this.headers.remove(CONTENT_MD5); + this.headers.put(CONTENT_LENGTH, "0"); + this.headers.remove(CONTENT_TYPE); + this.httpContentType = null; + this.httpContent = null; + this.encoding = null; + return; + } + this.httpContent = content; + this.encoding = encoding; + String contentLen = String.valueOf(content.length); + String strMd5 = Base64.toBase64String(BinaryUtil.calculateMd5(content)); + if (null != format) { + this.httpContentType = format; + } else { + this.httpContentType = FormatType.RAW; + } + this.headers.put(CONTENT_MD5, strMd5); + this.headers.put(CONTENT_LENGTH, contentLen); + this.headers.put(CONTENT_TYPE, getContentTypeValue(httpContentType, encoding)); + } + + public Map getHeaders() { + return Collections.unmodifiableMap(headers); + } + + public HttpURLConnection getHttpConnection() throws IOException { + Map mappedHeaders = this.headers; + String strUrl = url; + + if (null == strUrl) { + throw new IllegalArgumentException("URL is null for HttpRequest."); + } + if (null == this.method) { + throw new IllegalArgumentException("Method is not set for HttpRequest."); + } + URL url = null; + String[] urlArray = null; + if (MethodType.POST.equals(this.method) && null == getHttpContent()) { + urlArray = strUrl.split("\\?"); + url = new URL(urlArray[0]); + } else { + url = new URL(strUrl); + } + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + HttpURLConnection httpConn = (HttpURLConnection)url.openConnection(); + httpConn.setRequestMethod(this.method.toString()); + httpConn.setDoOutput(true); + httpConn.setDoInput(true); + httpConn.setUseCaches(false); + if (this.getConnectTimeout() != null) { + httpConn.setConnectTimeout(this.getConnectTimeout()); + } + + if (this.getReadTimeout() != null) { + httpConn.setReadTimeout(this.getReadTimeout()); + } + + for (Entry entry : mappedHeaders.entrySet()) { + httpConn.setRequestProperty(entry.getKey(), entry.getValue()); + } + + if (null != getHeaderValue(CONTENT_TYPE)) { + httpConn.setRequestProperty(CONTENT_TYPE, getHeaderValue(CONTENT_TYPE)); + } else { + String contentTypeValue = getContentTypeValue(httpContentType, encoding); + if (null != contentTypeValue) { + httpConn.setRequestProperty(CONTENT_TYPE, contentTypeValue); + } + } + + if (MethodType.POST.equals(this.method) && null != urlArray && urlArray.length == 2) { + httpConn.getOutputStream().write(urlArray[1].getBytes()); + } + return httpConn; + } + + private String getContentTypeValue(FormatType contentType, String encoding) { + if (null != contentType && null != encoding) { + return FormatType.mapFormatToAccept(contentType) + + ";charset=" + encoding.toLowerCase(); + } else if (null != contentType) { + return FormatType.mapFormatToAccept(contentType); + } + return null; + } + +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpResponse.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpResponse.java new file mode 100644 index 0000000..6db9d6c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpResponse.java @@ -0,0 +1,147 @@ +package com.alicloud.openservices.tablestore.core.utils; + +/* +Z * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +public class HttpResponse extends HttpRequest { + + private int status; + + public HttpResponse(String strUrl) { + super(strUrl); + } + + public HttpResponse() { + } + + @Override + public void setHttpContent(byte[] content, String encoding, FormatType format) { + this.httpContent = content; + this.encoding = encoding; + this.httpContentType = format; + } + + @Override + public String getHeaderValue(String name) { + String value = this.headers.get(name); + if (null == value) { + value = this.headers.get(name.toLowerCase()); + } + return value; + } + + private static byte[] readContent(InputStream content) + throws IOException { + if (content == null) { + return null; + } + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + byte[] buff = new byte[1024]; + + while (true) { + final int read = content.read(buff); + if (read == -1) { break; } + outputStream.write(buff, 0, read); + } + + return outputStream.toByteArray(); + } + + private static void pasrseHttpConn(HttpResponse response, HttpURLConnection httpConn, + InputStream content) throws IOException { + byte[] buff = readContent(content); + response.setStatus(httpConn.getResponseCode()); + Map> headers = httpConn.getHeaderFields(); + for (Entry> entry : headers.entrySet()) { + String key = entry.getKey(); + if (null == key) { continue; } + List values = entry.getValue(); + StringBuilder builder = new StringBuilder(values.get(0)); + for (int i = 1; i < values.size(); i++) { + builder.append(","); + builder.append(values.get(i)); + } + response.putHeaderParameter(key, builder.toString()); + } + String type = response.getHeaderValue("Content-Type"); + if (null != buff && null != type) { + response.setEncoding("UTF-8"); + String[] split = type.split(";"); + response.setHttpContentType(FormatType.mapAcceptToFormat(split[0].trim())); + if (split.length > 1 && split[1].contains("=")) { + String[] codings = split[1].split("="); + response.setEncoding(codings[1].trim().toUpperCase()); + } + } + response.setStatus(httpConn.getResponseCode()); + response.setHttpContent(buff, response.getEncoding(), + response.getHttpContentType()); + } + + public static HttpResponse getResponse(HttpRequest request) throws IOException { + OutputStream out = null; + InputStream content = null; + HttpResponse response = null; + HttpURLConnection httpConn = request.getHttpConnection(); + + try { + httpConn.connect(); + if (null != request.getHttpContent() && request.getHttpContent().length > 0) { + out = httpConn.getOutputStream(); + out.write(request.getHttpContent()); + } + content = httpConn.getInputStream(); + response = new HttpResponse(httpConn.getURL().toString()); + pasrseHttpConn(response, httpConn, content); + return response; + } catch (IOException e) { + content = httpConn.getErrorStream(); + response = new HttpResponse(httpConn.getURL().toString()); + pasrseHttpConn(response, httpConn, content); + return response; + } finally { + if (content != null) { content.close(); } + httpConn.disconnect(); + } + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public boolean isSuccess() { + if (200 <= this.status && + 300 > this.status) { return true; } + return false; + } +} + diff --git a/src/main/java/com/aliyun/openservices/ots/utils/HttpUtil.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpUtil.java similarity index 84% rename from src/main/java/com/aliyun/openservices/ots/utils/HttpUtil.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpUtil.java index 6b2938a..3213daf 100755 --- a/src/main/java/com/aliyun/openservices/ots/utils/HttpUtil.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/HttpUtil.java @@ -1,4 +1,11 @@ -package com.aliyun.openservices.ots.utils; +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.core.utils; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -11,7 +18,7 @@ public class HttpUtil { * Encode a URL segment with special chars replaced. * @param value * @param charset - * @return + * @return encoded url * @throws UnsupportedEncodingException */ // TODO change the method name to percentageEncode @@ -27,7 +34,7 @@ public static String urlEncode(String value, String charset) * Encodes request parameters to a URL query. * @param params * @param charset - * @return + * @return encoded query string * @throws UnsupportedEncodingException */ public static String paramToQueryString(Map params, String charset) diff --git a/src/main/java/com/aliyun/openservices/ots/utils/IOUtils.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/IOUtils.java similarity index 91% rename from src/main/java/com/aliyun/openservices/ots/utils/IOUtils.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/IOUtils.java index d60aca7..3a2ef27 100755 --- a/src/main/java/com/aliyun/openservices/ots/utils/IOUtils.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/IOUtils.java @@ -1,4 +1,11 @@ -package com.aliyun.openservices.ots.utils; +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.core.utils; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/IniEditor.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/IniEditor.java new file mode 100644 index 0000000..0f68945 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/IniEditor.java @@ -0,0 +1,1255 @@ +/* + IniEditor is Copyright (c) 2003-2013, Nik Haldimann + All rights reserved. Distributed under a BSD-style license. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package com.alicloud.openservices.tablestore.core.utils; + +import java.io.*; +import java.util.*; + +/** + * Loads, edits and saves INI-style configuration files. While loading from and + * saving to streams and files, IniEditor preserves comments and + * blank lines as well as the order of sections and lines in general. + *

+ * IniEditor assumes configuration files to be split in sections. A + * section starts out with a header, which consists of the section name enclosed + * in brackets ('[' and ']'). Everything before the + * first section header is ignored when loading from a stream or file. The + * {@link IniEditor.Section} class can be used to load + * configuration files without sections (ie Java-style properties). + *

+ * A "common section" may be named. All sections inherit the options of this + * section but can overwrite them. + *

+ * IniEditor represents an INI file (or rather, its sections) line + * by line, as comment, blank and option lines. A comment is a line which has a + * comment delimiter as its first non-white space character. The default comment + * delimiters, which may be overwritten, are '#' and + * ';'. + *

+ * A blank line is any line that consists only of white space. + *

+ * Everything else is an option line. Option names and values are separated by + * option delimiters '=', ':' or white space (spaces + * and tabs). + *

+ * Here's a minimal example. Suppose, we have this in a file called + * users.ini: + * + *

+ *   [root]
+ *   role = administrator
+ *   last_login = 2003-05-04
+ *
+ *   [joe]
+ *   role = author
+ *   last_login = 2003-05-13
+ * 
+ * + * Let's load that file, add something to it and save the changes: + * + *
+ * IniEditor users = new IniEditor();
+ * users.load("users.ini");
+ * users.set("root", "last_login", "2003-05-16");
+ * users.addComment("root", "Must change password often");
+ * users.set("root", "change_pwd", "10 days");
+ * users.addBlankLine("root");
+ * users.save("users.ini");
+ * 
+ * + * Now, the file looks like this: + * + *
+ *   [root]
+ *   role = administrator
+ *   last_login = 2003-05-16
+ *
+ *   # Must change password often
+ *   change_pwd = 10 days
+ *
+ *   [joe]
+ *   role = author
+ *   last_login = 2003-05-13
+ * 
+ *

+ * IniEditor provides services simliar to the standard Java API class + * java.util.Properties. It uses its own parser, though, which + * differs in these respects from that of Properties: + *

    + *
  • Line continuations (backslashes at the end of an option line) are not + * supported.
  • + *
  • No kind of character escaping is performed or recognized. Characters are + * read and written in in the default character encoding. If you want to use a + * different character encoding, use the {@link #load(InputStreamReader)} and + * {@link #save(OutputStreamWriter)} methods with a reader and writer tuned to + * the desired character encoding.
  • + *
  • As a consequence, option names may not contain option/value separators + * (normally '=', ':' and white space).
  • + *
+ * + * @author Nik Haldimann, nhaldimann at gmail dot com + * @version r5 (3/4/2013) + */ +public class IniEditor { + + private static boolean DEFAULT_CASE_SENSITIVITY = false; + + private Map sections; + private List sectionOrder; + private String commonName; + private char[] commentDelims; + private boolean isCaseSensitive; + private OptionFormat optionFormat; + + /** + * Constructs new bare IniEditor instance. + */ + public IniEditor() { + this(null, null); + } + + /** + * Constructs new bare IniEditor instance specifying case-sensitivity. + * + * @param isCaseSensitive + * section and option names are case-sensitive if this is true + */ + public IniEditor(boolean isCaseSensitive) { + this(null, null, isCaseSensitive); + } + + /** + * Constructs new IniEditor instance with a common section. Options in the + * common section are used as defaults for all other sections. + * + * @param commonName + * name of the common section + */ + public IniEditor(String commonName) { + this(commonName, null); + } + + /** + * Constructs new IniEditor instance with a common section. Options in the + * common section are used as defaults for all other sections. + * + * @param commonName + * name of the common section + * @param isCaseSensitive + * section and option names are case-sensitive if this is true + */ + public IniEditor(String commonName, boolean isCaseSensitive) { + this(commonName, null, isCaseSensitive); + } + + /** + * Constructs new IniEditor defining comment delimiters. + * + * @param delims + * an array of characters to be recognized as starters of comment + * lines; the first of them will be used for newly created + * comments + */ + public IniEditor(char[] delims) { + this(null, delims); + } + + /** + * Constructs new IniEditor defining comment delimiters. + * + * @param delims + * an array of characters to be recognized as starters of comment + * lines; the first of them will be used for newly created + * comments + * @param isCaseSensitive + * section and option names are case-sensitive if this is true + */ + public IniEditor(char[] delims, boolean isCaseSensitive) { + this(null, delims, isCaseSensitive); + } + + /** + * Constructs new IniEditor instance with a common section, defining comment + * delimiters. Options in the common section are used as defaults for all + * other sections. + * + * @param commonName + * name of the common section + * @param delims + * an array of characters to be recognized as starters of comment + * lines; the first of them will be used for newly created + * comments + */ + public IniEditor(String commonName, char[] delims) { + this(commonName, delims, DEFAULT_CASE_SENSITIVITY); + } + + /** + * Constructs new IniEditor instance with a common section, defining comment + * delimiters. Options in the common section are used as defaults for all + * other sections. + * + * @param commonName + * name of the common section + * @param delims + * an array of characters to be recognized as starters of comment + * lines; the first of them will be used for newly created + * comments + */ + public IniEditor(String commonName, char[] delims, boolean isCaseSensitive) { + this.sections = new HashMap(); + this.sectionOrder = new LinkedList(); + this.isCaseSensitive = isCaseSensitive; + if (commonName != null) { + this.commonName = commonName; + addSection(this.commonName); + } + this.commentDelims = delims; + this.optionFormat = new OptionFormat(Section.DEFAULT_OPTION_FORMAT); + } + + /** + * Sets the option format for this instance to the given string. Options + * will be rendered according to the given format string when printed. The + * string must contain %s three times, these will be replaced + * with the option name, the option separator and the option value in this + * order. Literal percentage signs must be escaped by preceding them with + * another percentage sign (i.e., %% corresponds to one + * percentage sign). The default format string is "%s %s %s". + * + * Option formats may look like format strings as supported by Java 1.5, but + * the string is in fact parsed in a custom fashion to guarantee backwards + * compatibility. So don't try clever stuff like using format conversion + * types other than %s. + * + * @param formatString + * a format string, containing %s exactly three + * times + * @throws IllegalArgumentException + * if the format string is illegal + */ + public void setOptionFormatString(String formatString) { + this.optionFormat = new OptionFormat(formatString); + } + + /** + * Returns the value of a given option in a given section or null if either + * the section or the option don't exist. If a common section was defined + * options are also looked up there if they're not present in the specific + * section. + * + * @param section + * the section's name + * @param option + * the option's name + * @return the option's value + * @throws NullPointerException + * any of the arguments is null + */ + public String get(String section, String option) { + if (hasSection(section)) { + Section sect = getSection(section); + if (sect.hasOption(option)) { + return sect.get(option); + } + if (this.commonName != null) { + return getSection(this.commonName).get(option); + } + } + return null; + } + + /** + * Returns a map of a given section with option/value pairs or null if the + * section doesn't exist. + * + * @param section + * the section's name + * @return HashMap of option/value pairs from the section + * @throws NullPointerException + * if section is null + */ + public Map getSectionMap(String section) { + Map sectionMap = new HashMap(); + if (hasSection(section)) { + Section sect = getSection(section); + for (String key : sect.options.keySet()) { + sectionMap.put(key, sect.options.get(key).value); + } + return sectionMap; + } + return null; + } + + /** + * Sets the value of an option in a section, if the option exist, otherwise + * adds the option to the section. Trims white space from the start and the + * end of the value and deletes newline characters it might contain. + * + * @param section + * the section's name + * @param option + * the option's name + * @param value + * the option's value + * @throws IniEditor.NoSuchSectionException + * no section with the given name exists + * @throws IllegalArgumentException + * the option name is illegal, ie contains a '=' character or + * consists only of white space + * @throws NullPointerException + * section or option are null + */ + public void set(String section, String option, String value) { + if (hasSection(section)) { + getSection(section).set(option, value); + } else { + throw new NoSuchSectionException(section); + } + } + + /** + * Removes an option from a section if it exists. Will not remove options + * from the common section if it's not directly addressed. + * + * @param section + * the section's name + * @param option + * the option's name + * @return true if the option was actually removed + * @throws IniEditor.NoSuchSectionException + * no section with the given name exists + */ + public boolean remove(String section, String option) { + if (hasSection(section)) { + return getSection(section).remove(option); + } else { + throw new NoSuchSectionException(section); + } + } + + /** + * Checks whether an option exists in a given section. Options in the common + * section are assumed to not exist in particular sections, unless they're + * overwritten. + * + * @param section + * the section's name + * @param option + * the option's name + * @return true if the given section has the option + */ + public boolean hasOption(String section, String option) { + return hasSection(section) && getSection(section).hasOption(option); + } + + /** + * Checks whether a section with a particular name exists in this instance. + * + * @param name + * the name of the section + * @return true if the section exists + */ + public boolean hasSection(String name) { + return this.sections.containsKey(normSection(name)); + } + + /** + * Adds a section if it doesn't exist yet. + * + * @param name + * the name of the section + * @return true if the section didn't already exist + * @throws IllegalArgumentException + * the name is illegal, ie contains one of the characters '[' + * and ']' or consists only of white space + */ + public boolean addSection(String name) { + String normName = normSection(name); + if (!hasSection(normName)) { + // Section constructor might throw IllegalArgumentException + Section section = new Section(normName, this.commentDelims, this.isCaseSensitive); + section.setOptionFormat(this.optionFormat); + this.sections.put(normName, section); + this.sectionOrder.add(normName); + return true; + } else { + return false; + } + } + + /** + * Removes a section if it exists. + * + * @param name + * the section's name + * @return true if the section actually existed + * @throws IllegalArgumentException + * when trying to remove the common section + */ + public boolean removeSection(String name) { + String normName = normSection(name); + if (this.commonName != null && this.commonName.equals(normName)) { + throw new IllegalArgumentException("Can't remove common section"); + } + if (hasSection(normName)) { + this.sections.remove(normName); + this.sectionOrder.remove(normName); + return true; + } else { + return false; + } + } + + /** + * Returns all section names in this instance minus the common section if + * one was defined. + * + * @return list of the section names in original/insertion order + */ + public List sectionNames() { + List sectList = new ArrayList(this.sectionOrder); + if (this.commonName != null) { + sectList.remove(this.commonName); + } + return sectList; + } + + /** + * Returns all option names of a section, not including options from the + * common section. + * + * @param section + * the section's name + * @return list of option names + * @throws IniEditor.NoSuchSectionException + * no section with the given name exists + */ + public List optionNames(String section) { + if (hasSection(section)) { + return getSection(section).optionNames(); + } else { + throw new NoSuchSectionException(section); + } + } + + /** + * Adds a comment line to the end of a section. A comment spanning several + * lines (ie with line breaks) will be split up, one comment line for each + * line. + * + * @param section + * the section's name + * @param comment + * the comment + * @throws IniEditor.NoSuchSectionException + * no section with the given name exists + */ + public void addComment(String section, String comment) { + if (hasSection(section)) { + getSection(section).addComment(comment); + } else { + throw new NoSuchSectionException(section); + } + } + + /** + * Adds a blank line to the end of a section. + * + * @param section + * the section's name + * @throws IniEditor.NoSuchSectionException + * no section with the given name exists + */ + public void addBlankLine(String section) { + if (hasSection(section)) { + getSection(section).addBlankLine(); + } else { + throw new NoSuchSectionException(section); + } + } + + /** + * Writes this instance in INI format to a file. + * + * @param filename + * the file to write to + * @throws IOException + * at an I/O problem + */ + public void save(String filename) throws IOException { + save(new File(filename)); + } + + /** + * Writes this instance in INI format to a file. + * + * @param file + * where to save to + * @throws IOException + * at an I/O problem + */ + public void save(File file) throws IOException { + OutputStream out = new FileOutputStream(file); + save(out); + out.close(); + } + + /** + * Writes this instance in INI format to an output stream. This method takes + * an OutputStream for maximum flexibility, internally it does + * of course use a writer for character based output. + * + * @param stream + * where to write + * @throws IOException + * at an I/O problem + */ + public void save(OutputStream stream) throws IOException { + save(new OutputStreamWriter(stream)); + } + + /** + * Writes this instance in INI format to an output stream writer. + * + * @param streamWriter + * where to write + * @throws IOException + * at an I/O problem + */ + public void save(OutputStreamWriter streamWriter) throws IOException { + Iterator it = this.sectionOrder.iterator(); + PrintWriter writer = new PrintWriter(streamWriter, true); + while (it.hasNext()) { + Section sect = getSection(it.next()); + writer.println(sect.header()); + sect.save(writer); + } + } + + /** + * Loads INI formatted input from a file into this instance, using the + * default character encoding. Everything in the file before the first + * section header is ignored. + * + * @param filename + * file to read from + * @throws IOException + * at an I/O problem + */ + public void load(String filename) throws IOException { + load(new File(filename)); + } + + /** + * Loads INI formatted input from a file into this instance, using the + * default character encoding. Everything in the file before the first + * section header is ignored. + * + * @param file + * file to read from + * @throws IOException + * at an I/O problem + */ + public void load(File file) throws IOException { + InputStream in = null; + try { + in = new FileInputStream(file); + load(in); + } finally { + if (in != null) { + in.close(); + } + } + } + + /** + * Loads INI formatted input from a stream into this instance, using the + * default character encoding. This method takes an InputStream + * for maximum flexibility, internally it does use a reader (using the + * default character encoding) for character based input. Everything in the + * stream before the first section header is ignored. + * + * @param stream + * where to read from + * @throws IOException + * at an I/O problem + */ + public void load(InputStream stream) throws IOException { + load(new InputStreamReader(stream)); + } + + /** + * Loads INI formatted input from a stream reader into this instance. + * Everything in the stream before the first section header is ignored. + * + * @param streamReader + * where to read from + * @throws IOException + * at an I/O problem + */ + public void load(InputStreamReader streamReader) throws IOException { + BufferedReader reader = new BufferedReader(streamReader); + String curSection = null; + String line = null; + + while (reader.ready()) { + line = reader.readLine().trim(); + if (line.length() > 0 && line.charAt(0) == Section.HEADER_START) { + int endIndex = line.indexOf(Section.HEADER_END); + if (endIndex >= 0) { + curSection = line.substring(1, endIndex); + addSection(curSection); + } + } + if (curSection != null) { + Section sect = getSection(curSection); + sect.load(reader); + } + } + } + + /** + * Returns a section by name or null if not found. + * + * @param name + * the section's name + * @return the section + */ + private Section getSection(String name) { + return sections.get(normSection(name)); + } + + /** + * Normalizes an arbitrary string for use as a section name. Currently only + * makes the string lower-case (provided this instance isn't case- + * sensitive) and trims leading and trailing white space. Note that + * normalization isn't enforced by the Section class. + * + * @param name + * the string to be used as section name + * @return a normalized section name + */ + private String normSection(String name) { + if (!this.isCaseSensitive) { + name = name.toLowerCase(); + } + return name.trim(); + } + + /** + * Loads, edits and saves a section of an INI-style configuration file. This + * class does actually belong to the internals of {@link IniEditor} and + * should rarely ever be used directly. It's exposed because it can be + * useful for plain, section-less configuration files (Java-style + * properties, for example). + */ + public static class Section { + + private String name; + private Map options; + private List lines; + private char[] optionDelims; + private char[] optionDelimsSorted; + private char[] commentDelims; + private char[] commentDelimsSorted; + private boolean isCaseSensitive; + private OptionFormat optionFormat; + + private static final char[] DEFAULT_OPTION_DELIMS = new char[] { '=', ':' }; + private static final char[] DEFAULT_COMMENT_DELIMS = new char[] { '#', ';' }; + private static final char[] OPTION_DELIMS_WHITESPACE = new char[] { ' ', '\t' }; + private static final boolean DEFAULT_CASE_SENSITIVITY = false; + public static final String DEFAULT_OPTION_FORMAT = "%s %s %s"; + + public static final char HEADER_START = '['; + public static final char HEADER_END = ']'; + private static final int NAME_MAXLENGTH = 1024; + private static final char[] INVALID_NAME_CHARS = { HEADER_START, HEADER_END }; + + /** + * Constructs a new section. + * + * @param name + * the section's name + * @throws IllegalArgumentException + * the section's name is illegal + */ + public Section(String name) { + this(name, null); + } + + /** + * Constructs a new section, specifying case-sensitivity. + * + * @param name + * the section's name + * @param isCaseSensitive + * option names are case-sensitive if this is true + * @throws IllegalArgumentException + * the section's name is illegal + */ + public Section(String name, boolean isCaseSensitive) { + this(name, null, isCaseSensitive); + } + + /** + * Constructs a new section, defining comment delimiters. + * + * @param name + * the section's name + * @param delims + * an array of characters to be recognized as starters of + * comment lines; the first of them will be used for newly + * created comments + * @throws IllegalArgumentException + * the section's name is illegal + */ + public Section(String name, char[] delims) { + this(name, delims, DEFAULT_CASE_SENSITIVITY); + } + + /** + * Constructs a new section, defining comment delimiters. + * + * @param name + * the section's name + * @param delims + * an array of characters to be recognized as starters of + * comment lines; the first of them will be used for newly + * created comments + * @param isCaseSensitive + * option names are case-sensitive if this is true + * @throws IllegalArgumentException + * the section's name is illegal + */ + public Section(String name, char[] delims, boolean isCaseSensitive) { + if (!validName(name)) { + throw new IllegalArgumentException("Illegal section name:" + name); + } + this.name = name; + this.isCaseSensitive = isCaseSensitive; + this.options = new HashMap(); + this.lines = new LinkedList(); + this.optionDelims = DEFAULT_OPTION_DELIMS; + this.commentDelims = (delims == null ? DEFAULT_COMMENT_DELIMS : delims); + this.optionFormat = new OptionFormat(DEFAULT_OPTION_FORMAT); + // sorting so we can later use binary search + this.optionDelimsSorted = new char[this.optionDelims.length]; + System.arraycopy(this.optionDelims, 0, this.optionDelimsSorted, 0, this.optionDelims.length); + this.commentDelimsSorted = new char[this.commentDelims.length]; + System.arraycopy(this.commentDelims, 0, this.commentDelimsSorted, 0, this.commentDelims.length); + Arrays.sort(this.optionDelimsSorted); + Arrays.sort(this.commentDelimsSorted); + } + + /** + * Sets the option format for this section to the given string. Options + * in this section will be rendered according to the given format + * string. The string must contain %s three times, these + * will be replaced with the option name, the option separator and the + * option value in this order. Literal percentage signs must be escaped + * by preceding them with another percentage sign (i.e., %% + * corresponds to one percentage sign). The default format string is + * "%s %s %s". + * + * Option formats may look like format strings as supported by Java 1.5, + * but the string is in fact parsed in a custom fashion to guarantee + * backwards compatibility. So don't try clever stuff like using format + * conversion types other than %s. + * + * @param formatString + * a format string, containing %s exactly three + * times + * @throws IllegalArgumentException + * if the format string is illegal + */ + public void setOptionFormatString(String formatString) { + this.setOptionFormat(new OptionFormat(formatString)); + } + + /** + * Sets the option format for this section. Options will be rendered + * according to the given format when printed. + * + * @param format + * a compiled option format + */ + public void setOptionFormat(OptionFormat format) { + this.optionFormat = format; + } + + /** + * Returns the names of all options in this section. + * + * @return list of names of this section's options in original/insertion + * order + */ + public List optionNames() { + List optNames = new LinkedList(); + Iterator it = this.lines.iterator(); + while (it.hasNext()) { + Line line = it.next(); + if (line instanceof Option) { + optNames.add(((Option) line).name()); + } + } + return optNames; + } + + /** + * Checks whether a given option exists in this section. + * + * @param name + * the name of the option to test for + * @return true if the option exists in this section + */ + public boolean hasOption(String name) { + return this.options.containsKey(normOption(name)); + } + + /** + * Returns an option's value. + * + * @param option + * the name of the option + * @return the requested option's value or null if no + * option with the specified name exists + */ + public String get(String option) { + String normed = normOption(option); + if (hasOption(normed)) { + return getOption(normed).value(); + } + return null; + } + + /** + * Sets an option's value and creates the option if it doesn't exist. + * + * @param option + * the option's name + * @param value + * the option's value + * @throws IllegalArgumentException + * the option name is illegal, ie contains a '=' character + * or consists only of white space + */ + public void set(String option, String value) { + set(option, value, this.optionDelims[0]); + } + + /** + * Sets an option's value and creates the option if it doesn't exist. + * + * @param option + * the option's name + * @param value + * the option's value + * @param delim + * the delimiter between name and value for this option + * @throws IllegalArgumentException + * the option name is illegal, ie contains a '=' character + * or consists only of white space + */ + public void set(String option, String value, char delim) { + String normed = normOption(option); + if (hasOption(normed)) { + getOption(normed).set(value); + } else { + // Option constructor might throw IllegalArgumentException + Option opt = new Option(normed, value, delim, this.optionFormat); + this.options.put(normed, opt); + this.lines.add(opt); + } + } + + /** + * Removes an option if it exists. + * + * @param option + * the name of the option + * @return true if the option was actually removed + */ + public boolean remove(String option) { + String normed = normOption(option); + if (hasOption(normed)) { + this.lines.remove(getOption(normed)); + this.options.remove(normed); + return true; + } else { + return false; + } + } + + /** + * Adds a comment line to the end of this section. A comment spanning + * several lines (ie with line breaks) will be split up, one comment + * line for each line. + * + * @param comment + * the comment + */ + public void addComment(String comment) { + addComment(comment, this.commentDelims[0]); + } + + /** + * Adds a comment line to the end of this section. A comment spanning + * several lines (ie with line breaks) will be split up, one comment + * line for each line. + * + * @param comment + * the comment + * @param delim + * the delimiter used to mark the start of this comment + */ + public void addComment(String comment, char delim) { + StringTokenizer st = new StringTokenizer(comment.trim(), NEWLINE_CHARS); + while (st.hasMoreTokens()) { + this.lines.add(new Comment(st.nextToken(), delim)); + } + } + + private static final String NEWLINE_CHARS = "\n\r"; + + /** + * Adds a blank line to the end of this section. + */ + public void addBlankLine() { + this.lines.add(BLANK_LINE); + } + + /** + * Loads options from a reader into this instance. Will read from the + * stream until it hits a section header, ie a '[' character, and resets + * the reader to point to this character. + * + * @param reader + * where to read from + * @throws IOException + * at an I/O problem + */ + public void load(BufferedReader reader) throws IOException { + while (reader.ready()) { + reader.mark(NAME_MAXLENGTH); + String line = reader.readLine().trim(); + + // Check for section header + if (line.length() > 0 && line.charAt(0) == HEADER_START) { + reader.reset(); + return; + } + + int delimIndex = -1; + // blank line + if (line.equals("")) { + this.addBlankLine(); + } + // comment line + else if ((delimIndex = Arrays.binarySearch(this.commentDelimsSorted, line.charAt(0))) >= 0) { + addComment(line.substring(1), this.commentDelimsSorted[delimIndex]); + } + // option line + else { + delimIndex = -1; + int delimNum = -1; + int lastSpaceIndex = -1; + for (int i = 0, l = line.length(); i < l && delimIndex < 0; i++) { + delimNum = Arrays.binarySearch(this.optionDelimsSorted, line.charAt(i)); + if (delimNum >= 0) { + delimIndex = i; + } else { + boolean isSpace = Arrays.binarySearch(Section.OPTION_DELIMS_WHITESPACE, line.charAt(i)) >= 0; + if (!isSpace && lastSpaceIndex >= 0) { + break; + } else if (isSpace) { + lastSpaceIndex = i; + } + } + } + // delimiter at start of line + if (delimIndex == 0) { + // XXX what's a man got to do? + } + // no delimiter found + else if (delimIndex < 0) { + if (lastSpaceIndex < 0) { + this.set(line, ""); + } else { + this.set(line.substring(0, lastSpaceIndex), line.substring(lastSpaceIndex + 1)); + } + } + // delimiter found + else { + this.set(line.substring(0, delimIndex), line.substring(delimIndex + 1), + line.charAt(delimIndex)); + } + } + } + } + + /** + * Prints this section to a print writer. + * + * @param writer + * where to write + * @throws IOException + * at an I/O problem + */ + public void save(PrintWriter writer) throws IOException { + Iterator it = this.lines.iterator(); + while (it.hasNext()) { + writer.println(it.next().toString()); + } + if (writer.checkError()) { + throw new IOException(); + } + } + + /** + * Returns an actual Option instance. + * + * @param option + * the name of the option, assumed to be normed already (!) + * @return the requested Option instance + * @throws NullPointerException + * if no option with the specified name exists + */ + private Option getOption(String name) { + return this.options.get(name); + } + + /** + * Returns the bracketed header of this section as appearing in an + * actual INI file. + * + * @return the section's name in brackets + */ + private String header() { + return HEADER_START + this.name + HEADER_END; + } + + /** + * Checks a string for validity as a section name. It can't contain the + * characters '[' and ']'. An empty string or one consisting only of + * white space isn't allowed either. + * + * @param name + * the name to validate + * @return true if the name validates as a section name + */ + private static boolean validName(String name) { + if (name.trim().equals("")) { + return false; + } + for (int i = 0; i < INVALID_NAME_CHARS.length; i++) { + if (name.indexOf(INVALID_NAME_CHARS[i]) >= 0) { + return false; + } + } + return true; + } + + /** + * Normalizes an arbitrary string for use as an option name, ie makes it + * lower-case (provided this section isn't case-sensitive) and trims + * leading and trailing white space. + * + * @param name + * the string to be used as option name + * @return a normalized option name + */ + private String normOption(String name) { + if (!this.isCaseSensitive) { + name = name.toLowerCase(); + } + return name.trim(); + } + + } + + private interface Line { + public String toString(); + } + + private static final Line BLANK_LINE = new Line() { + public String toString() { + return ""; + } + }; + + private static class Option implements Line { + + private String name; + private String value; + private char separator; + private OptionFormat format; + + private static final String ILLEGAL_VALUE_CHARS = "\n\r"; + + public Option(String name, String value, char separator, OptionFormat format) { + if (!validName(name, separator)) { + throw new IllegalArgumentException("Illegal option name:" + name); + } + this.name = name; + this.separator = separator; + this.format = format; + set(value); + } + + public String name() { + return this.name; + } + + public String value() { + return this.value; + } + + public void set(String value) { + if (value == null) { + this.value = value; + } else { + StringTokenizer st = new StringTokenizer(value.trim(), ILLEGAL_VALUE_CHARS); + StringBuffer sb = new StringBuffer(); + // XXX this might not be particularly efficient + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + } + this.value = sb.toString(); + } + } + + public String toString() { + return this.format.format(this.name, this.value, this.separator); + } + + private static boolean validName(String name, char separator) { + if (name.trim().equals("")) { + return false; + } + if (name.indexOf(separator) >= 0) { + return false; + } + return true; + } + + } + + private static class Comment implements Line { + + private String comment; + private char delimiter; + + public Comment(String comment, char delimiter) { + this.comment = comment.trim(); + this.delimiter = delimiter; + } + + public String toString() { + return this.delimiter + " " + this.comment; + } + + } + + private static class OptionFormat { + + private static final int EXPECTED_TOKENS = 4; + + private String[] formatTokens; + + public OptionFormat(String formatString) { + this.formatTokens = this.compileFormat(formatString); + } + + public String format(String name, String value, char separator) { + String[] t = this.formatTokens; + return t[0] + name + t[1] + separator + t[2] + value + t[3]; + } + + private String[] compileFormat(String formatString) { + String[] tokens = { "", "", "", "" }; + int tokenCount = 0; + boolean seenPercent = false; + StringBuffer token = new StringBuffer(); + for (int i = 0; i < formatString.length(); i++) { + switch (formatString.charAt(i)) { + case '%': + if (seenPercent) { + token.append("%"); + seenPercent = false; + } else { + seenPercent = true; + } + break; + case 's': + if (seenPercent) { + if (tokenCount >= EXPECTED_TOKENS) { + throw new IllegalArgumentException("Illegal option format. Too many %s placeholders."); + } + tokens[tokenCount] = token.toString(); + tokenCount++; + token = new StringBuffer(); + seenPercent = false; + } else { + token.append("s"); + } + break; + default: + if (seenPercent) { + throw new IllegalArgumentException("Illegal option format. Unknown format specifier."); + } + token.append(formatString.charAt(i)); + break; + } + } + if (tokenCount != EXPECTED_TOKENS - 1) { + throw new IllegalArgumentException("Illegal option format. Not enough %s placeholders."); + } + tokens[tokenCount] = token.toString(); + return tokens; + } + + } + + /** + * Thrown when an non-existent section is addressed. + */ + public static class NoSuchSectionException extends RuntimeException { + private static final long serialVersionUID = 5680119666410718328L; + + public NoSuchSectionException() { + super(); + } + + public NoSuchSectionException(String msg) { + super(msg); + } + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/Jsonizable.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Jsonizable.java new file mode 100644 index 0000000..999c7af --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Jsonizable.java @@ -0,0 +1,6 @@ +package com.alicloud.openservices.tablestore.core.utils; + +public interface Jsonizable { + public String jsonize(); + public void jsonize(StringBuilder sb, String newline); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/LogUtil.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/LogUtil.java new file mode 100644 index 0000000..d8d734b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/LogUtil.java @@ -0,0 +1,122 @@ +package com.alicloud.openservices.tablestore.core.utils; + +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.core.TraceLogger; +import com.alicloud.openservices.tablestore.model.RetryStrategy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LogUtil { + public static final String COLON = ":"; + public static final String DELIMITER = "\t"; + public static final String OTS_ACTION = "OTSAction"; + public static final String REQUEST_CONTENT_SIZE = "RequestContentSize"; + public static final String RESPONSE_CONTENT_SIZE = "ResponseContentSize"; + public static final String REQUEST_ID = "RequestId"; + public static final String TRACE_ID_WITH_COLON = "TraceId:"; + public static final String RETRIES_WITH_COLON = "RetriedCount:"; + public static final String TOTAL_TIME_WITH_COLON = "TotalTime:"; + public static final String OTS_ACTION_WITH_COLON = "OTSAction:"; + public static final String REQUEST_CONTENT_SIZE_WITH_COLON = "RequestContentSize:"; + public static final String RESPONSE_CONTENT_SIZE_WITH_COLON = "ResponseContentSize:"; + public static final String REQUEST_ID_WITH_COLON = "RequestId:"; + public static final String SERVER_TRACE_INFO_WITH_COLON = "ServerTraceInfo:"; + public static final String FIRST_EXECUTION = "FirstExecution"; + public static final String START_RETRY = "StartRetry"; + public static final String INTO_HTTP_ASYNC_CLIENT = "IntoHttpAsyncClient"; + public static final String REQUEST_SENT = "RequestSent"; + public static final String RESPONSE_RECEIVED = "ResponseReveived"; + public static final String COMPLETED = "Completed"; + public static final String FAILED = "Failed"; + + public static Logger LOG = LoggerFactory.getLogger(LogUtil.class); + + public static void logBeforeExecution( + TraceLogger traceLogger, RetryStrategy retry) + { + int retries = retry.getRetries(); + if (retries == 0) { + if (LOG.isDebugEnabled()) { + LOG.debug(TRACE_ID_WITH_COLON + + traceLogger.getTraceId() + DELIMITER + + FIRST_EXECUTION); + } + traceLogger.addEventTime(FIRST_EXECUTION, + System.currentTimeMillis()); + } else { + if (LOG.isDebugEnabled()) { + LOG.debug(TRACE_ID_WITH_COLON + + traceLogger.getTraceId() + DELIMITER + START_RETRY + + retries); + } + traceLogger.addEventTime(START_RETRY, System.currentTimeMillis()); + } + } + + public static void logRequestInfo( + TraceLogger traceLogger, String otsAction, + int contentSize) + { + if (LOG.isDebugEnabled()) { + LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + + DELIMITER + OTS_ACTION_WITH_COLON + otsAction + DELIMITER + + REQUEST_CONTENT_SIZE_WITH_COLON + contentSize); + } + traceLogger.addRequestInfo(OTS_ACTION, otsAction); + traceLogger.addRequestInfo(REQUEST_CONTENT_SIZE, "" + contentSize); + } + + public static void logOnCompleted( + TraceLogger traceLogger, RetryStrategy retry, String requestId) + { + int retries = retry.getRetries(); + if (LOG.isDebugEnabled()) { + LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + + DELIMITER + COMPLETED + DELIMITER + RETRIES_WITH_COLON + + retries + DELIMITER + REQUEST_ID_WITH_COLON + requestId); + } + traceLogger.addEventTime(COMPLETED, System.currentTimeMillis()); + if (requestId != null) { + traceLogger.addRequestInfo(REQUEST_ID, requestId); + } + } + + public static void logOnFailed( + TraceLogger traceLogger, RetryStrategy retry, + Exception ex, String requestId, boolean mayRetry) + { + int retries = retry.getRetries(); + + boolean isErrorLevel = false; + if (!mayRetry) { + if (ex instanceof TableStoreException) { + if (((TableStoreException) ex).getHttpStatus() >= 500) { + isErrorLevel = true; + } + } + } + if (isErrorLevel) { + if (LOG.isErrorEnabled()) { + LOG.error(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + + DELIMITER + FAILED + DELIMITER + RETRIES_WITH_COLON + + retries + DELIMITER + ex); + } + } else if (LOG.isWarnEnabled()) { + LOG.warn(TRACE_ID_WITH_COLON + traceLogger.getTraceId() + + DELIMITER + FAILED + DELIMITER + RETRIES_WITH_COLON + + retries + DELIMITER + ex); + } + traceLogger.addEventTime(FAILED, System.currentTimeMillis()); + if (requestId != null) { + traceLogger.addRequestInfo(REQUEST_ID, requestId); + } + } + + public static void logOnFailed( + TraceLogger traceLogger, RetryStrategy retry, + Exception ex, String requestId) + { + logOnFailed(traceLogger, retry, ex, requestId, true); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/MethodType.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/MethodType.java new file mode 100644 index 0000000..0432d55 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/MethodType.java @@ -0,0 +1,10 @@ +package com.alicloud.openservices.tablestore.core.utils; + +public enum MethodType { + GET, + PUT, + POST, + DELETE, + HEAD, + OPTIONS +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/Objects.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Objects.java new file mode 100644 index 0000000..8076c7a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Objects.java @@ -0,0 +1,24 @@ +package com.alicloud.openservices.tablestore.core.utils; + +public class Objects { + + /** + * Returns {@code true} if the arguments are equal to each other + * and {@code false} otherwise. + * Consequently, if both arguments are {@code null}, {@code true} + * is returned and if exactly one argument is {@code null}, {@code + * false} is returned. Otherwise, equality is determined by using + * the {@link Object#equals equals} method of the first + * argument. + * + * @param a an object + * @param b an object to be compared with {@code a} for equality + * @return {@code true} if the arguments are equal to each other + * and {@code false} otherwise + * @see Object#equals(Object) + */ + public static boolean equals(Object a, Object b) { + return (a == b) || (a != null && a.equals(b)); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/OptionalValue.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/OptionalValue.java new file mode 100644 index 0000000..031b9f4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/OptionalValue.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.core.utils; + +public class OptionalValue { + + private String name; + private T value; + private boolean isSet; + + public OptionalValue(String name) { + this.name = name; + this.value = null; + this.isSet = false; + } + + public void setValue(T value) { + isSet = true; + this.value = value; + } + + public T getValue() { + if (!isSet) { + return null; + } + return value; + } + + public boolean isValueSet() { + return isSet; + } + + public void clear() { + this.value = null; + this.isSet = false; + } + + @Override + public int hashCode() { + return isSet ? value.hashCode() : 0; + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof OptionalValue)) { + return false; + } + + OptionalValue v1 = (OptionalValue) o; + if (this.isSet) { + return v1.isSet ? value.equals(v1.value) : false; + } else { + return !v1.isSet ? true : false; + } + } + + @Override + public String toString() { + if (isSet) { + return name + ":" + value; + } else { + return name + ":NotSet"; + } + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/Pair.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Pair.java similarity index 97% rename from src/main/java/com/aliyun/openservices/ots/utils/Pair.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/Pair.java index f7fa803..5678ca2 100644 --- a/src/main/java/com/aliyun/openservices/ots/utils/Pair.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Pair.java @@ -1,4 +1,4 @@ -package com.aliyun.openservices.ots.utils; +package com.alicloud.openservices.tablestore.core.utils; import java.io.Serializable; diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/ParamChecker.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/ParamChecker.java new file mode 100644 index 0000000..d9d1350 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/ParamChecker.java @@ -0,0 +1,96 @@ +package com.alicloud.openservices.tablestore.core.utils; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.writer.WriterConfig; + +import java.util.Map; + +public class ParamChecker { + /** + * It does following checkings: + * - primary key schema is matched with which defined in table meta. + * - primary key column's value size is less than {@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxPKColumnSize} + * - attribute column's value size is less than {@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxAttrColumnSize} + * - the count of attribute columns is less than {@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxColumnsCount} or zero. + * - the name of attribute columns not duplicated with primary key column's name + * - the total row size + * + * @param tableMeta + * @param rowChange + * @param config + * @throws ClientException + */ + public static void checkRowChange(TableMeta tableMeta, RowChange rowChange, WriterConfig config) + throws ClientException { + // check table name + if (!tableMeta.getTableName().equals(rowChange.getTableName())) { + throw new ClientException("The row to write belongs to another table."); + } + + // check row size + if (rowChange.getDataSize() > config.getMaxBatchSize()) { + throw new ClientException("The row size exceeds the max batch size: " + config.getMaxBatchSize() + "."); + } + + + Map pkDefinedInMeta = tableMeta.getPrimaryKeySchemaMap(); + Map pkInRow = rowChange.getPrimaryKey().getPrimaryKeyColumnsMap(); + if (pkDefinedInMeta.size() != pkInRow.size()) { + throw new ClientException("The primary key schema is not match which defined in table meta."); + } + + for (Map.Entry entry : pkDefinedInMeta.entrySet()) { + PrimaryKeyValue value = pkInRow.get(entry.getKey()).getValue(); + + // schema checking + if (value == null) { + throw new ClientException("Can't find primary key column '" + entry.getKey() + "' in row."); + } + + if (value.isPlaceHolderForAutoIncr()) { + if (entry.getValue().getOption() != PrimaryKeyOption.AUTO_INCREMENT) { + throw new ClientException("The type of primary key column '" + entry.getKey() + "' should not be AUTO_INCREMENT."); + } + } else if (value.getType() != entry.getValue().getType()) { + throw new ClientException("The type of primary key column '" + entry.getKey() + "' is " + value.getType() + + ", but it's defined as " + entry.getValue().getType() + " in table meta."); + } + + // value size checking + if (value.getDataSize() > config.getMaxPKColumnSize()) { + throw new ClientException("The size of primary key column '" + entry.getKey() + "' has exceeded the max length:" + config.getMaxPKColumnSize() + "."); + } + } + + int columnsCount = 0; + if (rowChange instanceof RowPutChange) { + RowPutChange rowPut = (RowPutChange) rowChange; + columnsCount = rowPut.getColumnsToPut().size(); + for (Column column : rowPut.getColumnsToPut()) { + checkColumn(pkDefinedInMeta, column, config); + } + } else if (rowChange instanceof RowUpdateChange) { + RowUpdateChange rowUpdate = (RowUpdateChange) rowChange; + columnsCount = rowUpdate.getColumnsToUpdate().size(); + for (Pair pair : rowUpdate.getColumnsToUpdate()) { + checkColumn(pkDefinedInMeta, pair.first, config); + } + } + + if (columnsCount > config.getMaxColumnsCount()) { + throw new ClientException("The count of attribute columns exceeds the maximum: " + config.getMaxColumnsCount() + "."); + } + } + + public static void checkColumn(Map pkDefinedInMeta, Column column, WriterConfig config) { + if (pkDefinedInMeta.containsKey(column.getName())) { + throw new ClientException("The attribute column's name duplicate with primary key column, which is '" + column.getName() + "'."); + } + + ColumnValue value = column.getValue(); + if (value != null && value.getDataSize() > config.getMaxAttrColumnSize()) { + throw new ClientException("The size of attribute column '" + column.getName() + "' has exceeded the max length: " + config.getMaxAttrColumnSize() + "."); + } + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/Preconditions.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Preconditions.java similarity index 82% rename from src/main/java/com/aliyun/openservices/ots/utils/Preconditions.java rename to src/main/java/com/alicloud/openservices/tablestore/core/utils/Preconditions.java index 8d61281..ec215b6 100644 --- a/src/main/java/com/aliyun/openservices/ots/utils/Preconditions.java +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/Preconditions.java @@ -1,4 +1,4 @@ -package com.aliyun.openservices.ots.utils; +package com.alicloud.openservices.tablestore.core.utils; public final class Preconditions { private Preconditions() { @@ -45,6 +45,18 @@ public static T checkNotNull(T reference, String errorMessageTemplate, Objec return reference; } } + + public static void checkNotEmptyString(String reference, Object errorMessage) { + if(reference.equals("")) { + throw new IllegalArgumentException(String.valueOf(errorMessage)); + } + } + + public static void checkStringNotNullAndEmpty(String reference, Object errorMessage) { + if(reference == null || reference.equals("")) { + throw new IllegalArgumentException(String.valueOf(errorMessage)); + } + } static String format(String template, Object... args) { template = String.valueOf(template); @@ -79,4 +91,3 @@ static String format(String template, Object... args) { return builder.toString(); } } - diff --git a/src/main/java/com/alicloud/openservices/tablestore/core/utils/StringUtils.java b/src/main/java/com/alicloud/openservices/tablestore/core/utils/StringUtils.java new file mode 100644 index 0000000..dc28f41 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/core/utils/StringUtils.java @@ -0,0 +1,295 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.alicloud.openservices.tablestore.core.utils; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.charset.Charset; +import java.text.Collator; +import java.util.Collection; +import java.util.Locale; + +/** + * Utilities for converting objects to strings. + */ +public class StringUtils { + + private static final String DEFAULT_ENCODING = "UTF-8"; + + public static final String COMMA_SEPARATOR = ","; + + public static final Charset UTF8 = Charset.forName(DEFAULT_ENCODING); + + private static final Locale LOCALE_ENGLISH = Locale.ENGLISH; + + // white space character that match Pattern.compile("\\s") + private static final char CHAR_SPACE = ' '; + private static final char CHAR_TAB = '\t'; + private static final char CHAR_NEW_LINE = '\n'; + private static final char CHAR_VERTICAL_TAB = '\u000b'; + private static final char CHAR_CARRIAGE_RETURN = '\r'; + private static final char CHAR_FORM_FEED = '\f'; + + public static Integer toInteger(StringBuilder value) { + return Integer.parseInt(value.toString()); + } + + public static String toString(StringBuilder value) { + return value.toString(); + } + + public static Boolean toBoolean(StringBuilder value) { + return Boolean.getBoolean(value.toString()); + } + + public static String fromInteger(Integer value) { + return Integer.toString(value); + } + + public static String fromLong(Long value) { + return Long.toString(value); + } + + public static String fromString(String value) { + return value; + } + + public static String fromBoolean(Boolean value) { + return Boolean.toString(value); + } + + public static String fromBigInteger(BigInteger value) { + return value.toString(); + } + + public static String fromBigDecimal(BigDecimal value) { + return value.toString(); + } + + + public static BigInteger toBigInteger(String s) { + return new BigInteger(s); + } + + public static BigDecimal toBigDecimal(String s) { + return new BigDecimal(s); + } + + public static String fromFloat(Float value) { + return Float.toString(value); + } + + /** + * Returns the string representation of the specified double. + * + * @param d + * The double to represent as a string. + * + * @return The string representation of the specified double. + */ + public static String fromDouble(Double d) { + return Double.toString(d); + } + + /** + * Returns the string representation of the specified Byte. + * + * @param b + * The Byte to represent as a string. + * + * @return The string representation of the specified Byte. + */ + public static String fromByte(Byte b) { + return Byte.toString(b); + } + + public static String replace(String originalString, String partToMatch, String replacement ) { + StringBuilder buffer = new StringBuilder( originalString.length() ); + buffer.append( originalString ); + + int indexOf = buffer.indexOf( partToMatch ); + while (indexOf != -1) { + buffer = buffer.replace(indexOf, indexOf + partToMatch.length(), replacement); + indexOf = buffer.indexOf(partToMatch, indexOf + replacement.length()); + } + + return buffer.toString(); + } + + /** + * Joins the strings in parts with joiner between each string + * @param joiner the string to insert between the strings in parts + * @param parts the parts to join + */ + public static String join(String joiner, String... parts) { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < parts.length; i++) { + builder.append(parts[i]); + if (i < parts.length - 1) { + builder.append(joiner); + } + } + return builder.toString(); + } + + /** + * Joins the strings in collection with joiner between each string + * @param joiner the string to insert between the strings in collection + * @param collection the collection to join + */ + public static String join(String joiner, Collection collection) { + StringBuilder builder = new StringBuilder(); + int i = 0; + + for (String part : collection) { + builder.append(part); + if (i < collection.size() - 1) { + builder.append(joiner); + } + i++; + } + return builder.toString(); + } + + /** + * A null-safe trim method. If the input string is null, returns null; + * otherwise returns a trimmed version of the input. + */ + public static String trim(String value) { + if (value == null) { + return null; + } + return value.trim(); + } + + /** + * @return true if the given value is either null or the empty string + */ + public static boolean isNullOrEmpty(String value) { + return value == null || value.isEmpty(); + } + + /** + * @return true if the given value is non-null and non-empty + */ + public static boolean hasValue(String str) { + return !isNullOrEmpty(str); + } + + /** + * Converts a given String to lower case with Locale.ENGLISH + * + * @param str the string to be converted to lower case + * @return the lower case of string, or itself if string is null/empty + */ + public static String lowerCase(String str) { + if(isNullOrEmpty(str)) { + return str; + } + return str.toLowerCase(LOCALE_ENGLISH); + } + + /** + * Converts a given String to upper case with Locale.ENGLISH + * + * @param str the string to be converted to upper case + * @return the upper case of string, or itself if string is null/empty + */ + public static String upperCase(String str) { + if(isNullOrEmpty(str)) { + return str; + } + return str.toUpperCase(LOCALE_ENGLISH); + } + + /** + * Compare two strings with Locale.ENGLISH + * This method is preferred over String.compareTo() method. + * @param str1 String 1 + * @param str2 String 2 + * @return negative integer if str1 lexicographically precedes str2 + * positive integer if str1 lexicographically follows str2 + * 0 if both strings are equal + * @throws IllegalArgumentException throws exception if both or either of the strings is null + */ + public static int compare(String str1, String str2) { + if( str1 == null || str2 == null) { + throw new IllegalArgumentException("Arguments cannot be null"); + } + + Collator collator = Collator.getInstance(LOCALE_ENGLISH); + return collator.compare(str1, str2); + } + + /** + * Tests a char to see if is it whitespace. + * This method considers the same characters to be white + * space as the Pattern class does when matching \s + * + * @param ch the character to be tested + * @return true if the character is white space, false otherwise. + */ + private static boolean isWhiteSpace(final char ch) { + if (ch == CHAR_SPACE) return true; + if (ch == CHAR_TAB) return true; + if (ch == CHAR_NEW_LINE) return true; + if (ch == CHAR_VERTICAL_TAB) return true; + if (ch == CHAR_CARRIAGE_RETURN) return true; + if (ch == CHAR_FORM_FEED) return true; + return false; + } + + /** + * This method appends a string to a string builder and collapses contiguous + * white space is a single space. + * + * This is equivalent to: + * destination.append(source.replaceAll("\\s+", " ")) + * but does not create a Pattern object that needs to compile the match + * string; it also prevents us from having to make a Matcher object as well. + * + */ + public static void appendCompactedString(final StringBuilder destination, final String source) { + boolean previousIsWhiteSpace = false; + int length = source.length(); + + for (int i = 0; i < length; i++) { + char ch = source.charAt(i); + if (isWhiteSpace(ch)) { + if (previousIsWhiteSpace) { + continue; + } + destination.append(CHAR_SPACE); + previousIsWhiteSpace = true; + } else { + destination.append(ch); + previousIsWhiteSpace = false; + } + } + } + + /** + * Performs a case insensitive comparison and returns true if the data + * begins with the given sequence. + */ + public static boolean beginsWithIgnoreCase(final String data, final String seq) { + return data.regionMatches(true, 0, seq, 0, seq.length()); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionRequest.java new file mode 100644 index 0000000..2d22d55 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionRequest.java @@ -0,0 +1,40 @@ +package com.alicloud.openservices.tablestore.model; + + +public class AbortTransactionRequest implements Request { + + /** + * 事务的ID。 + */ + private String transactionID; + + /** + * 设置事务的ID。 + */ + public void setTransactionID(String transactionID) { + this.transactionID = transactionID; + } + + /** + * 获取事务的ID。 + * + * @return 事务的ID + */ + public String getTransactionID() { + return transactionID; + } + + /** + * 初始化AbortTransactionRequest实例。 + * + * @param transactionID 事务的ID。 + */ + public AbortTransactionRequest(String transactionID) { + setTransactionID(transactionID); + } + + @Override + public String getOperationName() { + return OperationNames.OP_ABORT_TRANSACTION; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionResponse.java new file mode 100644 index 0000000..aab5a8a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/AbortTransactionResponse.java @@ -0,0 +1,10 @@ +package com.alicloud.openservices.tablestore.model; + + +public class AbortTransactionResponse extends Response { + + + public AbortTransactionResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/AbstractColumnIteratorImpl.java b/src/main/java/com/alicloud/openservices/tablestore/model/AbstractColumnIteratorImpl.java new file mode 100644 index 0000000..553cf8a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/AbstractColumnIteratorImpl.java @@ -0,0 +1,7 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.Iterator; + +public abstract class AbstractColumnIteratorImpl implements Iterator { + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/AlwaysRetryStrategy.java b/src/main/java/com/alicloud/openservices/tablestore/model/AlwaysRetryStrategy.java new file mode 100644 index 0000000..4c2ad4b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/AlwaysRetryStrategy.java @@ -0,0 +1,77 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.Random; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +/** + * TableStore SDK支持自定义重试逻辑{@link RetryStrategy}, 重试逻辑用于判断在发生异常时是否需要重试, 并给出本次重试的时间间隔. + * {@link AlwaysRetryStrategy}为一个重试逻辑示例, 其在最大重试次数内总是重试. + */ +public class AlwaysRetryStrategy implements RetryStrategy { + private Random rnd = new Random(); + private int base = 4; // in msec + private int retries = 0; + private int maxRetryTimes = 3; + private int maxRetryPauseInMillis = 1000; // one second + + public AlwaysRetryStrategy() { + } + + public AlwaysRetryStrategy(int maxRetryTimes, int maxRetryPauseInMillis) { + Preconditions.checkArgument(maxRetryTimes > 0); + Preconditions.checkArgument(maxRetryPauseInMillis > 1); + + this.maxRetryTimes = maxRetryTimes; + this.maxRetryPauseInMillis = maxRetryPauseInMillis; + } + + @Override + public AlwaysRetryStrategy clone() { + return new AlwaysRetryStrategy(maxRetryTimes, maxRetryPauseInMillis); + } + + @Override + public int getRetries() { + return retries; + } + + @Override + public long nextPause(String action, Exception ex) { + if (retries >= maxRetryTimes) { + return 0; + } + if (base <= 0) { + return 0; + } + + int maxPause = 0; + if (base * 2 < maxRetryPauseInMillis) { + base *= 2; + maxPause = base ; + } else { + maxPause = maxRetryPauseInMillis; + } + int halfPause = maxPause / 2; + // randomly exponential backoff, in order to make requests sparse. + long delay = halfPause + rnd.nextInt(maxPause - halfPause); + ++retries; + return delay; + } + + public int getMaxRetryTimes() { + return maxRetryTimes; + } + + public void setMaxRetryTimes(int maxRetryTimes) { + this.maxRetryTimes = maxRetryTimes; + } + + public int getMaxRetryPauseInMillis() { + return maxRetryPauseInMillis; + } + + public void setMaxRetryPauseInMillis(int maxRetryPauseInMillis) { + this.maxRetryPauseInMillis = maxRetryPauseInMillis; + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/BatchGetRowRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/BatchGetRowRequest.java similarity index 80% rename from src/main/java/com/aliyun/openservices/ots/model/BatchGetRowRequest.java rename to src/main/java/com/alicloud/openservices/tablestore/model/BatchGetRowRequest.java index e579885..abee000 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/BatchGetRowRequest.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/BatchGetRowRequest.java @@ -1,24 +1,35 @@ -package com.aliyun.openservices.ots.model; +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - -public class BatchGetRowRequest { +public class BatchGetRowRequest implements Request { private Map criteriasGroupByTable; public BatchGetRowRequest() { criteriasGroupByTable = new HashMap(); } + public String getOperationName() { + return OperationNames.OP_BATCH_GET_ROW; + } + /** * 增加某个表的多行查询参数。若该表已经添加过查询条件,则之前的查询条件会被覆盖。 * @param criteria 单行查询条件 */ public void addMultiRowQueryCriteria(MultiRowQueryCriteria criteria) { - assertParameterNotNull(criteria, "criteria"); + Preconditions.checkArgument(criteria != null && !criteria.isEmpty(), "The query criteria for table should not be null or empty."); String tableName = criteria.getTableName(); criteriasGroupByTable.put(tableName, criteria); } @@ -31,7 +42,7 @@ public void addMultiRowQueryCriteria(MultiRowQueryCriteria criteria) { * @param index 该行在参数列表中得索引 * @return 行的主键 */ - public RowPrimaryKey getPrimaryKey(String tableName, int index) { + public PrimaryKey getPrimaryKey(String tableName, int index) { MultiRowQueryCriteria criteria = criteriasGroupByTable.get(tableName); if (criteria == null) { return null; @@ -67,10 +78,10 @@ public MultiRowQueryCriteria getCriteria(String tableName) { * @param failedRows 返回结果中查询失败的行 * @return 新的请求 */ - public BatchGetRowRequest createRequestForRetry(List failedRows) { + public BatchGetRowRequest createRequestForRetry(List failedRows) { BatchGetRowRequest request = new BatchGetRowRequest(); - for (BatchGetRowResult.RowStatus rowResult : failedRows) { - RowPrimaryKey primaryKey = getPrimaryKey(rowResult.getTableName(), rowResult.getIndex()); + for (BatchGetRowResponse.RowResult rowResult : failedRows) { + PrimaryKey primaryKey = getPrimaryKey(rowResult.getTableName(), rowResult.getIndex()); if (primaryKey == null) { throw new IllegalArgumentException("Can not find table '" + rowResult.getTableName() + "' with index " + rowResult.getIndex()); } diff --git a/src/main/java/com/aliyun/openservices/ots/model/BatchGetRowResult.java b/src/main/java/com/alicloud/openservices/tablestore/model/BatchGetRowResponse.java similarity index 52% rename from src/main/java/com/aliyun/openservices/ots/model/BatchGetRowResult.java rename to src/main/java/com/alicloud/openservices/tablestore/model/BatchGetRowResponse.java index ce3b413..dbb958e 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/BatchGetRowResult.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/BatchGetRowResponse.java @@ -1,37 +1,52 @@ -package com.aliyun.openservices.ots.model; +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.model; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class BatchGetRowResult extends OTSResult { +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class BatchGetRowResponse extends Response implements Jsonizable { /** * BatchGetRow批量操作中单行查询的结果。 * 若isSucceed为true,则代表该行查询操作成功,可以通过getRow获取单行查询的结果。 * 若isSucceed为false,则代表该行查询操作失败,可以通过getError获取失败的错误信息。 */ - public static class RowStatus { + public static class RowResult { private boolean isSucceed = false; private String tableName; private Error error; private Row row; private ConsumedCapacity consumedCapacity; private int index; - - public RowStatus(String tableName, Error error, int index) { + private byte[] nextToken; + + public RowResult(String tableName, Error error, int index) { this.isSucceed = false; this.tableName = tableName; this.error = error; this.index = index; } - public RowStatus(String tableName, Row row, ConsumedCapacity consumedCapacity, int index) { + public RowResult(String tableName, Row row, ConsumedCapacity consumedCapacity, int index) { + this(tableName, row, consumedCapacity, index, null); + } + + public RowResult(String tableName, Row row, ConsumedCapacity consumedCapacity, int index, byte[] nextToken) { this.isSucceed = true; this.tableName = tableName; this.row = row; this.consumedCapacity = consumedCapacity; this.index = index; + this.nextToken = nextToken; } public boolean isSucceed() { @@ -57,32 +72,40 @@ public ConsumedCapacity getConsumedCapacity() { public int getIndex() { return this.index; } + + public byte[] getNextToken() { + return nextToken; + } + + public boolean hasNextToken() { + return (nextToken != null) && (nextToken.length > 0); + } } /** * 批量查询的返回结果。 */ - private Map> tableToRowsStatus; + private Map> tableToRowsResult; /** * internal use */ - public BatchGetRowResult(OTSResult meta) { + public BatchGetRowResponse(Response meta) { super(meta); - this.tableToRowsStatus = new HashMap>(); + this.tableToRowsResult = new HashMap>(); } /** * internal use */ - public void addResult(RowStatus status) { - String tableName = status.getTableName(); - List tableRowStatus = tableToRowsStatus.get(tableName); - if (tableRowStatus == null) { - tableRowStatus = new ArrayList(); - tableToRowsStatus.put(tableName, tableRowStatus); + public void addResult(RowResult result) { + String tableName = result.getTableName(); + List tableRowResult = tableToRowsResult.get(tableName); + if (tableRowResult == null) { + tableRowResult = new ArrayList(); + tableToRowsResult.put(tableName, tableRowResult); } - tableRowStatus.add(status); + tableRowResult.add(result); } /** @@ -90,16 +113,16 @@ public void addResult(RowStatus status) { * @param tableName 表的名称 * @return 该表下所有行的查询结果,若该表不存在,则返回null。 */ - public List getBatchGetRowStatus(String tableName) { - return tableToRowsStatus.get(tableName); + public List getBatchGetRowResult(String tableName) { + return tableToRowsResult.get(tableName); } /** * 返回所有表所有行的查询结果。 * @return 本次BatchGetRow操作返回的结果。 */ - public Map> getTableToRowsStatus() { - return tableToRowsStatus; + public Map> getTableToRowsResult() { + return tableToRowsResult; } /** @@ -107,8 +130,8 @@ public Map> getTableToRowsStatus() { * * @return 若存在执行失败的行,则返回所有行,否则返回空列表 */ - public List getFailedRows() { - List result = new ArrayList(); + public List getFailedRows() { + List result = new ArrayList(); getResult(null, result); return result; } @@ -118,8 +141,8 @@ public List getFailedRows() { * * @return 若存在执行成功的行,则返回所有行,否则返回空列表 */ - public List getSucceedRows() { - List result = new ArrayList(); + public List getSucceedRows() { + List result = new ArrayList(); getResult(result, null); return result; } @@ -130,9 +153,9 @@ public List getSucceedRows() { * @param succeedRows 所有执行成功的行 * @param failedRows 所有执行失败的行 */ - public void getResult(List succeedRows, List failedRows) { - for (Map.Entry> entry : tableToRowsStatus.entrySet()) { - for (RowStatus rs : entry.getValue()) { + public void getResult(List succeedRows, List failedRows) { + for (Map.Entry> entry : tableToRowsResult.entrySet()) { + for (RowResult rs : entry.getValue()) { if (rs.isSucceed) { if (succeedRows != null) { succeedRows.add(rs); @@ -154,4 +177,27 @@ public void getResult(List succeedRows, List failedRows) { public boolean isAllSucceed() { return getFailedRows().isEmpty(); } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + //Map> tableToRowsResult; + for (Map.Entry> tableResult : this.tableToRowsResult.entrySet()) { + for (RowResult result : tableResult.getValue()) { + sb.append("{\"TableName\": "); + sb.append(result.getTableName() + ", \"ConsumedCapacity\": "); + result.getConsumedCapacity().jsonize(sb, newline + " "); + if (result.getRow() != null) { + sb.append(", \"Row\": " + result.getRow().toString()); + } + } + } + sb.append("}"); + } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowRequest.java new file mode 100755 index 0000000..a1e182b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowRequest.java @@ -0,0 +1,105 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BatchWriteRowRequest extends TxnRequest { + + private Map> rowChangesGroupByTable; + + public BatchWriteRowRequest() { + rowChangesGroupByTable = new HashMap>(); + } + + public String getOperationName() { + return OperationNames.OP_BATCH_WRITE_ROW; + } + + /** + * 添加某个表的写操作参数。 + * + * @param rowChange 一次写操作的参数,操作类型可以是Put、Update、Delete,如果使用Txn,则每次BatchWriteRow只能允许单张表。 + */ + public void addRowChange(RowChange rowChange) { + Preconditions.checkNotNull(rowChange, "The rowPutChange should not be null."); + String tableName = rowChange.getTableName(); + + List rowChanges = rowChangesGroupByTable.get(tableName); + if (rowChanges == null) { + rowChanges = new ArrayList(); + rowChangesGroupByTable.put(tableName, rowChanges); + } + rowChanges.add(rowChange); + } + + /** + * 根据表名和索引返回一次写操作的参数。 + * BatchWriteRowResult中返回的多行结果允许部分成功部分失败,返回结果按表组织,且表内行的顺序与BatchWriteRowRequest中一一对应。 + * 若用户需要对BatchWriteRowResult中部分失败的行进行重试,则可以根据失败的行所在的表的表名以及在其在返回结果列表内的索引,从BatchWriteRowRequest中反查即可得到请求参数。 + * + * @param tableName 表的名称 + * @param index 该行在参数列表中得索引 + * @return 一次写操作的参数 + */ + public RowChange getRowChange(String tableName, int index) { + List rowChanges = rowChangesGroupByTable.get(tableName); + if (rowChanges == null) { + return null; + } + + if (index >= rowChanges.size()) { + return null; + } + return rowChanges.get(index); + } + + /** + * 获取所有表的操作参数。 + * + * @return 所有表的操作参数。 + */ + public Map> getRowChange() { + return rowChangesGroupByTable; + } + + /** + * 根据请求返回的结果,提取执行失败的行重新构造一次新的请求。 + * + * @param failedRows 执行写操作失败的行 + * @return 新的用于重试的请求 + */ + public BatchWriteRowRequest createRequestForRetry(List failedRows) { + Preconditions.checkArgument((failedRows != null) && !failedRows.isEmpty(), "failedRows can't be null or empty."); + BatchWriteRowRequest request = new BatchWriteRowRequest(); + for (BatchWriteRowResponse.RowResult rowResult : failedRows) { + RowChange rowChange = getRowChange(rowResult.getTableName(), rowResult.getIndex()); + if (rowChange == null) { + throw new IllegalArgumentException("Can not find item in table '" + rowResult.getTableName() + "' " + + "with index " + rowResult.getIndex()); + } + request.addRowChange(rowChange); + } + return request; + } + + public boolean isEmpty() { + return rowChangesGroupByTable.isEmpty(); + } + + /** + * 获取该BatchWriteRow请求中包含的总的行数。 + * + * @return 总的行数 + */ + public int getRowsCount() { + int rowsCount = 0; + for (Map.Entry> entry : rowChangesGroupByTable.entrySet()) { + rowsCount += entry.getValue().size(); + } + return rowsCount; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowResponse.java new file mode 100755 index 0000000..54482f6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/BatchWriteRowResponse.java @@ -0,0 +1,198 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BatchWriteRowResponse extends Response { + /** + * BatchWriteRow批量操作中单行写的结果。 + * 若isSucceed为true,则代表该行写操作成功。 + * 若isSucceed为false,则代表该行写操作失败,可以通过getError获取失败的错误信息。 + */ + public static class RowResult { + private boolean isSucceed = false; + private String tableName; + private Error error; + private ConsumedCapacity consumedCapacity; + private int index; + private Row row; + + /** + * internal use + */ + public RowResult(String tableName, Row row, Error error, int index) { + this.tableName = tableName; + this.isSucceed = false; + this.error = error; + this.index = index; + this.row = row; + } + + /** + * internal use + */ + public RowResult(String tableName, Row row, ConsumedCapacity consumedCapacity, int index) { + this.tableName = tableName; + this.isSucceed = true; + this.consumedCapacity = consumedCapacity; + this.index = index; + this.row = row; + } + + /** + * 判断该行查询是否执行成功。 + *

只有在成功的时候,{@link #consumedCapacity}才有效。

+ *

只有在执行不成功的时候,{@link #error}才有效。

+ * + * @return 若执行成功,则返回true,否则返回false + */ + public boolean isSucceed() { + return isSucceed; + } + + /** + * 获取该行所在表的名称。 + *

若该行查询失败,可以根据表名和索引通过{@link BatchGetRowRequest#getPrimaryKey(String, int)}中获取查询参数进行重试。

+ * + * @return 表的名称 + */ + public String getTableName() { + return tableName; + } + + /** + * 若该行查询执行失败,则返回具体的错误信息。 + * + * @return 若执行失败,则返回错误信息,否则返回null + */ + public Error getError() { + return error; + } + + /** + * 若该行查询成功,则返回消耗的能力单元。 + * + * @return 若执行成功,则返回消耗的能力单元,否则返回null + */ + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + /** + * 获取该行在{@link BatchGetRowRequest}的多行查询参数的索引位置。 + *

若该行查询失败,可以根据表名和索引通过{@link BatchGetRowRequest#getPrimaryKey(String, int)}中获取查询参数进行重试。

+ * + * @return 索引位置 + */ + public int getIndex() { + return index; + } + + /** + * 获取返回的行数据 + * @return 若有返回行数据,则返回行数据,否则返回null + */ + public Row getRow() { + return row; + } + } + + private Map> tableToRowStatus; + + /** + * internal use + * @param meta + */ + public BatchWriteRowResponse(Response meta) { + super(meta); + this.tableToRowStatus = new HashMap>(); + } + + /** + * internal use + * @param status + */ + public void addRowResult(RowResult status) { + String tableName = status.getTableName(); + + List statuses = tableToRowStatus.get(tableName); + if (statuses == null) { + statuses = new ArrayList(); + tableToRowStatus.put(tableName, statuses); + } + statuses.add(status); + } + + /** + * 获取某个表上所有写操作的返回结果。 + * + * @return 写操作的返回结果,若该表不存在,则返回null。 + */ + public List getRowStatus(String tableName) { + return tableToRowStatus.get(tableName); + } + + /** + * 获取所有表上写操作的返回结果。 + * + * @return 所有表写操作返回结果。 + */ + public Map> getRowStatus() { + return tableToRowStatus; + } + + /** + * 获取所有PutRow操作执行失败的行。 + * + * @return 若存在执行失败的行,则返回所有行,否则返回空列表 + */ + public List getFailedRows() { + List result = new ArrayList(); + getResult(null, result); + return result; + } + + /** + * 获取所有操作执行成功的行。 + * + * @return 若存在执行成功的行,则返回所有行,否则返回空列表 + */ + public List getSucceedRows() { + List result = new ArrayList(); + getResult(result, null); + return result; + } + + /** + * 获取所有执行成功过的行以及所有执行失败的行。 + * + * @param succeedRows 所有执行成功的行 + * @param failedRows 所有执行失败的行 + */ + public void getResult(List succeedRows, List failedRows) { + for (Map.Entry> entry : tableToRowStatus.entrySet()) { + for (RowResult rs : entry.getValue()) { + if (rs.isSucceed) { + if (succeedRows != null) { + succeedRows.add(rs); + } + } else { + if (failedRows != null) { + failedRows.add(rs); + } + } + } + } + } + + /** + * 是否所有行修改操作都执行成功。 + * + * @return 若所有行修改操作都执行成功,则返回true,否则返回false + */ + public boolean isAllSucceed() { + return getFailedRows().isEmpty(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/CapacityUnit.java b/src/main/java/com/alicloud/openservices/tablestore/model/CapacityUnit.java new file mode 100755 index 0000000..9e34d5f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/CapacityUnit.java @@ -0,0 +1,172 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +/** + * 表的读写吞吐量的单位,即能力单元。 + * 主要用于{@link ReservedThroughput}中配置表的预留读写吞吐量以及标识读写操作消耗的能力单元的量。 + */ +public class CapacityUnit implements Jsonizable { + /** + * 读能力单元。 + */ + private OptionalValue readCapacityUnit = new OptionalValue("ReadCapacityUnit"); + + /** + * 写能力单元。 + */ + private OptionalValue writeCapacityUnit = new OptionalValue("WriteCapacityUnit"); + + /** + * 默认构造函数。 + *

读能力单元和写能力单元默认为未设置。

+ */ + public CapacityUnit() { + } + + /** + * 构造CapacityUnit对象,并指定读能力单元的值和写能力单元的值。 + * + * @param readCapacityUnit 读能力单元的值,必须大于等于0。 + * @param writeCapacityUnit 写能力单元的值,必须大于等于0。 + * @throws IllegalArgumentException 若读或写能力单元值为负数。 + */ + public CapacityUnit(int readCapacityUnit, int writeCapacityUnit) { + setReadCapacityUnit(readCapacityUnit); + setWriteCapacityUnit(writeCapacityUnit); + } + + /** + * 获取读能力单元的值。 + * + * @return 读能力单元的值。 + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public int getReadCapacityUnit() { + if (!readCapacityUnit.isValueSet()) { + throw new IllegalStateException("The value of read capacity unit is not set."); + } + return readCapacityUnit.getValue(); + } + + /** + * 设置读能力单元的值,设置的值必须大于等于0。 + * + * @param readCapacityUnit 读能力单元的值 + * @throws IllegalArgumentException 若读能力单元的值为负数。 + */ + public void setReadCapacityUnit(int readCapacityUnit) { + Preconditions.checkArgument(readCapacityUnit >= 0, "The value of read capacity unit can't be negative."); + this.readCapacityUnit.setValue(readCapacityUnit); + } + + /** + * 查询是否设置了读能力单元。 + * + * @return 是否有设置读能力单元 + */ + public boolean hasSetReadCapacityUnit() { + return readCapacityUnit.isValueSet(); + } + + /** + * 清除设置的读CapacityUnit。 + */ + public void clearReadCapacityUnit() { + readCapacityUnit.clear(); + } + + /** + * 获取写能力单元的值。 + * + * @return 写能力单元的值。 + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public int getWriteCapacityUnit() { + if (!writeCapacityUnit.isValueSet()) { + throw new IllegalStateException("The value of write capacity unit is not set."); + } + return writeCapacityUnit.getValue(); + } + + /** + * 设置写能力单元的值,设置的值必须大于等于0。 + * + * @param writeCapacityUnit 写能力单元的值 + * @throws IllegalArgumentException 若写能力单元的值为负数。 + */ + public void setWriteCapacityUnit(int writeCapacityUnit) { + Preconditions.checkArgument(writeCapacityUnit >= 0, "The value of write capacity unit can't be negative."); + this.writeCapacityUnit.setValue(writeCapacityUnit); + } + + /** + * 查询是否设置了写能力单元。 + * + * @return 是否有设置写能力单元 + */ + public boolean hasSetWriteCapacityUnit() { + return writeCapacityUnit.isValueSet(); + } + + /** + * 清除设置的写CapacityUnit。 + */ + public void clearWriteCapacityUnit() { + writeCapacityUnit.clear(); + } + + @Override + public int hashCode() { + return readCapacityUnit.hashCode() ^ writeCapacityUnit.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof CapacityUnit)) { + return false; + } + + CapacityUnit c1 = (CapacityUnit) o; + return this.readCapacityUnit.equals(c1.readCapacityUnit) && this.writeCapacityUnit.equals(c1.writeCapacityUnit); + } + + @Override + public String toString() { + return "" + readCapacityUnit + ", " + writeCapacityUnit; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + boolean firstItem = true; + sb.append('{'); + if (readCapacityUnit.isValueSet()) { + if (firstItem) { + firstItem = false; + } else { + sb.append(", "); + } + sb.append("\"Read\": "); + sb.append(readCapacityUnit.getValue()); + } + if (writeCapacityUnit.isValueSet()) { + if (firstItem) { + firstItem = false; + } else { + sb.append(", "); + } + sb.append("\"Write\": "); + sb.append(writeCapacityUnit.getValue()); + } + sb.append('}'); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Column.java b/src/main/java/com/alicloud/openservices/tablestore/model/Column.java new file mode 100644 index 0000000..6419447 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Column.java @@ -0,0 +1,157 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.*; + +/** + * TableStore中每行数据可以包含一个或多个属性列({@link Column}), + * 每一个属性列包含名称、值{@link ColumnValue}以及时间戳。 + */ +public class Column implements Jsonizable, Measurable { + public static NameTimestampComparator NAME_TIMESTAMP_COMPARATOR = new NameTimestampComparator(); + + /** + * 属性列的名称。 + */ + private String name; + /** + * 属性列的值。 + */ + private ColumnValue value; + + /** + * 属性列的时间戳。 + */ + private OptionalValue timestamp = new OptionalValue("Timestamp"); + + /** + * 序列化后占用的数据大小 + */ + private int dataSize = -1; + + /** + * 构造一个属性列,必须包含名称、值和时间戳。 + *

属性列的名称不能为null pointer及空字符串。

+ *

属性列的值不能为null pointer。

+ * + * @param name 属性列的名称 + * @param value 属性列的值 + * @param timestamp 属性列的时间戳 + */ + public Column(String name, ColumnValue value, long timestamp) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of column should not be null or empty."); + Preconditions.checkNotNull(value, "The value of column should not be null."); + Preconditions.checkArgument(timestamp >= 0, "The timestamp should not be negative."); + + this.name = name; + this.value = value; + this.timestamp.setValue(timestamp); + } + + public Column(String name, ColumnValue value) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of column should not be null or empty."); + Preconditions.checkNotNull(value, "The value of column should not be null."); + + this.name = name; + this.value = value; + } + + /** + * 获取属性列的名称。 + * + * @return 属性列的名称 + */ + public String getName() { + return name; + } + + public byte[] getNameRawData() { + return Bytes.toBytes(name); + } + + /** + * 获取属性列的值。 + * + * @return 属性列的值 + */ + public ColumnValue getValue() { + return value; + } + + /** + * 获取属性列的时间戳。 + * + * @return 属性列的时间戳 + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public long getTimestamp() { + if (!timestamp.isValueSet()) { + throw new IllegalStateException("The value of Timestamp is not set."); + } + return timestamp.getValue(); + } + + /** + * 检查是否设置了时间戳。 + * + * @return 若设置了时间戳,则返回true,否则返回false + */ + public boolean hasSetTimestamp() { + return timestamp.isValueSet(); + } + + @Override + public String toString() { + return "Name:" + name + ",Value:" + value + "," + timestamp; + } + + @Override + public int hashCode() { + return name.hashCode() ^ value.hashCode() ^ timestamp.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof Column)) { + return false; + } + + Column col = (Column) o; + return this.name.equals(col.name) && this.value.equals(col.value) && this.timestamp.equals(col.timestamp); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"Name\": \""); + sb.append(name); + sb.append("\", "); + + if (timestamp.isValueSet()) { + sb.append("\"Timestamp\": "); + sb.append(timestamp.getValue()); + sb.append(", "); + } + + sb.append("\"Value\": "); + value.jsonize(sb, newline + " "); + sb.append("}"); + } + + @Override + public int getDataSize() { + if (dataSize == -1) { + int size = CalculateHelper.calcStringSizeInBytes(name) + value.getDataSize(); + if (hasSetTimestamp()) { + size += 8; + } + dataSize = size; + } + return dataSize; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ColumnType.java b/src/main/java/com/alicloud/openservices/tablestore/model/ColumnType.java new file mode 100755 index 0000000..1f5a20b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ColumnType.java @@ -0,0 +1,32 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * 表示属性列的数据类型,目前只支持{@link #STRING}、{@link #INTEGER}、{@link #BINARY}、{@link #DOUBLE}和{@link #BOOLEAN}这五种数据类型。 + */ +public enum ColumnType { + /** + * 字符串型。 + */ + STRING, + + /** + * 64位带符号的整型。 + */ + INTEGER, + + /** + * 布尔型。 + */ + BOOLEAN, + + /** + * 64位浮点型。 + */ + DOUBLE, + + /** + * 二进制数据。 + */ + BINARY; + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ColumnValue.java b/src/main/java/com/alicloud/openservices/tablestore/model/ColumnValue.java new file mode 100755 index 0000000..679fde0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ColumnValue.java @@ -0,0 +1,371 @@ +package com.alicloud.openservices.tablestore.model; + +import java.io.IOException; +import java.util.Arrays; + +import com.alicloud.openservices.tablestore.core.utils.Bytes; +import com.alicloud.openservices.tablestore.core.utils.Base64; +import com.alicloud.openservices.tablestore.core.utils.CalculateHelper; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.protocol.PlainBufferCrc8; + +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.*; + +/** + * 表示属性列的值。 + */ +public class ColumnValue implements Comparable, Jsonizable, Measurable { + + /** + * 只供内部使用,请勿使用。 + */ + public static ColumnValue INTERNAL_NULL_VALUE = new ColumnValue(null, ColumnType.STRING); + + private Object value; + private ColumnType type; + private int dataSize = -1; + + public ColumnValue(Object value, ColumnType type) { + this.value = value; + this.type = type; + } + + private int calculateDataSize() { + int dataSize = 0; + switch (this.type) { + case INTEGER: + dataSize = 8; + break; + case STRING: + if (value == null) { + dataSize = 0; + } else { + dataSize = CalculateHelper.calcStringSizeInBytes(this.asString()); + } + break; + case BINARY: + dataSize = this.asBinary().length; + break; + case DOUBLE: + dataSize = 8; + break; + case BOOLEAN: + dataSize = 1; + break; + default: + throw new IllegalStateException("Bug: not support the type : " + type); + } + return dataSize; + } + + /** + * 获取主键列值的大小,各类型大小计算公式为: + * - {@link ColumnType#INTEGER}: 恒定大小为8个字节 + * - {@link ColumnType#DOUBLE}: 恒定大小为8个字节 + * - {@link ColumnType#BOOLEAN}: 恒定大小为1个字节 + * - {@link ColumnType#BINARY}: 大小为字节数 + * - {@link ColumnType#STRING}: 大小为按UTF-8编码后的字节数 + * + * @return 值的大小 + */ + @Override + public int getDataSize() { + if (dataSize == -1) { + dataSize = calculateDataSize(); + } + return this.dataSize; + } + + /** + * 获取属性列的类型。 + * + * @return 属性列的类型。 + */ + public ColumnType getType() { + return type; + } + + /** + * 构造一个类型为{@link ColumnType#STRING}的属性列。 + *

注意:值不能为null pointer。

+ * + * @param value 字符串类型的值。 + * @return 生成的实例 + */ + public static ColumnValue fromString(String value) { + Preconditions.checkNotNull(value, "The value of column should not be null."); + return new ColumnValue(value, ColumnType.STRING); + } + + /** + * 构造一个类型为{@link ColumnType#INTEGER}的属性列。 + * + * @param value 长整型的值。 + * @return 生成的实例 + */ + public static ColumnValue fromLong(long value) { + return new ColumnValue(value, ColumnType.INTEGER); + } + + /** + * 构造一个类型为{@link ColumnType#BINARY}的属性列。 + *

注意:值不能为null pointer。

+ * + * @param value 二进制字符串类型的值。 + * @return 生成的实例 + */ + public static ColumnValue fromBinary(byte[] value) { + Preconditions.checkNotNull(value, "The value of column should not be null."); + return new ColumnValue(value, ColumnType.BINARY); + } + + /** + * 构造一个类型为{@link ColumnType#DOUBLE}的属性列。 + * + * @param value double类型的值。 + * @return 生成的实例 + */ + public static ColumnValue fromDouble(double value) { + return new ColumnValue(value, ColumnType.DOUBLE); + } + + /** + * 构造一个类型为{@link ColumnType#BOOLEAN}的属性列。 + * + * @param value 布尔类型的值。 + * @return 生成的实例 + */ + public static ColumnValue fromBoolean(boolean value) { + return new ColumnValue(value, ColumnType.BOOLEAN); + } + + /** + * 获取属性列的字符串类型的值。 + *

当前仅当数据类型为{@link ColumnType#STRING}才能获取到值。

+ * + * @return 字符串类型的值 + */ + public String asString() { + if (this.type != ColumnType.STRING) { + throw new IllegalStateException("The type of column is not STRING."); + } + + return (String) value; + } + + public byte[] asStringInBytes() { + return Bytes.toBytes(asString()); + } + + /** + * 获取属性列的长整型类型的值。 + *

当前仅当数据类型为{@link ColumnType#INTEGER}才能获取到值。

+ * + * @return 长整型值 + */ + public long asLong() { + if (this.type != ColumnType.INTEGER) { + throw new IllegalStateException("The type of column is not INTEGER."); + } + + return (Long) value; + } + + /** + * 获取属性列的二进制字符串类型的值。 + *

当前仅当数据类型为{@link ColumnType#BINARY}才能获取到值。

+ * + * @return 二进制字符串类型的值 + */ + public byte[] asBinary() { + if (this.type != ColumnType.BINARY) { + throw new IllegalStateException("The type of column is not BINARY."); + } + return (byte[]) value; + } + + /** + * 获取属性列的DOUBLE类型的值。 + *

当前仅当数据类型为{@link ColumnType#DOUBLE}才能获取到值。

+ * + * @return Double类型的值 + */ + public double asDouble() { + if (this.type != ColumnType.DOUBLE) { + throw new IllegalStateException("The type of column is not DOUBLE."); + } + return (Double) value; + } + + /** + * 获取属性列的布尔类型的值。 + *

当前仅当数据类型为{@link ColumnType#BOOLEAN}才能获取到值。

+ * + * @return 布尔类型的值 + */ + public boolean asBoolean() { + if (this.type != ColumnType.BOOLEAN) { + throw new IllegalStateException("The type of column is not BOOLEAN."); + } + return (Boolean) value; + } + + /** + * 采用crc8算法得到一个checksum,主要用于计算cell的checksum + * @param crc crc初始值 + * @return + */ + public byte getChecksum(byte crc) throws IOException { + switch (getType()) { + case STRING: { + byte[] rawData = asStringInBytes(); + crc = PlainBufferCrc8.crc8(crc, VT_STRING); + crc = PlainBufferCrc8.crc8(crc, rawData.length); + crc = PlainBufferCrc8.crc8(crc, rawData); + break; + } + case INTEGER: { + crc = PlainBufferCrc8.crc8(crc, VT_INTEGER); + crc = PlainBufferCrc8.crc8(crc, asLong()); + break; + } + case BINARY: { + byte[] rawData = asBinary(); + crc = PlainBufferCrc8.crc8(crc, VT_BLOB); + crc = PlainBufferCrc8.crc8(crc, rawData.length); + crc = PlainBufferCrc8.crc8(crc, rawData); + break; + } + case DOUBLE: { + crc = PlainBufferCrc8.crc8(crc, VT_DOUBLE); + crc = PlainBufferCrc8.crc8(crc, Double.doubleToRawLongBits(asDouble())); + break; + } + case BOOLEAN: { + crc = PlainBufferCrc8.crc8(crc, VT_BOOLEAN); + crc = PlainBufferCrc8.crc8(crc, asBoolean() ? (byte) 0x1 : (byte) 0x0); + break; + } + default: + throw new IOException("Bug: unsupported column type: " + getType()); + } + return crc; + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof ColumnValue)) { + return false; + } + + ColumnValue val = (ColumnValue) o; + if (this.type == val.type) { + if (this.type == ColumnType.BINARY) { + return Bytes.equals((byte[]) value, (byte[]) val.value); + } else { + if (this.value == null) { + return val.value == null; + } else { + return this.value.equals(val.value); + } + } + } else { + return false; + } + } + + @Override + public int hashCode() { + if (this.type == ColumnType.BINARY) { + return Arrays.hashCode(asBinary()) * 31 + this.type.hashCode(); + } else { + return this.value.hashCode() * 31 + this.type.hashCode(); + } + } + + @Override + public String toString() { + if (this.value == null) { + return "null"; + } + if (this.type == ColumnType.BINARY) { + return Arrays.toString(asBinary()); + } else { + return this.value.toString(); + } + } + + /** + * 比较两个属性列的值的大小。 + *

注意:不同类型的属性列无法比较。

+ * + * @param target + * @return 如果大于返回值大于0,等于返回0,小于返回值小于0 + */ + @Override + public int compareTo(ColumnValue target) { + if (this.type != target.type) { + throw new IllegalArgumentException("The type of column to compare must be the same."); + } + + switch (this.type) { + case STRING: + return ((String) value).compareTo(target.asString()); + case INTEGER: + return ((Long) value).compareTo(target.asLong()); + case BINARY: + byte[] b1 = (byte[]) this.value; + byte[] b2 = (byte[]) target.value; + int ret = Bytes.compareByteArrayInLexOrder(b1, 0, b1.length, b2, 0, b2.length); + return ret; + case DOUBLE: + return ((Double) value).compareTo(target.asDouble()); + case BOOLEAN: + return ((Boolean) value).compareTo(target.asBoolean()); + default: + throw new IllegalArgumentException("Unknown type: " + this.type); + } + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"Type\": \""); + sb.append(type.toString()); + sb.append("\", \"Value\": "); + + switch(type) { + case INTEGER: + sb.append(asLong()); + break; + case BINARY: + sb.append("\""); + sb.append(Base64.toBase64String(asBinary())); + sb.append("\""); + break; + case DOUBLE: + sb.append(asDouble()); + break; + case BOOLEAN: + sb.append(asBoolean() ? "true" : "false"); + break; + case STRING: + sb.append("\""); + sb.append(asString()); + sb.append("\""); + break; + default: + throw new IllegalArgumentException("Unknown type: " + type); + } + + sb.append("}"); + } +} + diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionRequest.java new file mode 100644 index 0000000..43b4c72 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionRequest.java @@ -0,0 +1,40 @@ +package com.alicloud.openservices.tablestore.model; + + +public class CommitTransactionRequest implements Request { + + /** + * 事务的ID。 + */ + private String transactionID; + + /** + * 设置事务的ID。 + */ + public void setTransactionID(String transactionID) { + this.transactionID = transactionID; + } + + /** + * 获取事务的ID。 + * + * @return 事务的ID + */ + public String getTransactionID() { + return transactionID; + } + + /** + * 初始化CommitTransactionRequest实例。 + * + * @param transactionID 事务的ID。 + */ + public CommitTransactionRequest(String transactionID) { + setTransactionID(transactionID); + } + + @Override + public String getOperationName() { + return OperationNames.OP_COMMIT_TRANSACTION; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionResponse.java new file mode 100644 index 0000000..b863503 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/CommitTransactionResponse.java @@ -0,0 +1,9 @@ +package com.alicloud.openservices.tablestore.model; + + +public class CommitTransactionResponse extends Response { + + public CommitTransactionResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeRequest.java new file mode 100644 index 0000000..6be17db --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeRequest.java @@ -0,0 +1,89 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class ComputeSplitsBySizeRequest implements Request { + + private String tableName = null; + + private long splitUnitCount = 0l; + private long splitUnitSizeInByte = 100 * 1024 * 1024; // default 100M split unit + + public ComputeSplitsBySizeRequest() { + this(null, 0l); + } + + public ComputeSplitsBySizeRequest(ComputeSplitsBySizeRequest request) { + this(request.getTableName(), request.getSplitSizeIn100MB()); + } + + public ComputeSplitsBySizeRequest(String tableName, long splitSizeIn100MB) { + this.tableName = tableName; + this.splitUnitCount = splitSizeIn100MB; + this.splitUnitSizeInByte = 100 * 1024 * 1024; + } + + public ComputeSplitsBySizeRequest(String tableName, long splitUnitCount, long splitUnitSizeInByte) { + this.tableName = tableName; + this.splitUnitCount = splitUnitCount; + this.splitUnitSizeInByte = splitUnitSizeInByte; + } + + /** + * 获得进行该类所进行的操作的接口名称。 + * + */ + @Override + public String getOperationName() { + return OperationNames.OP_COMPUTE_SPLITS_BY_SIZE; + } + + /** + * 获得进行ComputeSplitsBySize操作的目标表格名称。 + * + */ + public String getTableName() { + return tableName; + } + + /** + * 设置进行ComputeSplitsBySize操作的目标表格名称。 + * + * @param tableName + * 进行ComputeSplitsBySize操作的目标表格名称。 + */ + public void setTableName(String tableName) { + this.tableName = tableName; + } + + /** + * 获得进行ComputeSplitsBySize操作的每个数据分块的大小上限。 + * + */ + public long getSplitSizeIn100MB() { + return this.splitUnitCount * this.splitUnitSizeInByte / (100 * 1024 * 1024); + } + + public long getSplitUnitCount() { + return this.splitUnitCount; + } + public long getSplitUnitSizeInByte() { + return this.splitUnitSizeInByte; + } + + /** + * 设置进行ComputeSplitsBySize操作的每个数据分块的大小上限。 + * + * @param splitSizeIn100MB + * 进行ComputeSplitsBySize操作的每个数据分块的大小上限。 + */ + public void setSplitSizeIn100MB(long splitSizeIn100MB) { + this.splitUnitCount = splitSizeIn100MB; + this.splitUnitSizeInByte = 100 * 1024 * 1024; + } + + public void setSplitSizeInByte(long splitUnitCount, long splitUnitSizeInByte) { + this.splitUnitCount = splitUnitCount; + this.splitUnitSizeInByte = splitUnitSizeInByte; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeResponse.java new file mode 100644 index 0000000..6f1e736 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ComputeSplitsBySizeResponse.java @@ -0,0 +1,228 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class ComputeSplitsBySizeResponse extends Response implements Jsonizable { + + /** + * 响应所包含的数据分块信息列表,每个分块信息包含分块所在的partition位置信息以及开始和终止主键值。 每个数据分块按照主键的递增顺序排列。 + * + */ + private List splits = new ArrayList(); + + /** + * 此次操作消耗的能力单元。 + * + */ + private ConsumedCapacity consumedCapacity; + + /** + * 表的主键定义。 字典内的主键是有顺序的,顺序与用户添加主键的顺序相同。 + * + */ + private List primaryKeySchema = new ArrayList(); + + /** + * internal use + */ + public ComputeSplitsBySizeResponse(Response meta) { + super(meta); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{"); + sb.append("\"ConsumedCapacity\": "); + if (this.getConsumedCapacity() != null) { + this.getConsumedCapacity().jsonize(sb, newline + " "); + } else { + sb.append("null"); + } + sb.append(", "); + + sb.append("\"PrimaryKeySchema\": "); + boolean firstItem = true; + if (this.getPrimaryKeySchema() != null) { + sb.append("[ "); + for (PrimaryKeySchema pks : this.primaryKeySchema) { + if (firstItem == true) { + firstItem = false; + } else { + sb.append(", "); + } + pks.jsonize(sb, newline + " "); + } + sb.append("] "); + } else { + sb.append("null "); + } + sb.append(", "); + sb.append("\"Splits\": "); + if (this.getSplits() != null) { + sb.append("["); + firstItem = true; + for (Split s : this.splits) { + if (firstItem == true) { + firstItem = false; + } else { + sb.append(", "); + } + s.jsonize(sb, newline + " "); + } + sb.append("]"); + } else { + sb.append("null "); + } + sb.append("}"); + } + + /** + * 获得响应返回的数据分块列表。 + * + */ + public List getSplits() { + return splits; + } + + /** + * 设置响应的数据分块列表。 + * + * @param splits + * 需要设置的数据分块列表。 + */ + public void setSplits(List splits) { + this.splits = splits; + } + + /** + * 添加一个数据分块。 + * + * @param split + * 所需要添加的数据分块。 + */ + public void addSplit(Split split) { + this.splits.add(split); + } + + /** + * 获得ComputeSplitsBySize操作所消耗的CU数值。 + * + */ + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + /** + * 设置ComputeSplitsBySize操作所消耗的CU数值参数。 + * + * @param consumedCapacity + * ComputeSplitsBySize操作所消耗的CU参数数值。 + */ + public void setConsumedCapacity(ConsumedCapacity consumedCapacity) { + this.consumedCapacity = consumedCapacity; + } + + /** + * 获得主键列定义。 + * + */ + public List getPrimaryKeySchema() { + return primaryKeySchema; + } + + /** + * 设置主键列定义。 + * + * @param primaryKeySchema + * 主键列的定义列表。 + */ + public void setPrimaryKeySchema(List primaryKeySchema) { + this.primaryKeySchema = primaryKeySchema; + } + + /** + * 添加一个主键列定义。 + * + * @param name + * 主键列的名称。 + * @param type + * 主键列的数据类型。 + */ + public void addPrimaryKeySchema(String name, PrimaryKeyType type) { + Preconditions.checkArgument(name != null && !name.isEmpty(), + "The name of primary key should not be null or empty."); + Preconditions.checkNotNull(type, "The type of primary key should not be null."); + + this.primaryKeySchema.add(new PrimaryKeySchema(name, type)); + } + + /** + * 添加一个主键列定义。 + * + * @param name + * 主键列的名称。 + * @param type + * 主键列的数据类型。 + * @param option + * 主键列的属性。 + */ + public void addPrimaryKeySchema(String name, PrimaryKeyType type, PrimaryKeyOption option) { + Preconditions.checkArgument(name != null && !name.isEmpty(), + "The name of primary key should not be null or empty."); + Preconditions.checkNotNull(type, "The type of primary key should not be null."); + Preconditions.checkNotNull(option, "The option of primary key should not be null."); + + this.primaryKeySchema.add(new PrimaryKeySchema(name, type, option)); + } + + /** + * 添加一个主键列定义。 + * + * @param key + * 主键列的定义 + */ + public void addPrimaryKeySchema(PrimaryKeySchema key) { + Preconditions.checkNotNull(key, "The primary key schema should not be null."); + + this.primaryKeySchema.add(key); + } + + /** + * 添加一组主键列定义。 + * + * @param pks + * 主键列的定义 + */ + public void addPrimaryKeySchemas(List pks) { + Preconditions.checkArgument(pks != null && !pks.isEmpty(), + "The primary key schema should not be null or empty."); + + this.primaryKeySchema.addAll(pks); + } + + /** + * 添加一组主键列定义。 + * + * @param pks + * 主键列的定义 + */ + public void addPrimaryKeySchemas(PrimaryKeySchema[] pks) { + Preconditions.checkArgument(pks != null && pks.length != 0, + "The primary key schema should not be null or empty."); + + Collections.addAll(this.primaryKeySchema, pks); + } + +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/Condition.java b/src/main/java/com/alicloud/openservices/tablestore/model/Condition.java similarity index 63% rename from src/main/java/com/aliyun/openservices/ots/model/Condition.java rename to src/main/java/com/alicloud/openservices/tablestore/model/Condition.java index bf81714..e57f135 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/Condition.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Condition.java @@ -1,7 +1,18 @@ -package com.aliyun.openservices.ots.model; +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ -import com.aliyun.openservices.ots.model.condition.ColumnCondition; +package com.alicloud.openservices.tablestore.model; +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; + +/** + * TableStore支持条件更新功能, 在进行PutRow, UpdateRow, DeleteRow或BatchWriteRow操作时, 可以设置条件{@link Condition}. + * Condition包括行存在性条件{@link RowExistenceExpectation}和列条件{@link ColumnCondition}. + */ public class Condition { private RowExistenceExpectation rowExistenceExpectation = RowExistenceExpectation.IGNORE; private ColumnCondition columnCondition = null; diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ConsumedCapacity.java b/src/main/java/com/alicloud/openservices/tablestore/model/ConsumedCapacity.java new file mode 100755 index 0000000..146e5c3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ConsumedCapacity.java @@ -0,0 +1,38 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +/** + * 读写操作消耗的能力单元。 + *

读操作会消耗读能力单元,例如GetRow、GetRange和BatchGetRow等。

+ *

写操作会消耗写能力单元,例如PutRow、UpdateRow、DeleteRow和BatchWriteRow等。

+ */ +public class ConsumedCapacity implements Jsonizable { + + private CapacityUnit capacityUnit; + + public ConsumedCapacity(CapacityUnit capacityUnit) { + Preconditions.checkNotNull(capacityUnit); + this.capacityUnit = capacityUnit; + } + + /** + * 返回消耗的能力单元的值。 + * + * @return 能力单元 + */ + public CapacityUnit getCapacityUnit() { + return capacityUnit; + } + + @Override + public String jsonize() { + return capacityUnit.jsonize(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + capacityUnit.jsonize(sb, newline); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexRequest.java new file mode 100755 index 0000000..017f28d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexRequest.java @@ -0,0 +1,88 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * CreateIndexRequest包含创建一张新的索引表所必需的一些参数,包括表的Meta + * 在初始化实例之后,可以通过调用{@link #setIndexMeta(IndexMeta)} 来更改索引表的Meta。 + + */ +public class CreateIndexRequest implements Request { + /** + * 主表名 + */ + private String mainTableName; + + /** + * 索引表信息。 + */ + private IndexMeta indexMeta; + + /* + * 是否包含主表中已有数据 + */ + private boolean includeBaseData; + + /** + * 初始化CreateIndexRequest实例。 + * + * @param mainTableName 主表的名字。 + * @param indexMeta 索引表的结构信息。 + * @param includeBaseData 新建索引表是否要包含主表中已有数据 + */ + public CreateIndexRequest(String mainTableName, IndexMeta indexMeta, boolean includeBaseData) { + setMainTableName(mainTableName); + setIndexMeta(indexMeta); + + } + + public void setMainTableName(String mainTableName) { + Preconditions.checkArgument(mainTableName != null && !mainTableName.isEmpty(), + "The main table name should not be null or empty");; + this.mainTableName = mainTableName; + } + + public void setIndexMeta(IndexMeta indexMeta) { + Preconditions.checkArgument(indexMeta != null, "The index meta should not be null"); + this.indexMeta = indexMeta; + } + + public void setIncludeBaseData(boolean includeBaseData) { + this.includeBaseData = includeBaseData; + } + /** + * 获取主表的名字。 + * + * @return 主表的名字 + */ + public String getMainTableName() { + return mainTableName; + } + + /** + * 获取索引表的结构信息 + * + * @return 索引表的结构信息 + */ + public IndexMeta getIndexMeta() { + return indexMeta; + } + + /** + * 获取创建索引索引表时,索引表中是否包含主表已有数据 + * @return 是否包含主表已有数据 + */ + public boolean getIncludeBaseData() { return includeBaseData; } + + @Override + public String getOperationName() { + return OperationNames.OP_CREATE_INDEX; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexResponse.java new file mode 100755 index 0000000..7177d93 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/CreateIndexResponse.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * CreateIndex操作的返回结果。 + */ +public class CreateIndexResponse extends Response { + + public CreateIndexResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/CreateTableRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/CreateTableRequest.java new file mode 100755 index 0000000..d374d95 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/CreateTableRequest.java @@ -0,0 +1,201 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * CreateTableRequest包含创建一张新的表所必需的一些参数,包括表的Meta、预留读写吞吐量、表的配置以及预分区配置等。 + * 在初始化实例之后,可以通过调用{@link #setTableMeta(TableMeta)} 来更改表的Meta。 + * 在初始化实例之后,可以通过调用{@link #setReservedThroughput(ReservedThroughput)} 来更改表的预留吞吐量。 + * 在初始化实例之后,可以通过调用{@link #setTableOptions(TableOptions)} 来更改表的配置。 + */ +public class CreateTableRequest implements Request { + /** + * 表的结构信息。 + */ + private TableMeta tableMeta; + + /** + * 索引表信息 + */ + private List indexMeta = new ArrayList(); + + /** + * 表的预留吞吐量设置。 + */ + private ReservedThroughput reservedThroughput; + + /** + * 表的配置项, 包括TTL和最大版本数等。 + */ + private TableOptions tableOptions; + + /** + * 表的Stream配置。 + */ + private OptionalValue streamSpecification = new OptionalValue("StreamSpecification"); + + /** + * 初始化CreateTableRequest实例。 + *

表的预留吞吐量和表的配置都会采用默认值,若有需求需要定制更改,可以调用相应的设置函数。 + *

表默认将不进行任何预切分,若需要对表的分区进行设置,可以调用相应的设置函数。 + * + * @param tableMeta 表的结构信息。 + */ + public CreateTableRequest(TableMeta tableMeta, TableOptions tableOptions) { + this(tableMeta, tableOptions, new ReservedThroughput()); + } + + public CreateTableRequest( + TableMeta tableMeta, + TableOptions tableOptions, + ReservedThroughput reservedThroughput) { + setTableOptions(tableOptions); + setReservedThroughput(reservedThroughput); + setTableMeta(tableMeta); + } + + public CreateTableRequest( + TableMeta tableMeta, + TableOptions tableOptions, + List indexMeta) { + setTableMeta(tableMeta); + setTableOptions(tableOptions); + setReservedThroughput(new ReservedThroughput()); + for (IndexMeta index : indexMeta) { + addIndex(index); + } + } + + public CreateTableRequest( + TableMeta tableMeta, + TableOptions tableOptions, + ReservedThroughput reservedThroughput, + List indexMeta) { + setTableMeta(tableMeta); + setTableOptions(tableOptions); + setReservedThroughput(reservedThroughput); + for (IndexMeta index : indexMeta) { + addIndex(index); + } + } + + @Override + public String getOperationName() { + return OperationNames.OP_CREATE_TABLE; + } + + /** + * 获取表的结构信息。 + * + * @return 表的结构信息 + */ + public TableMeta getTableMeta() { + return tableMeta; + } + + /** + * 设置表的结构信息。 + * + * @param tableMeta 表的结构信息 + */ + public void setTableMeta(TableMeta tableMeta) { + Preconditions.checkNotNull(tableMeta, "TableMeta should not be null."); + this.tableMeta = tableMeta; + } + + /** + * 获取表的预留吞吐量。 + * + * @return 表的预留吞吐量设置。 + */ + public ReservedThroughput getReservedThroughput() { + return reservedThroughput; + } + + /** + * 设置表的预留吞吐量。 + * + * @param reservedThroughput 表的预留吞吐量。 + */ + public void setReservedThroughput(ReservedThroughput reservedThroughput) { + Preconditions.checkNotNull(reservedThroughput, "ReservedThroughput should not be null."); + CapacityUnit cu = reservedThroughput.getCapacityUnit(); + Preconditions.checkArgument(cu.hasSetReadCapacityUnit() && cu.hasSetWriteCapacityUnit(), + "You must set both read and write capacity unit."); + Preconditions.checkArgument(cu.getReadCapacityUnit() >= 0, "The value of read capacity unit must be greater than 0."); + Preconditions.checkArgument(cu.getWriteCapacityUnit() >= 0, "The value of write capacity unit must be greater than 0."); + this.reservedThroughput = reservedThroughput; + } + + /** + * 获取表的配置参数。 + * + * @return 表的配置。 + */ + public TableOptions getTableOptions() { + return tableOptions; + } + + /** + * 设置表的配置参数。 + * + * @param tableOptions 表的配置。 + */ + public void setTableOptions(TableOptions tableOptions) { + Preconditions.checkNotNull(tableOptions, "TableOptionsEx should not be null."); + this.tableOptions = tableOptions; + } + + /** + * 获取Stream的配置参数 + * + * @return Stream的配置参数。若返回null,则代表未设置该配置。 + */ + public StreamSpecification getStreamSpecification() { + return streamSpecification.getValue(); + } + + /** + * 设置Stream的配置参数 + * + * @param streamSpecification + */ + public void setStreamSpecification(StreamSpecification streamSpecification) { + Preconditions.checkArgument(streamSpecification != null, "The stream specification should not be null"); + this.streamSpecification.setValue(streamSpecification); + } + + /** + * 添加索引表 + * + * @param indexMetas 索引表meta + */ + public void addIndex(IndexMeta[] indexMetas) { + Preconditions.checkArgument(indexMetas != null && indexMetas.length != 0, "The index meta should not be null or empty"); + Collections.addAll(indexMeta, indexMetas); + } + + /** + * 添加索引表 + * + * @param indexMeta 索引表meta + */ + public void addIndex(IndexMeta indexMeta) { + Preconditions.checkArgument(indexMeta != null, "The index meta should not be null"); + this.indexMeta.add(indexMeta); + } + + /** + * 返回索引表meta列表 + * + * @return 包含所有索引表meta的只读列表。 + */ + public List getIndexMetaList() { + return Collections.unmodifiableList(indexMeta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/CreateTableResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/CreateTableResponse.java new file mode 100755 index 0000000..0e08327 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/CreateTableResponse.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * CreateTable操作的返回结果。 + */ +public class CreateTableResponse extends Response { + + public CreateTableResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DefaultRetryStrategy.java b/src/main/java/com/alicloud/openservices/tablestore/model/DefaultRetryStrategy.java new file mode 100644 index 0000000..76959a4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DefaultRetryStrategy.java @@ -0,0 +1,152 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.Random; +import java.util.concurrent.TimeUnit; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.PartialResultFailedException; +import com.alicloud.openservices.tablestore.core.ErrorCode; + +import static com.alicloud.openservices.tablestore.model.OperationNames.*; + +/** + * TableStore SDK支持自定义重试逻辑{@link RetryStrategy}, 重试逻辑用于判断在发生异常时是否需要重试, 并给出本次重试的时间间隔. + * {@link DefaultRetryStrategy}为TableStore SDK默认的重试逻辑. + */ +public class DefaultRetryStrategy implements RetryStrategy { + private final int MAX_BASE = 320; // in msec + private Random rnd = new Random(); + private int retries = 0; + private long timeout = 0; // in msec + private int base = 10; // in msec + private long deadline = 0; + + public DefaultRetryStrategy() { + this(10, TimeUnit.SECONDS); + } + + public DefaultRetryStrategy(long timeout, TimeUnit unit) { + this.timeout = unit.toMillis(timeout); + this.deadline = System.currentTimeMillis() + this.timeout; + } + + @Override + public RetryStrategy clone() { + return new DefaultRetryStrategy(this.timeout, TimeUnit.MILLISECONDS); + } + + @Override + public int getRetries() { + return retries; + } + + private boolean isIdempotent(String action) { + /** + * all read operations are idempotent + */ + if (action.equals(OP_BATCH_GET_ROW) || action.equals(OP_DESCRIBE_TABLE) || + action.equals(OP_GET_RANGE) || action.equals(OP_GET_ROW) || + action.equals(OP_LIST_TABLE) || action.equals(OP_LIST_TUNNEL) || + action.equals(OP_DESCRIBE_TUNNEL) || action.equals(OP_READRECORDS)) { + return true; + } else { + return false; + } + } + + private boolean retryNotMatterActions(String errorCode, String errorMessage) { + if (errorCode.equals(ErrorCode.ROW_OPERATION_CONFLICT) || errorCode.equals(ErrorCode.NOT_ENOUGH_CAPACITY_UNIT) + || errorCode.equals(ErrorCode.TABLE_NOT_READY) || errorCode.equals(ErrorCode.PARTITION_UNAVAILABLE) + || errorCode.equals(ErrorCode.SERVER_BUSY) + || (errorCode.equals(ErrorCode.QUOTA_EXHAUSTED) && errorMessage.equals("Too frequent table operations."))) { + return true; + } else { + return false; + } + } + + private boolean shouldRetryWithOTSException(String action, boolean isIdempotent, String errorCode, + String errorMessage, int httpStatus) { + if (retryNotMatterActions(errorCode, errorMessage)) { + return true; + } + + boolean serverError = httpStatus >= 500 && httpStatus <= 599; + if (isIdempotent && + (errorCode.equals(ErrorCode.STORAGE_TIMEOUT) + || errorCode.equals(ErrorCode.INTERNAL_SERVER_ERROR) + || errorCode.equals(ErrorCode.SERVER_UNAVAILABLE) + || errorCode.equals(ErrorCode.TUNNEL_SERVER_UNAVAILABLE) + || serverError + )) { + return true; + } + return false; + } + + /** + * SDK提供的默认重试策略,规则为: + * 1. 若异常为TableStoreException,且错误码为OTSRowOperationConflict, OTSNotEnoughCapacityUnit, OTSTableNotReady, + * OTSPartitionUnavailable或OTSServerBusy,则可以重试。 + * 2. 若异常为OTSQuotaExhausted且异常消息为"Too frequent table operations.",则可以重试。 + * 3. 若异常为ClientException(网络类异常),且操作是幂等的,则可以重试。 + * 4. 若异常为OTSTimeout, OTSInternalServerError, OTSServerUnavailable, OTSTunnelServerUnavailable或http状态码为500, 502或503,且操作为幂等的,则可以重试。 + * 5. 若操作为Batch操作,只有所有失败的行可重试时,批量操作才可以重试 + * + * 默认的重试策略会把所有读相关的操作认为是幂等的,而所有写相关的操作会被认为是非幂等的,若用户对写有重试的需求,需要定制重试策略。 + * + * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 + * @param ex 上次访问失败的错误信息、为ClientException或OTSException + * @return + */ + public boolean shouldRetry(String action, Exception ex) { + boolean isIdempotent = isIdempotent(action); + if (ex instanceof TableStoreException) { + if (ex instanceof PartialResultFailedException) { + PartialResultFailedException prfe = (PartialResultFailedException)ex; + for (TableStoreException otsException : prfe.getErrors()) { + if (!shouldRetryWithOTSException(action, isIdempotent, otsException.getErrorCode(), + otsException.getMessage(), prfe.getHttpStatus())) { + return false; + } + } + return true; + } else { + TableStoreException otsException = (TableStoreException)ex; + return shouldRetryWithOTSException(action, isIdempotent, otsException.getErrorCode(), + otsException.getMessage(), otsException.getHttpStatus()); + } + } else if (ex instanceof ClientException) { + return isIdempotent; + } else { + return false; + } + } + + @Override + public long nextPause(String action, Exception ex) { + if (!shouldRetry(action, ex)) { + return 0; + } + + if (base <= 0) { + return 0; + } + + long now = System.currentTimeMillis(); + int expire = (int)(deadline - now); + if (expire <= 0) { + return 0; + } + + // randomly exponential backoff, in order to make requests sparse. + long delay = 1 + rnd.nextInt(base < expire ? base : expire); + ++retries; + base *= 2; + if (base > MAX_BASE) { + base = MAX_BASE; + } + return delay; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnSchema.java b/src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnSchema.java new file mode 100644 index 0000000..ea2fc14 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnSchema.java @@ -0,0 +1,84 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class DefinedColumnSchema implements Jsonizable { + private String name; + private DefinedColumnType type; + + public DefinedColumnSchema(String name, DefinedColumnType type) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "Defined col's name should not be null or empty."); + Preconditions.checkNotNull(type, "The type should not be null."); + + this.setName(name); + this.setType(type); + } + + /** + * 获取预定义列的名称。 + * @return 预定义列的名称。 + */ + public String getName() { + return name; + } + + /** + * 设置预定义列的名称。 + * @param name 预定义列的名称。 + */ + public void setName(String name) { + this.name = name; + } + + /** + * 获取预定义列的类型。 + * @return 预定义列的类型。 + */ + public DefinedColumnType getType() { + return type; + } + + /** + * 设置预定义列的类型。 + * @param type 预定义列的类型。 + */ + public void setType(DefinedColumnType type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof DefinedColumnSchema)) { + return false; + } + + DefinedColumnSchema target = (DefinedColumnSchema) o; + return this.name.equals(target.name) && this.type == target.type; + } + + @Override + public int hashCode() { + return this.name.hashCode() ^ this.type.hashCode(); + } + + @Override + public String toString() { + return name + ":" + type; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append(String.format( + "{\"Name\": \"%s\", \"Type\": \"%s\"}", + name, type.toString())); + + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnType.java b/src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnType.java new file mode 100644 index 0000000..0242707 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DefinedColumnType.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * 表示预定义列的数据类型,目前只支持{@link #INTEGER}、{@link #DOUBLE}、{@link #BOOLEAN}、{@link #STRING}和{@link #BINARY}这五种数据类型。 + */ +public enum DefinedColumnType { + /** + * 64位整数。 + */ + INTEGER, + + /** + * 浮点数。 + */ + DOUBLE, + + /** + * 布尔值。 + */ + BOOLEAN, + + /** + * 字符串。 + */ + STRING, + + /** + * BINARY。 + */ + BINARY; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexRequest.java new file mode 100755 index 0000000..012e90c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexRequest.java @@ -0,0 +1,53 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class DeleteIndexRequest implements Request { + /** + * 表的名称。 + */ + private String mainTableName; + + /** + * 索引表的名称。 + */ + private String indexName; + + public DeleteIndexRequest(String tableName, String indexName) { + setMainTableName(tableName); + setIndeName(indexName); + } + + /** + * 获取表的名称。 + * @return 表的名称。 + */ + public String getMainTableName() { + return mainTableName; + } + + + public void setMainTableName(String tableName) { + Preconditions.checkArgument( + tableName != null && !tableName.isEmpty(), + "The name of table should not be null or empty."); + this.mainTableName = tableName; + } + + /** + * 获取索引表的名称。 + * @return 索引表的名称 + */ + public String getIndexName() { return indexName; } + + public void setIndeName(String indexName) { + Preconditions.checkArgument(indexName != null && !indexName.isEmpty(), + "The name of index should not be null or empty"); + this.indexName = indexName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_DELETE_INDEX; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexResponse.java new file mode 100755 index 0000000..d7b3b51 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteIndexResponse.java @@ -0,0 +1,8 @@ +package com.alicloud.openservices.tablestore.model; + +public class DeleteIndexResponse extends Response { + + public DeleteIndexResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowRequest.java new file mode 100755 index 0000000..7070a60 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowRequest.java @@ -0,0 +1,41 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class DeleteRowRequest extends TxnRequest { + + /** + * DeleteRow操作的请求参数。 + */ + private RowDeleteChange rowChange; + + public DeleteRowRequest() { + + } + + public DeleteRowRequest(RowDeleteChange rowChange) { + setRowChange(rowChange); + } + + @Override + public String getOperationName() { + return OperationNames.OP_DELETE_ROW; + } + + /** + * 获取DeleteRow的请求参数。 + * @return DeleteRow的请求参数。 + */ + public RowDeleteChange getRowChange() { + return rowChange; + } + + /** + * 设置DeleteRow的请求参数。 + * @param rowChange DeleteRow的请求参数。 + */ + public void setRowChange(RowDeleteChange rowChange) { + Preconditions.checkNotNull(rowChange, "The row change for DeleteRow should not be null."); + this.rowChange = rowChange; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowResponse.java new file mode 100755 index 0000000..a5edd64 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteRowResponse.java @@ -0,0 +1,52 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class DeleteRowResponse extends Response implements Jsonizable { + /** + * 此次操作消耗的能力单元。 + */ + private ConsumedCapacity consumedCapacity; + + /** + * ReturnType指定返回的值。 + */ + private Row row; + + public DeleteRowResponse(Response meta, Row row, ConsumedCapacity consumedCapacity) { + super(meta); + this.consumedCapacity = consumedCapacity; + this.row = row; + } + + /** + * 获取此次操作消耗的能力单元。 + * + * @return 此次操作消耗的能力单元。 + */ + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"ConsumedCapacity\": "); + consumedCapacity.jsonize(sb, newline + " "); + sb.append("}"); + } + + public Row getRow() { + return row; + } + + public void setRow(Row row) { + this.row = row; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableRequest.java new file mode 100755 index 0000000..8b342cc --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableRequest.java @@ -0,0 +1,34 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class DeleteTableRequest implements Request { + /** + * 表的名称。 + */ + private String tableName; + + public DeleteTableRequest(String tableName) { + setTableName(tableName); + } + + /** + * 获取表的名称。 + * @return 表的名称。 + */ + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + Preconditions.checkArgument( + tableName != null && !tableName.isEmpty(), + "The name of table should not be null or empty."); + this.tableName = tableName; + } + + public String getOperationName() { + return OperationNames.OP_DELETE_TABLE; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableResponse.java new file mode 100755 index 0000000..82ba687 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DeleteTableResponse.java @@ -0,0 +1,8 @@ +package com.alicloud.openservices.tablestore.model; + +public class DeleteTableResponse extends Response { + + public DeleteTableResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamRequest.java new file mode 100644 index 0000000..cb4803c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamRequest.java @@ -0,0 +1,102 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class DescribeStreamRequest implements Request { + + /** + * StreamId,指定一个Stream。 + */ + private String streamId; + + /** + * InclusiveStartShardId指定返回的Shard列表的左边界。可选参数。 + */ + private OptionalValue inclusiveStartShardId = new OptionalValue("InclusiveStartShardId"); + + /** + * ShardLimit指定返回的Shard的最大数目。可选参数。 + */ + private OptionalValue shardLimit = new OptionalValue("ShardLimit"); + + public DescribeStreamRequest(String streamId) { + setStreamId(streamId); + } + + /** + * 获取StreamId参数。 + * StreamId用于指定一个Stream,当在一个表上开启Stream时,对应的StreamId会由服务端生成。 + * 用户可以通过ListStream请求获取StreamId。 + * + * @return streamId + */ + public String getStreamId() { + return streamId; + } + + /** + * 设置StreamId参数。 + * StreamId用于指定一个Stream,当在一个表上开启Stream时,对应的StreamId会由服务端生成。 + * 用户可以通过ListStream请求获取StreamId。 + * + * @param streamId + */ + public void setStreamId(String streamId) { + Preconditions.checkArgument(streamId != null && !streamId.isEmpty(), "The streamId should not be null or empty."); + this.streamId = streamId; + } + + /** + * 获取InclusiveStartShardId参数。 + * InclusiveStartShardId参数用于指定返回的Shard列表的左边界(包含)。 + * 若返回null, 则代表该参数为设置。 + * + * @return inclusiveStartShardId + */ + public String getInclusiveStartShardId() { + return inclusiveStartShardId.getValue(); + } + + /** + * 设置InclusiveStartShardId参数。 + * InclusiveStartShardId参数用于指定返回的Shard列表的左边界(包含)。 + * + * @param inclusiveStartShardId + */ + public void setInclusiveStartShardId(String inclusiveStartShardId) { + Preconditions.checkArgument(inclusiveStartShardId != null && !inclusiveStartShardId.isEmpty(), + "The inclusiveStartShardId is null or empty."); + this.inclusiveStartShardId.setValue(inclusiveStartShardId); + } + + /** + * 获取ShardLimit参数。 + * ShardLimit参数用于限制返回的Shard的最大数目。 + * + * @return ShardLimit参数,若为-1,则代表未设置该参数。 + */ + public int getShardLimit() { + if (shardLimit.isValueSet()) { + return shardLimit.getValue(); + } else { + return -1; + } + } + + /** + * 设置ShardLimit参数。 + * ShardLimit参数用于限制返回的Shard的最大数目。 + * + * @param shardLimit + */ + public void setShardLimit(int shardLimit) { + Preconditions.checkArgument(shardLimit > 0, "The limit must be greater than 0."); + this.shardLimit.setValue(shardLimit); + } + + @Override + public String getOperationName() { + return OperationNames.OP_DESCRIBE_STREAM; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamResponse.java new file mode 100644 index 0000000..fd8bcf9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeStreamResponse.java @@ -0,0 +1,134 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.List; + +public class DescribeStreamResponse extends Response { + + /** + * Stream的Id + */ + private String streamId; + + /** + * Stream的过期时间 + */ + private int expirationTime; + + /** + * 所属的表的名称 + */ + private String tableName; + + /** + * Stream的创建时间 + */ + private long creationTime; + + /** + * Stream的状态 + */ + private StreamStatus status; + + /** + * Shard列表 + */ + private List shards; + + /** + * 用于下一次请求时指定返回Shard列表的左边界(InclusiveStartShardId) + */ + private String nextShardId; + + public DescribeStreamResponse() { + + } + + public DescribeStreamResponse(Response meta) { + super(meta); + } + + /** + * 获取Stream的Id + * @return Stream的Id + */ + public String getStreamId() { + return streamId; + } + + public void setStreamId(String streamId) { + this.streamId = streamId; + } + + /** + * 获取表的名称 + * @return 表的名称 + */ + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + /** + * 获取Shard列表 + * @return Shard列表 + */ + public List getShards() { + return shards; + } + + public void setShards(List shards) { + this.shards = shards; + } + + /** + * 获取NextShardId参数 + * @return NextShardId参数 + */ + public String getNextShardId() { + return nextShardId; + } + + public void setNextShardId(String nextShardId) { + this.nextShardId = nextShardId; + } + + /** + * 获取Stream的状态 + * @return Stream的状态 + */ + public StreamStatus getStatus() { + return status; + } + + public void setStatus(StreamStatus status) { + this.status = status; + } + + /** + * 获取Stream的过期时间,单位小时 + * @return Stream的过期时间 + */ + public int getExpirationTime() { + return expirationTime; + } + + public void setExpirationTime(int expirationTime) { + this.expirationTime = expirationTime; + } + + /** + * 获取Stream的创建时间,单位微秒 + * @return Stream的创建时间,单位微秒 + */ + public long getCreationTime() { + return creationTime; + } + + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } +} + diff --git a/src/main/java/com/aliyun/openservices/ots/model/DescribeTableRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeTableRequest.java similarity index 59% rename from src/main/java/com/aliyun/openservices/ots/model/DescribeTableRequest.java rename to src/main/java/com/alicloud/openservices/tablestore/model/DescribeTableRequest.java index 260fb1b..c24887d 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/DescribeTableRequest.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeTableRequest.java @@ -1,15 +1,14 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; -public class DescribeTableRequest { +public class DescribeTableRequest implements Request { /** * 表的名称。 */ private String tableName; public DescribeTableRequest() { - } /** @@ -33,7 +32,14 @@ public String getTableName() { * @param tableName 表的名称。 */ public void setTableName(String tableName) { - assertParameterNotNull(tableName, "tableName"); + Preconditions.checkArgument( + tableName != null && !tableName.isEmpty(), + "The name of table should not be null or empty."); this.tableName = tableName; } + + @Override + public String getOperationName() { + return OperationNames.OP_DESCRIBE_TABLE; + } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/DescribeTableResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeTableResponse.java new file mode 100755 index 0000000..ec34939 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/DescribeTableResponse.java @@ -0,0 +1,166 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class DescribeTableResponse extends Response implements Jsonizable { + /** + * 表的Meta定义。 + */ + private TableMeta tableMeta; + + /** + * 表的预留吞吐量的信息。 + */ + private ReservedThroughputDetails reservedThroughputDetails; + + /** + * 表的配置参数。 + */ + private TableOptions tableOptions; + + /** + * 表的分区信息。 + */ + private List shardSplits; + + /** + * 表的Stream信息。 + */ + private StreamDetails streamDetails; + + /** + * 索引表信息 + */ + private List indexMeta = new ArrayList(); + + /* + * 内部接口。请勿使用。 + */ + public DescribeTableResponse(Response meta) { + super(meta); + } + + /** + * 返回表的Meta定义。 + * + * @return 表的Meta。 + */ + public TableMeta getTableMeta() { + return tableMeta; + } + + /* + * 内部接口。请勿使用。 + */ + public void setTableMeta(TableMeta tableMeta) { + this.tableMeta = tableMeta; + } + + /** + * 返回表的预留吞吐量的更改信息。 + * + * @return 表的预留吞吐量的更改信息。 + */ + public ReservedThroughputDetails getReservedThroughputDetails() { + return reservedThroughputDetails; + } + + /** + * 所有shard之间的分裂点。 + * 假设某表有两列pk,三个shard。则返回两个一列的分裂点,分别为A和B。 + * 三个shard的range分别为(-inf,-inf) to (A,-inf), (A,-inf) to (B,-inf), (B,-inf) to (+inf,+inf) + */ + public List getShardSplits() { + return shardSplits; + } + + public void setShardSplits(List splits) { + shardSplits = splits; + } + + /* + * 内部接口。请勿使用。 + */ + public void setReservedThroughputDetails(ReservedThroughputDetails reservedThroughputDetails) { + this.reservedThroughputDetails = reservedThroughputDetails; + } + + /** + * 获取表的配置参数。 + * + * @return 表的配置参数。 + */ + public TableOptions getTableOptions() { + return tableOptions; + } + + /** + * 获取表的Stream信息。 + * + * @return 表的Stream信息。 + */ + public StreamDetails getStreamDetails() { + return streamDetails; + } + + public void setStreamDetails(StreamDetails streamDetails) { + this.streamDetails = streamDetails; + } + + /** + * 获取索引表的信息 + * + * @return 索引表的信息 + */ + public List getIndexMeta() { + return Collections.unmodifiableList(indexMeta); + } + + public void addIndexMeta(IndexMeta indexMeta) { + this.indexMeta.add(indexMeta); + } + + public void setTableOptions(TableOptions tableOptions) { + this.tableOptions = tableOptions; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"TableMeta\": "); + tableMeta.jsonize(sb, newline + " "); + sb.append(","); + sb.append(newline); + sb.append("\"ReservedThroughputDetails\": "); + reservedThroughputDetails.jsonize(sb, newline + " "); + sb.append(","); + sb.append(newline); + sb.append("\"TableOptionsEx\": "); + tableOptions.jsonize(sb, newline + " "); + sb.append(","); + sb.append(newline); + sb.append("\"IndexMeta\": ["); + boolean first = true; + for (IndexMeta index : indexMeta) { + if (first) { + first = false; + } else { + sb.append(","); + sb.append(newline + " "); + } + index.jsonize(sb, newline + " "); + } + sb.append("]}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Direction.java b/src/main/java/com/alicloud/openservices/tablestore/model/Direction.java new file mode 100755 index 0000000..68f553a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Direction.java @@ -0,0 +1,13 @@ +package com.alicloud.openservices.tablestore.model; + +public enum Direction { + /** + * 正序读. + */ + FORWARD, + /** + * 反序读. + * 反序读时需要注意{@link RangeRowQueryCriteria#inclusiveStartPrimaryKey}要大于{@link RangeRowQueryCriteria#exclusiveEndPrimaryKey}. + */ + BACKWARD +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/Error.java b/src/main/java/com/alicloud/openservices/tablestore/model/Error.java similarity index 74% rename from src/main/java/com/aliyun/openservices/ots/model/Error.java rename to src/main/java/com/alicloud/openservices/tablestore/model/Error.java index abb4316..a7672ca 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/Error.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Error.java @@ -1,4 +1,4 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; public class Error { private String code; @@ -25,4 +25,9 @@ public String getMessage() { public void setMessage(String message) { this.message = message; } + + @Override + public String toString() { + return "Code: " + code + ", Message: " + message; + } } diff --git a/src/main/java/com/aliyun/openservices/ots/model/GetRangeRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetRangeRequest.java similarity index 67% rename from src/main/java/com/aliyun/openservices/ots/model/GetRangeRequest.java rename to src/main/java/com/alicloud/openservices/tablestore/model/GetRangeRequest.java index 05ec1e2..f2713a0 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/GetRangeRequest.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetRangeRequest.java @@ -1,8 +1,8 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; -public class GetRangeRequest { +public class GetRangeRequest extends TxnRequest { /** * 范围查询的条件。 @@ -15,6 +15,10 @@ public GetRangeRequest() { public GetRangeRequest(RangeRowQueryCriteria rangeRowQueryCriteria) { setRangeRowQueryCriteria(rangeRowQueryCriteria); } + + public String getOperationName() { + return OperationNames.OP_GET_RANGE; + } /** * 获取范围查询的条件。 @@ -29,7 +33,7 @@ public RangeRowQueryCriteria getRangeRowQueryCriteria() { * @param rangeRowQueryCriteria 范围查询的条件。 */ public void setRangeRowQueryCriteria(RangeRowQueryCriteria rangeRowQueryCriteria) { - assertParameterNotNull(rangeRowQueryCriteria, "rangeRowQueryCriteria"); + Preconditions.checkNotNull(rangeRowQueryCriteria, "The rangeRowQueryCriteria should not be null."); this.rangeRowQueryCriteria = rangeRowQueryCriteria; } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/GetRangeResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetRangeResponse.java new file mode 100755 index 0000000..bb949bc --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetRangeResponse.java @@ -0,0 +1,87 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.List; + +public class GetRangeResponse extends Response { + /** + * 此次操作消耗的能力单元。 + */ + private ConsumedCapacity consumedCapacity; + + /** + * 范围查询返回的所有行。 + */ + private List rows; + + /** + * 下一次查询的范围的起始边界。 + */ + private PrimaryKey nextStartPrimaryKey; + + private byte[] nextToken; + + /** + * internal use + */ + public GetRangeResponse(Response meta, ConsumedCapacity consumedCapacity) { + super(meta); + Preconditions.checkNotNull(consumedCapacity); + this.consumedCapacity = consumedCapacity; + } + + /** + * internal use + */ + public void setRows(List rows) { + this.rows = rows; + } + + /** + * internal use + */ + public void setNextStartPrimaryKey(PrimaryKey nextStartPrimaryKey) { + this.nextStartPrimaryKey = nextStartPrimaryKey; + } + + /** + * 获取此次操作消耗的CapacityUnit。 + * + * @return 此次操作消耗的CapacityUnit。 + */ + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + /** + * 获取本次查询返回的所有行。 + * + * @return 所有行 + */ + public List getRows() { + return rows; + } + + /** + * 获取下一次查询的范围的起始边界。 + * 若为null,则代表本次查询已经返回所有数据,无需再次查询。 + * + * @return 若该范围内的数据还未读取完毕,则返回下一行的主键,否则返回null + */ + public PrimaryKey getNextStartPrimaryKey() { + return nextStartPrimaryKey; + } + + public byte[] getNextToken() { + return nextToken; + } + + public void setNextToken(byte[] nextToken) { + this.nextToken = nextToken; + } + + public boolean hasNextToken() { + return (nextToken != null) && (nextToken.length > 0); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/GetRowColumnIteratorImpl.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetRowColumnIteratorImpl.java new file mode 100644 index 0000000..404a117 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetRowColumnIteratorImpl.java @@ -0,0 +1,84 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.InternalClient; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.NoSuchElementException; + +public class GetRowColumnIteratorImpl extends AbstractColumnIteratorImpl { + + private InternalClient internalClient; + private GetRowRequest getRowRequest; + private PrimaryKey primaryKey; + private Iterator columnIterator; + private byte[] token; + private boolean complete = false; + private CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + public GetRowColumnIteratorImpl(InternalClient client, GetRowRequest getRowRequest) { + this.internalClient = client; + this.getRowRequest = getRowRequest; + } + + public boolean isRowExistent() { + while (!complete && (primaryKey == null)) { + fetchData(); + } + if (primaryKey != null) { + return true; + } else { + return false; + } + } + + public void fetchData() { + getRowRequest.getRowQueryCriteria().setToken(token); + GetRowResponse getRowResponse = null; + try { + getRowResponse = internalClient.getRowInternal(getRowRequest, null).get(); + } catch (Exception ex) { + throw new ClientException(ex); + } + capacityUnit.setReadCapacityUnit(capacityUnit.getReadCapacityUnit() + getRowResponse.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); + capacityUnit.setWriteCapacityUnit(capacityUnit.getWriteCapacityUnit() + getRowResponse.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit()); + Row row = getRowResponse.getRow(); + if (row != null) { + if (primaryKey == null) { + primaryKey = row.getPrimaryKey(); + } + columnIterator = Arrays.asList(row.getColumns()).iterator(); + } + if (getRowResponse.hasNextToken()) { + token = getRowResponse.getNextToken(); + } else { + complete = true; + } + } + + @Override + public boolean hasNext() { + while (!complete && ((columnIterator == null) || (!columnIterator.hasNext()))) { + fetchData(); + } + if (columnIterator != null && columnIterator.hasNext()) { + return true; + } + return false; + } + + @Override + public Column next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return columnIterator.next(); + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/GetRowRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetRowRequest.java similarity index 65% rename from src/main/java/com/aliyun/openservices/ots/model/GetRowRequest.java rename to src/main/java/com/alicloud/openservices/tablestore/model/GetRowRequest.java index fbde661..b3e997f 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/GetRowRequest.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetRowRequest.java @@ -1,9 +1,12 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +/** + * GetRow的查询参数。 + */ +public class GetRowRequest extends TxnRequest { -public class GetRowRequest { - /** * 单行查询条件。 */ @@ -12,17 +15,24 @@ public class GetRowRequest { public GetRowRequest() { } - + /** * 通过单行查询条件构造GetRowRequest对象。 + * * @param rowQueryCriteria 单行查询条件。 */ public GetRowRequest(SingleRowQueryCriteria rowQueryCriteria) { setRowQueryCriteria(rowQueryCriteria); } + @Override + public String getOperationName() { + return OperationNames.OP_GET_ROW; + } + /** * 获取单行查询条件。 + * * @return 单行查询条件。 */ public SingleRowQueryCriteria getRowQueryCriteria() { @@ -31,11 +41,11 @@ public SingleRowQueryCriteria getRowQueryCriteria() { /** * 设置单行查询条件。 + * * @param rowQueryCriteria 单行查询条件。 */ public void setRowQueryCriteria(SingleRowQueryCriteria rowQueryCriteria) { - assertParameterNotNull(rowQueryCriteria, "rowQueryCriteria"); + Preconditions.checkNotNull(rowQueryCriteria, "The row query criteria should not be null."); this.rowQueryCriteria = rowQueryCriteria; } - } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/GetRowResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetRowResponse.java new file mode 100755 index 0000000..5104911 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetRowResponse.java @@ -0,0 +1,67 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class GetRowResponse extends Response implements Jsonizable { + /** + * 单行查询返回的数据。 + */ + private Row row; + + /** + * 此次操作消耗的能力单元。 + */ + private ConsumedCapacity consumedCapacity; + + private byte[] nextToken; + + public GetRowResponse(Response meta, Row row, ConsumedCapacity consumedCapacity) { + super(meta); + this.row = row; + this.consumedCapacity = consumedCapacity; + } + + /** + * 获取单行查询返回的数据。 + * + * @return 若查询的该行存在,则返回该行,否则返回null + */ + public Row getRow() { + return row; + } + + /** + * 获取此次操作消耗的能力单元。 + * + * @return 此次操作消耗的能力单元。 + */ + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + public byte[] getNextToken() { + return nextToken; + } + + public void setNextToken(byte[] nextToken) { + this.nextToken = nextToken; + } + + public boolean hasNextToken() { + return (nextToken != null) && (nextToken.length > 0); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"ConsumedCapacity\": "); + consumedCapacity.jsonize(sb, newline + " "); + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorRequest.java new file mode 100644 index 0000000..32f9699 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorRequest.java @@ -0,0 +1,61 @@ +package com.alicloud.openservices.tablestore.model; + + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class GetShardIteratorRequest implements Request { + + /** + * Stream的Id + */ + private String streamId; + + /** + * Shard的Id + */ + private String shardId; + + public GetShardIteratorRequest(String streamId, String shardId) { + setStreamId(streamId); + setShardId(shardId); + } + + /** + * 获取StreamId参数 + * @return StreamId + */ + public String getStreamId() { + return streamId; + } + + /** + * 设置StreamId参数 + * @param streamId + */ + public void setStreamId(String streamId) { + Preconditions.checkArgument(streamId != null && !streamId.isEmpty(), "The streamId should not be null or empty."); + this.streamId = streamId; + } + + /** + * 获取ShardId参数 + * @return ShardId + */ + public String getShardId() { + return shardId; + } + + /** + * 设置ShardId参数 + * @param shardId + */ + public void setShardId(String shardId) { + Preconditions.checkArgument(shardId != null && !shardId.isEmpty(), "The shardId should not be null or empty."); + this.shardId = shardId; + } + + @Override + public String getOperationName() { + return OperationNames.OP_GET_SHARD_ITERATOR; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorResponse.java new file mode 100644 index 0000000..ee30b52 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetShardIteratorResponse.java @@ -0,0 +1,30 @@ +package com.alicloud.openservices.tablestore.model; + + +public class GetShardIteratorResponse extends Response { + + /** + * ShardIterator,用于获取该Shard下的记录 + */ + private String shardIterator; + + public GetShardIteratorResponse() { + + } + + public GetShardIteratorResponse(Response meta) { + super(meta); + } + + /** + * 获取ShardIterator + * @return ShardIterator + */ + public String getShardIterator() { + return shardIterator; + } + + public void setShardIterator(String shardIterator) { + this.shardIterator = shardIterator; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordRequest.java new file mode 100644 index 0000000..b0ab58a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordRequest.java @@ -0,0 +1,66 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class GetStreamRecordRequest implements Request { + + /** + * 通过ShardIterator获取该Shard下的记录 + */ + private String shardIterator; + + /** + * limit限制返回的记录的最大条数,可选参数 + * 默认值-1,代表该参数未设置。 + */ + private OptionalValue limit = new OptionalValue("Limit"); + + public GetStreamRecordRequest(String shardIterator) { + setShardIterator(shardIterator); + } + + /** + * 设置ShardIterator + * @param shardIterator + */ + public void setShardIterator(String shardIterator) { + Preconditions.checkArgument(shardIterator != null && !shardIterator.isEmpty(), + "The shard iterator is null or empty."); + this.shardIterator = shardIterator; + } + + /** + * 获取ShardIterator + * @return shardIterator + */ + public String getShardIterator() { + return shardIterator; + } + + /** + * 获取Limit参数 + * @return limit + */ + public int getLimit() { + if (limit.isValueSet()) { + return limit.getValue(); + } else { + return -1; + } + } + + /** + * 设置Limit参数 + * @param limit + */ + public void setLimit(int limit) { + Preconditions.checkArgument(limit > 0, "The limit must be greater than 0."); + this.limit.setValue(limit); + } + + @Override + public String getOperationName() { + return OperationNames.OP_GET_STREAM_RECORD; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordResponse.java new file mode 100644 index 0000000..0784fa8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/GetStreamRecordResponse.java @@ -0,0 +1,49 @@ +package com.alicloud.openservices.tablestore.model; + + +import java.util.List; + +public class GetStreamRecordResponse extends Response { + + /** + * 请求返回的记录列表 + */ + private List records; + + /** + * 用于发起下一次请求的ShardIterator + */ + private String nextShardIterator; + + public GetStreamRecordResponse() { + + } + + public GetStreamRecordResponse(Response meta) { + super(meta); + } + + /** + * 获取记录列表 + * @return 记录列表 + */ + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + /** + * 获取NextShardIterator,用于发起下一次请求 + * @return nextShardIterator + */ + public String getNextShardIterator() { + return nextShardIterator; + } + + public void setNextShardIterator(String nextShardIterator) { + this.nextShardIterator = nextShardIterator; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/IRow.java b/src/main/java/com/alicloud/openservices/tablestore/model/IRow.java new file mode 100755 index 0000000..b578e90 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/IRow.java @@ -0,0 +1,5 @@ +package com.alicloud.openservices.tablestore.model; + +public interface IRow extends Comparable { + public PrimaryKey getPrimaryKey(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/IndexMeta.java b/src/main/java/com/alicloud/openservices/tablestore/model/IndexMeta.java new file mode 100644 index 0000000..da10c98 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/IndexMeta.java @@ -0,0 +1,215 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +import java.util.*; + +/** + * 索引表的结构信息,包含索引表的名称以及索引表的主键及预定义列定义。 + */ +public class IndexMeta implements Jsonizable { + /** + * 索引表的名称。 + */ + private String indexName; + + /** + * 索引表的主键定义。 + * 主键是有顺序的,顺序与用户添加索引表主键的顺序相同。 + */ + private List primaryKey = new ArrayList(); + + /** + * 索引表的预定义列定义。 + */ + private List definedColumns = new ArrayList(); + + private IndexType indexType = IndexType.IT_GLOBAL_INDEX; + + private IndexUpdateMode indexUpdateMode = IndexUpdateMode.IUM_ASYNC_INDEX; + + + /** + * 创建一个新的给定表名的IndexMeta实例。 + * + * @param indexName 索引表名。 + */ + public IndexMeta(String indexName) { + Preconditions.checkArgument(indexName != null && !indexName.isEmpty(), "The name of table should not be null or empty."); + this.indexName = indexName; + } + + /** + * 返回索引表的名称。 + * + * @return 索引表的名称。 + */ + public String getIndexName() { + return indexName; + } + + /** + * 设置索引表的名称。 + * + * @param indexName 索引表的名称。 + */ + public void setIndexName(String indexName) { + Preconditions.checkArgument(indexName != null && !indexName.isEmpty(), "The name of index should not be null or empty."); + + this.indexName = indexName; + } + + /** + * 返回包含所有主键列名字的只读列表。 + * + * @return 包含所有主键列名字的只读列表。 + */ + public List getPrimaryKeyList() { + return Collections.unmodifiableList(primaryKey); + } + + /** + * 添加一个主键列。 + *

最终创建的索引表中主键的顺序与用户添加主键的顺序相同。

+ * + * @param name 主键列的名称。 + */ + public void addPrimaryKeyColumn(String name) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of primary key should not be null or empty."); + + this.primaryKey.add(name); + } + + /** + * 返回包含所有预定义列名字的只读列表。 + * + * @return 包含所有主键列名字的只读列表。 + */ + public List getDefinedColumnsList() { + return Collections.unmodifiableList(definedColumns); + } + + /** + * 添加一个预定义列。 + * + * @param name 预定义列的名称。 + */ + public void addDefinedColumn(String name) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of defined column should not be null or empty."); + + this.definedColumns.add(name); + } + + /** + * 得到索引表类型 + * @return 索引表类型(当前只支持GLOBAL_INDEX) + */ + public IndexType getIndexType() { + return indexType; + } + + + /** + * 设置索引表类型 + * + * @param type 索引表类型(当前只支持GLOBAL_INDEX) + */ + public void setIndexType(IndexType type) { + indexType = type; + } + + /** + * 得到索引表更新模式 + * @return 索引表更新模式(当前只支持ASYNC_INDEX) + */ + public IndexUpdateMode getIndexUpdateMode() { + return indexUpdateMode; + } + + /** + * 设置索引表更新模式 + * + * @param indexUpdateMode (当前只支持ASYNC_INDEX) + */ + public void setIndexUpdateMode(IndexUpdateMode indexUpdateMode) { + this.indexUpdateMode = indexUpdateMode; + } + + @Override + public String toString() { + String s = "IndexName: " + indexName + ", PrimaryKeyList "; + boolean first = true; + ListIterator pkIter = primaryKey.listIterator(); + for (; pkIter.hasNext(); ) { + if (first) { + first = false; + } else { + s += ","; + } + s += pkIter.next(); + } + String defColsStr = new String(); + first = true; + ListIterator defColIter = definedColumns.listIterator(); + for (; defColIter.hasNext(); ) { + if (first) { + first = false; + } else { + defColsStr += ","; + } + defColsStr += defColIter.next(); + } + s += defColsStr; + return s; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"IndexName\": \""); + sb.append(indexName); + sb.append('\"'); + sb.append(","); + sb.append(newline); + sb.append("\"PrimaryKey\": ["); + newline += " "; + sb.append(newline); + ListIterator pkIter = primaryKey.listIterator(); + boolean first = true; + for (; pkIter.hasNext(); ) { + if (first) { + first = false; + } else { + sb.append(","); + } + sb.append("\""); + sb.append(pkIter.next()); + sb.append("\""); + } + sb.append("],"); + sb.append(newline); + sb.append("\"DefinedColumns\": ["); + ListIterator defColIter = definedColumns.listIterator(); + first = true; + for (; defColIter.hasNext(); ) { + if (first) { + first = false; + } else { + sb.append(","); + } + sb.append("\""); + sb.append(defColIter.next()); + sb.append("\""); + } + sb.append("]}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/IndexType.java b/src/main/java/com/alicloud/openservices/tablestore/model/IndexType.java new file mode 100644 index 0000000..5e46bf0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/IndexType.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * 表示索引表类型。 + */ +public enum IndexType { + /** + * 全局索引。 + */ + IT_GLOBAL_INDEX; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/IndexUpdateMode.java b/src/main/java/com/alicloud/openservices/tablestore/model/IndexUpdateMode.java new file mode 100644 index 0000000..f971750 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/IndexUpdateMode.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * 表示索引更新模式。 + */ +public enum IndexUpdateMode { + /** + * 异步更新索引。 + */ + IUM_ASYNC_INDEX; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ListStreamRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/ListStreamRequest.java new file mode 100644 index 0000000..8956b79 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ListStreamRequest.java @@ -0,0 +1,48 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class ListStreamRequest implements Request { + + /** + * 表的名称,可选参数 + * 若设置了表的名称,则只获取该表下的Stream + */ + private String tableName; + + /** + * 获取所有的Stream,不限定表 + */ + public ListStreamRequest() { + } + + /** + * 获取特定表的Stream + * @param tableName + */ + public ListStreamRequest(String tableName) { + setTableName(tableName); + } + + /** + * 获取表的名称。 + * @return 表的名称。 + */ + public String getTableName() { + return tableName; + } + + /** + * 设置表的名称。设置表的名称后,将只获取该表下的Stream。 + * @param tableName 表的名称。 + */ + public void setTableName(String tableName) { + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), "The name of table should not be null or empty."); + this.tableName = tableName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_LIST_STREAM; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ListStreamResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/ListStreamResponse.java new file mode 100644 index 0000000..d5b49b7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ListStreamResponse.java @@ -0,0 +1,30 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.List; + +public class ListStreamResponse extends Response { + + /** + * 请求返回的Stream列表 + */ + private List streams; + + public ListStreamResponse() { + } + + public ListStreamResponse(Response meta) { + super(meta); + } + + /** + * 获取Stream列表 + * @return Stream列表 + */ + public List getStreams() { + return streams; + } + + public void setStreams(List streams) { + this.streams = streams; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ListTableRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/ListTableRequest.java new file mode 100644 index 0000000..add3d07 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ListTableRequest.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.model; + +public class ListTableRequest implements Request { + public ListTableRequest() { + } + + public String getOperationName() { + return OperationNames.OP_LIST_TABLE; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ListTableResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/ListTableResponse.java new file mode 100755 index 0000000..e0811fd --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ListTableResponse.java @@ -0,0 +1,57 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.List; +import java.util.Iterator; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class ListTableResponse extends Response implements Jsonizable { + /** + * 表的名称列表。 + */ + private List tableNames; + + public ListTableResponse(Response meta) { + super(meta); + } + + /** + * 获取表的名称列表。 + * @return 表的名称列表。 + */ + public List getTableNames() { + return tableNames; + } + + /* + * 内部接口。请勿使用。 + */ + public void setTableNames(List tableNames) { + this.tableNames = tableNames; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + if (tableNames == null) { + sb.append("null"); + } else { + sb.append("["); + Iterator iter = tableNames.listIterator(); + if (iter.hasNext()) { + sb.append(iter.next()); + for(; iter.hasNext();) { + sb.append(", \""); + sb.append(iter.next()); + sb.append("\""); + } + } + sb.append("]"); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Measurable.java b/src/main/java/com/alicloud/openservices/tablestore/model/Measurable.java new file mode 100644 index 0000000..0981885 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Measurable.java @@ -0,0 +1,10 @@ +package com.alicloud.openservices.tablestore.model; + +public interface Measurable { + /** + * 获取序列化后的数据大小 + * + * @return 序列化后的数据大小 + */ + int getDataSize(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/MultiRowQueryCriteria.java b/src/main/java/com/alicloud/openservices/tablestore/model/MultiRowQueryCriteria.java new file mode 100755 index 0000000..2aade38 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/MultiRowQueryCriteria.java @@ -0,0 +1,126 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.ArrayList; +import java.util.List; + +/** + * 从TableStore表中查询多行数据所需的参数,可以支持以下几种读取行为: + *
    + *
  • 读取某些列或所有列的某个特定版本
  • + *
  • 读取某些列或所有列的某个版本范围内的所有版本或最大的N个版本
  • + *
  • 读取某些列或所有列的最大的N个版本(N最小为 1,最大为MaxVersions)
  • + *
+ *

注意:读取参数不能为每行单独设置,多行必须使用相同的查询参数。

+ */ +public class MultiRowQueryCriteria extends RowQueryCriteria { + + private List rowKeys; + private List tokens; + + public MultiRowQueryCriteria(String tableName) { + super(tableName); + rowKeys = new ArrayList(); + tokens = new ArrayList(); + } + + /** + * 向多行查询条件中插入要查询的行的主键。 + * + * @param primaryKey 要查询的行的主键。 + * @return this (for invocation chain) + */ + public MultiRowQueryCriteria addRow(PrimaryKey primaryKey) { + Preconditions.checkArgument(primaryKey != null && !primaryKey.isEmpty(), "The primary key added should not be null."); + this.rowKeys.add(primaryKey); + this.tokens.add(new byte[0]); + return this; + } + + /** + * 向多行查询条件中插入要查询的行的主键。 + * + * @param primaryKey 要查询的行的主键。 + * @return this (for invocation chain) + */ + public MultiRowQueryCriteria addRow(PrimaryKey primaryKey, byte[] token) { + Preconditions.checkArgument(primaryKey != null && !primaryKey.isEmpty(), "The primary key added should not be null."); + this.rowKeys.add(primaryKey); + this.tokens.add(token); + return this; + } + + /** + * 获取该表中所要要查询的行的主键。 + * + * @return 所有行的主键。 + */ + public List getRowKeys() { + return rowKeys; + } + + /** + * 设置该表中所有要查询的行的主键。 + * + * @param primaryKeys 所有行的主键。 + */ + public void setRowKeys(List primaryKeys) { + Preconditions.checkArgument(primaryKeys != null && !primaryKeys.isEmpty(), "The rows to get should not be null or empty."); + clear(); + rowKeys.addAll(primaryKeys); + for (int i = 0; i < primaryKeys.size(); i++) { + tokens.add(new byte[0]); + } + } + + public List getTokens() { + return tokens; + } + + /** + * 获取某行的主键。 + *

若该行index不存在,则返回null。

+ * + * @param index 该行的索引 + * @return 若该行存在,则返回该行主键,否则返回null + */ + public PrimaryKey get(int index) { + Preconditions.checkArgument(index >= 0, "The index should not be negative."); + + if (rowKeys == null || rowKeys.isEmpty()) { + return null; + } + + if (index >= rowKeys.size()) { + return null; + } + return rowKeys.get(index); + } + + /** + * 清空要查询的所有行。 + */ + public void clear() { + this.rowKeys.clear(); + } + + /** + * 获取要查询的行的个数。 + * + * @return 行数。 + */ + public int size() { + return rowKeys.size(); + } + + public boolean isEmpty() { + return rowKeys.isEmpty(); + } + + public MultiRowQueryCriteria cloneWithoutRowKeys() { + MultiRowQueryCriteria newCriteria = new MultiRowQueryCriteria(this.getTableName()); + this.copyTo(newCriteria); + return newCriteria; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/NameTimestampComparator.java b/src/main/java/com/alicloud/openservices/tablestore/model/NameTimestampComparator.java new file mode 100644 index 0000000..9f06e94 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/NameTimestampComparator.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.Comparator; + +public class NameTimestampComparator implements Comparator { + /** + * 比较两个属性列的名称和时间戳。 + *

拿此比较器排序后的结果为先按名称升序,后按时间戳降序。

+ *

若比较的两个Column没有设置过时间戳,则无法进行比较。

+ * + * @param c1 + * @param c2 + * @return Result + */ + @Override + public int compare(Column c1, Column c2) { + int ret = c1.getName().compareTo(c2.getName()); + if (ret != 0) { + return ret; + } + long t1 = Long.MAX_VALUE; + if (c1.hasSetTimestamp()) { + t1 = c1.getTimestamp(); + } + long t2 = Long.MAX_VALUE; + if (c2.hasSetTimestamp()) { + t2 = c2.getTimestamp(); + } + return t1 == t2 ? 0 : (t1 < t2 ? 1 : -1); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/OperationNames.java b/src/main/java/com/alicloud/openservices/tablestore/model/OperationNames.java new file mode 100644 index 0000000..b79ae19 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/OperationNames.java @@ -0,0 +1,77 @@ +package com.alicloud.openservices.tablestore.model; + +public class OperationNames { + public static final String OP_CREATE_TABLE = "CreateTable"; + + public static final String OP_LIST_TABLE = "ListTable"; + + public static final String OP_DELETE_TABLE = "DeleteTable"; + + public static final String OP_DESCRIBE_TABLE = "DescribeTable"; + + public static final String OP_UPDATE_TABLE = "UpdateTable"; + + public static final String OP_GET_ROW = "GetRow"; + + public static final String OP_PUT_ROW = "PutRow"; + + public static final String OP_UPDATE_ROW = "UpdateRow"; + + public static final String OP_DELETE_ROW = "DeleteRow"; + + public static final String OP_BATCH_GET_ROW = "BatchGetRow"; + + public static final String OP_BATCH_WRITE_ROW = "BatchWriteRow"; + + public static final String OP_GET_RANGE = "GetRange"; + + public static final String OP_LIST_STREAM = "ListStream"; + + public static final String OP_DESCRIBE_STREAM = "DescribeStream"; + + public static final String OP_GET_SHARD_ITERATOR = "GetShardIterator"; + + public static final String OP_GET_STREAM_RECORD = "GetStreamRecord"; + + public static final String OP_COMPUTE_SPLITS_BY_SIZE = "ComputeSplitPointsBySize"; + + public static final String OP_START_LOCAL_TRANSACTION = "StartLocalTransaction"; + + public static final String OP_COMMIT_TRANSACTION = "CommitTransaction"; + + public static final String OP_ABORT_TRANSACTION = "AbortTransaction"; + + public static final String OP_CREATE_INDEX = "CreateIndex"; + + public static final String OP_DELETE_INDEX = "DropIndex"; + + public static final String OP_CREATE_SEARCH_INDEX = "CreateSearchIndex"; + + public static final String OP_DELETE_SEARCH_INDEX = "DeleteSearchIndex"; + + public static final String OP_LIST_SEARCH_INDEX = "ListSearchIndex"; + + public static final String OP_DESCRIBE_SEARCH_INDEX = "DescribeSearchIndex"; + + public static final String OP_SEARCH = "Search"; + + public static final String OP_CREATE_TUNNEL = "tunnel/create"; + + public static final String OP_DELETE_TUNNEL = "tunnel/delete"; + + public static final String OP_LIST_TUNNEL = "tunnel/list"; + + public static final String OP_DESCRIBE_TUNNEL = "tunnel/describe"; + + public static final String OP_CONNECT_TUNNEL = "tunnel/connect"; + + public static final String OP_HEARTBEAT = "tunnel/heartbeat"; + + public static final String OP_SHUTDOWN_TUNNEL = "tunnel/shutdown"; + + public static final String OP_GETCHECKPOINT = "tunnel/getcheckpoint"; + + public static final String OP_READRECORDS = "tunnel/readrecords"; + + public static final String OP_CHECKPOINT = "tunnel/checkpoint"; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PartitionRange.java b/src/main/java/com/alicloud/openservices/tablestore/model/PartitionRange.java new file mode 100644 index 0000000..3275ea3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PartitionRange.java @@ -0,0 +1,57 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class PartitionRange { + + private PrimaryKeyValue begin; // 范围的起始值 + + private PrimaryKeyValue end; // 范围的结束值。 + + /** + *

+ * 构造一个新的实例。 + * 表示左闭右开的范围。 + *

+ *

+ * begin必须小于或等于end。整型按数字大小比较;字符型按字典顺序比较; + *

+ * + * @param begin 范围的起始值。 + * @param end 范围的结束值。 + */ + public PartitionRange(PrimaryKeyValue begin, PrimaryKeyValue end) { + Preconditions.checkNotNull(begin, "The begin key of partition range should not be null."); + Preconditions.checkNotNull(end, "The end key of partition range should not be null."); + Preconditions.checkArgument(!begin.isInfMax() && !begin.isInfMin(), + "The value of begin can't be INF_MIN or INF_MAX."); + Preconditions.checkArgument(!end.isInfMax() && !end.isInfMin(), + "The value of end can't be INF_MIN or INF_MAX."); + + if (!begin.getType().equals(end.getType())) { + throw new IllegalArgumentException("The value type of begin and end must be the same."); + } + + this.begin = begin; + this.end = end; + } + + + /** + * 返回范围的起始值。 + * + * @return 范围的起始值。 + */ + public PrimaryKeyValue getBegin() { + return begin; + } + + /** + * 返回范围的终止值。 + * + * @return 范围的终止值。 + */ + public PrimaryKeyValue getEnd() { + return end; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKey.java b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKey.java new file mode 100644 index 0000000..24cedbd --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKey.java @@ -0,0 +1,265 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.CalculateHelper; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +import java.util.*; + +/** + * TableStore中每行数据都包含主键({@link PrimaryKey}), + * 主键由多列主键列构成({@link PrimaryKeyColumn}), + * 每一个主键列包含主键列名称和主键列的值{@link PrimaryKeyValue}。 + *

主键中包含的主键列的个数以及主键列的顺序与创建表时TableMeta中定义的一致。

+ */ +public class PrimaryKey implements Comparable, Jsonizable, Measurable { + private PrimaryKeyColumn[] primaryKey; + private Map nameMap; + + private int dataSize = -1; + + /** + * 构造函数。 + *

传入的主键列数组不能为null pointer,主键列的个数以及主键列在数组中的顺序必须与创建表时TableMeta中定义的一致。

+ * + * @param primaryKey 该主键包含的所有主键列 + */ + public PrimaryKey(PrimaryKeyColumn[] primaryKey) { + Preconditions.checkArgument(primaryKey != null && primaryKey.length != 0, "The primary key should not be null or empty."); + this.primaryKey = primaryKey; + } + + /** + * 构造函数。 + *

传入的主键列列表不能为null pointer,主键列的个数以及主键列在列表中的顺序必须与创建表时TableMeta中定义的一致。

+ * + * @param primaryKey + */ + public PrimaryKey(List primaryKey) { + Preconditions.checkArgument(primaryKey != null, "The primary key should not be null or empty."); + this.primaryKey = primaryKey.toArray(new PrimaryKeyColumn[primaryKey.size()]); + } + + /** + * internal use + */ + public PrimaryKey() { + } + + /** + * 获取某个指定名称的主键列。 + *

若找不到该名称的主键列,则返回null。

+ *

若初始化时传入的主键列列表包含相同名称的主键列,则不保证返回具体哪个对应名称的主键列的值。

+ * + * @param name 主键列的名称 + * @return 若存在则返回对应的主键列的值,否则返回null + */ + public PrimaryKeyColumn getPrimaryKeyColumn(String name) { + Preconditions.checkArgument(primaryKey != null && primaryKey.length != 0, "The primary key should not be set before getPrimaryKeyColumn."); + if (nameMap == null) { + makeMap(); + } + + return nameMap.get(name); + } + + /** + * 按位置获取对应的主键列。 + *

主键中包含的主键列的个数以及主键列的顺序与创建表时TableMeta中定义的一致。

+ *

若对应的位置不存在,会抛出IllegalArgumentException异常。

+ * + * @param index 主键列的位置 + * @return 具体位置对应的主键列 + */ + public PrimaryKeyColumn getPrimaryKeyColumn(int index) { + Preconditions.checkArgument(primaryKey != null && primaryKey.length != 0, "The primary key should not be set before getPrimaryKeyColumn."); + if (index < 0 || index >= primaryKey.length) { + throw new IllegalArgumentException("The index is out of bounds."); + } + + return primaryKey[index]; + } + + /** + * 获取所有的主键列。 + *

主键中包含的主键列的个数以及主键列的顺序与创建表时TableMeta中定义的一致。

+ * + * @return 所有的主键列 + */ + public PrimaryKeyColumn[] getPrimaryKeyColumns() { + if (this.primaryKey == null) { + return null; + } + return Arrays.copyOf(primaryKey, primaryKey.length); + } + + /** + * 获取主键列名称与主键列映射的Map。 + *

若初始化时传入的主键列列表包含相同名称的主键列,则返回的Map中只会返回其中的一列。

+ * + * @return 主键列名称与主键列映射的Map + */ + public Map getPrimaryKeyColumnsMap() { + Preconditions.checkArgument(primaryKey != null && primaryKey.length != 0, "The primary key should not be set before getPrimaryKeyColumnsMap."); + if (nameMap == null) { + makeMap(); + } + + return Collections.unmodifiableMap(nameMap); + } + + /** + * 检查主键中是否有该名称的主键列。 + * + * @param name 主键列的名称 + * @return 若包含则返回true,否则返回false + */ + public boolean contains(String name) { + Preconditions.checkArgument(primaryKey != null && primaryKey.length != 0, "The primary key should not be set."); + if (nameMap == null) { + makeMap(); + } + + return nameMap.containsKey(name); + } + + /** + * 返回主键列的个数。 + * + * @return 主键列的个数 + */ + public int size() { + if (primaryKey == null) { + return 0; + } else { + return primaryKey.length; + } + } + + /** + * 该主键是否为空,若主键未包含任何主键列则代表该主键为空。 + * + * @return 若主键为空则返回true,否则返回false + */ + public boolean isEmpty() { + return size() == 0; + } + + private void makeMap() { + HashMap temp = new HashMap(primaryKey.length); + for (PrimaryKeyColumn column : primaryKey) { + temp.put(column.getName(), column); + } + nameMap = temp; + } + + @Deprecated + public int getSize() { + return getDataSize(); + } + + /** + * 获取行主键的数据大小总和,大小总和包括所有主键列的名称和值。 + * + * @return 行主键的数据大小总和 + */ + @Override + public int getDataSize() { + if (primaryKey == null) { + return 0; + } + if (dataSize == -1) { + int size = 0; + for (PrimaryKeyColumn key : primaryKey) { + size += CalculateHelper.calcStringSizeInBytes(key.getName()); + size += key.getValue().getDataSize(); + } + dataSize = size; + } + return dataSize; + } + + /** + * 比较两个主键。 + *

对比的两个主键必须为相同的schema,即列数、主键名称和顺序都完全一致。

+ * + * @param target + * @return 比较结果 + */ + @Override + public int compareTo(PrimaryKey target) { + if (this.primaryKey.length != target.primaryKey.length) { + throw new IllegalArgumentException("The schema of the two primary key compared is not the same."); + } + + for (int i = 0; i < this.primaryKey.length; i++) { + int ret = this.primaryKey[i].compareTo(target.primaryKey[i]); + if (ret != 0) { + return ret; + } + } + return 0; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + boolean first = true; + for (PrimaryKeyColumn pk : this.primaryKey) { + if (first) { + first = false; + } else { + sb.append(", "); + } + sb.append(pk.getName()); + sb.append(":"); + sb.append(pk.getValue()); + } + return sb.toString(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof PrimaryKey)) { + return false; + } + + PrimaryKey pk = (PrimaryKey) o; + if (this.primaryKey.length != pk.primaryKey.length) { + return false; + } + + for (int i = 0; i < this.primaryKey.length; i++) { + if (!this.primaryKey[i].equals(pk.primaryKey[i])) { + return false; + } + } + return true; + } + + @Override + public int hashCode() { + return Arrays.hashCode(primaryKey); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("["); + Iterator iter = Arrays.asList(primaryKey).iterator(); + if (iter.hasNext()) { + iter.next().jsonize(sb, newline); + while(iter.hasNext()) { + sb.append(", "); + iter.next().jsonize(sb, newline); + } + } + sb.append("]"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyBuilder.java b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyBuilder.java new file mode 100644 index 0000000..1703b2e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyBuilder.java @@ -0,0 +1,44 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.ArrayList; +import java.util.List; + +public class PrimaryKeyBuilder { + List primaryKeyColumns; + + private PrimaryKeyBuilder() { + primaryKeyColumns = new ArrayList(); + } + + private PrimaryKeyBuilder(int capacity) { + primaryKeyColumns = new ArrayList(capacity); + } + + public static PrimaryKeyBuilder createPrimaryKeyBuilder() { + return new PrimaryKeyBuilder(); + } + + public static PrimaryKeyBuilder createPrimaryKeyBuilder(int capacity) { + return new PrimaryKeyBuilder(); + } + + public PrimaryKeyBuilder addPrimaryKeyColumn(PrimaryKeyColumn column) { + Preconditions.checkNotNull(column, "The primary key column should not be null."); + this.primaryKeyColumns.add(column); + return this; + } + + public PrimaryKeyBuilder addPrimaryKeyColumn(String name, PrimaryKeyValue value) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of primary key should not be null or empty."); + Preconditions.checkNotNull(value, "The value of primary key should not be null."); + + this.primaryKeyColumns.add(new PrimaryKeyColumn(name, value)); + return this; + } + + public PrimaryKey build() { + return new PrimaryKey(primaryKeyColumns); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyColumn.java b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyColumn.java new file mode 100644 index 0000000..0d40dad --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyColumn.java @@ -0,0 +1,169 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.*; + +import java.io.IOException; + +/** + * TableStore中每行数据都包含主键({@link PrimaryKey}), + * 主键由多列主键列构成({@link PrimaryKeyColumn}), + * 每一个主键列包含主键列名称和主键列的值{@link PrimaryKeyValue}。 + */ +public class PrimaryKeyColumn implements Comparable, Jsonizable, Measurable { + /** + * 主键列的名称。 + */ + private String name; + + /** + * 主键列的值。 + */ + private PrimaryKeyValue value; + + /** + * 序列化后占用的数据大小 + */ + private int dataSize = -1; + + /** + * 根据指定的主键列的名称和主键列的值构造主键列。 + *

主键列的名称不能为null pointer及空字符串。

+ *

主键列的值不能为null pointer。

+ * + * @param name 主键列的名称 + * @param value 主键列的值 + */ + public PrimaryKeyColumn(String name, PrimaryKeyValue value) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of primary key should not be null or empty."); + Preconditions.checkNotNull(value, "The value of primary key should not be null."); + + this.name = name; + this.value = value; + } + + /** + * 获取主键列的名称。 + * + * @return 主键列的名称 + */ + public String getName() { + return name; + } + + public byte[] getNameRawData() { + return Bytes.toBytes(name); + } + + /** + * 获取主键列的值。 + * + * @return 主键列的值 + */ + public PrimaryKeyValue getValue() { + return value; + } + + /** + * 将主键列类型转化为属性列类型。 + * @return + */ + public Column toColumn() throws IOException { + return new Column(getName(), getValue().toColumnValue()); + } + + @Override + public String toString() { + return "'" + name + "':" + value; + } + + @Override + public int hashCode() { + return name.hashCode() ^ value.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof PrimaryKeyColumn)) { + return false; + } + + PrimaryKeyColumn col = (PrimaryKeyColumn) o; + return this.name.equals(col.name) && this.value.equals(col.value); + } + + /** + * 比较两个主键列的大小。 + *

对比的两个主键列必须含有相同的名称和类型。

+ * + * @param target + * @return 若相等返回0,若大于返回1,若小于返回-1 + */ + @Override + public int compareTo(PrimaryKeyColumn target) { + if (!this.name.equals(target.name)) { + throw new IllegalArgumentException("The name of primary key to be compared must be the same."); + } + + return this.value.compareTo(target.value); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"Name\": \""); + sb.append(name); + sb.append("\", \"Type\": \""); + if ( value.getType() != null ) { + sb.append(value.getType().toString()); + sb.append("\", \"Value\": "); + switch(value.getType()) { + case INTEGER: + sb.append(value.asLong()); + break; + case STRING: + sb.append("\""); + sb.append(value.asString()); + sb.append("\""); + break; + case BINARY: + sb.append("\""); + sb.append(Base64.toBase64String(value.asBinary())); + sb.append("\""); + break; + default: + throw new IllegalArgumentException("Unknown type: " + value.getType()); + } + } else { + sb.append("null"); + sb.append("\", \"Value\": "); + if ( value.isInfMin() ) { + sb.append("\""); + sb.append("INF_MIN"); + sb.append("\""); + } else if ( value.isInfMax() ) { + sb.append("\""); + sb.append("INF_MAX"); + sb.append("\""); + } else { + throw new IllegalArgumentException("Unknown value: " + value.asString()); + } + } + sb.append("}"); + } + + @Override + public int getDataSize() { + if (dataSize == -1) { + dataSize = CalculateHelper.calcStringSizeInBytes(name) + value.getDataSize(); + } + + return dataSize; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyOption.java b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyOption.java new file mode 100644 index 0000000..b9fdd10 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyOption.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * 表示主键列的属性 + */ +public enum PrimaryKeyOption { + /** + * PK列递增 + */ + AUTO_INCREMENT, +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeySchema.java b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeySchema.java new file mode 100644 index 0000000..1e26bc4 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeySchema.java @@ -0,0 +1,114 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class PrimaryKeySchema implements Jsonizable { + private String name; + private PrimaryKeyType type; + private PrimaryKeyOption option; + + public PrimaryKeySchema(String name, PrimaryKeyType type) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "Primary key's name should not be null or empty."); + Preconditions.checkNotNull(type, "The type should not be null"); + this.setName(name); + this.setType(type); + this.setOption(null); + } + + public PrimaryKeySchema(String name, PrimaryKeyType type, PrimaryKeyOption option) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "Primary key's name should not be null or empty."); + Preconditions.checkNotNull(type, "The type should not be null."); + Preconditions.checkNotNull(option, "The option should not be null."); + Preconditions.checkArgument((option != PrimaryKeyOption.AUTO_INCREMENT) || type == PrimaryKeyType.INTEGER, + "Auto_Increment PK must be Integer type."); + + this.setName(name); + this.setType(type); + this.setOption(option); + } + + /** + * 获取主键的名称。 + * @return 主键的名称。 + */ + public String getName() { + return name; + } + + /** + * 设置主键的名称。 + * @param name 主键的名称。 + */ + public void setName(String name) { + this.name = name; + } + + /** + * 获取主键的类型。 + * @return 主键的类型。 + */ + public PrimaryKeyType getType() { + return type; + } + + /** + * 设置主键的类型。 + * @param type 主键的类型。 + */ + public void setType(PrimaryKeyType type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof PrimaryKeySchema)) { + return false; + } + + PrimaryKeySchema target = (PrimaryKeySchema) o; + return this.name.equals(target.name) && this.type == target.type && this.option == target.option; + } + + @Override + public int hashCode() { + return this.name.hashCode() ^ this.type.hashCode() ^ (hasOption() ? this.option.hashCode() : 0); + } + + @Override + public String toString() { + return name + ":" + type + (hasOption() ? (":" + option) : ""); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + if (hasOption()) { + sb.append(String.format( + "{\"Name\": \"%s\", \"Type\": \"%s\", \"Option\":\"%s\"}", + name, type.toString(), option.toString())); + } else { + sb.append(String.format( + "{\"Name\": \"%s\", \"Type\": \"%s\"}", + name, type.toString())); + } + } + + public boolean hasOption() { + return option != null; + } + + public PrimaryKeyOption getOption() { + return option; + } + + public void setOption(PrimaryKeyOption option) { + this.option = option; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyType.java b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyType.java new file mode 100755 index 0000000..57b5f50 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyType.java @@ -0,0 +1,21 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * 表示主键列的数据类型,目前只支持{@link #STRING}、{@link #INTEGER}和{@link #BINARY}这三种数据类型。 + */ +public enum PrimaryKeyType { + /** + * 字符串。 + */ + STRING, + + /** + * 64位整数。 + */ + INTEGER, + + /** + * 二进制数据。 + */ + BINARY; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyValue.java b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyValue.java new file mode 100755 index 0000000..f018261 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PrimaryKeyValue.java @@ -0,0 +1,402 @@ +package com.alicloud.openservices.tablestore.model; + +import java.io.IOException; +import java.util.Arrays; + +import com.alicloud.openservices.tablestore.core.protocol.PlainBufferCrc8; +import com.alicloud.openservices.tablestore.core.utils.Bytes; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.CalculateHelper; + +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.VT_BLOB; +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.VT_INF_MIN; +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.VT_INF_MAX; +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.VT_STRING; +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.VT_INTEGER; +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferConsts.VT_AUTO_INCREMENT; + +/** + * 表示主键列的值。 + *

若要构造{@link PrimaryKeyType#INTEGER}类型的主键列,请使用{@link #fromLong(long)}来初始化。

+ *

若要构造{@link PrimaryKeyType#STRING}类型的主键列,请使用{@link #fromString(String)}来初始化。

+ *

若要构造{@link PrimaryKeyType#BINARY}类型的主键列,请使用{@link #fromBinary(byte[])}来初始化。

+ *

注意:{@link #INF_MIN}和{@link #INF_MAX}是特殊的主键列,其唯一的用途是用于{@link com.alicloud.openservices.tablestore.SyncClientInterface#getRange(GetRangeRequest)} + * 操作中表示主键列的范围,不能作为实际的数据写入TableStore,也不能作为除GetRange操作之外的读操作的参数。

+ */ +public class PrimaryKeyValue implements Comparable, Measurable { + + /** + * 表示主键值范围的最大值,其唯一的用途是用于{@link com.alicloud.openservices.tablestore.SyncClientInterface#getRange(GetRangeRequest)} + * 操作中表示主键列的范围,不能作为实际的数据写入TableStore,也不能作为除GetRange操作之外的读操作的参数。 + */ + public static final PrimaryKeyValue INF_MAX = new PrimaryKeyValue("INF_MAX", null); + /** + * 表示主键值范围的最小值,其唯一的用途是用于{@link com.alicloud.openservices.tablestore.SyncClientInterface#getRange(GetRangeRequest)} + * 操作中表示主键列的范围,不能作为实际的数据写入TableStore,也不能作为除GetRange操作之外的读操作的参数。 + */ + public static final PrimaryKeyValue INF_MIN = new PrimaryKeyValue("INF_MIN", null); + + /** + * 表示主键值保留,其唯一的用途是用于PK递增列的填充。 + * 当某一PK列被设置为递增列,则在PutRow或UpdateRow时,用户指定这列的值为AUTO_INCREMENT,则OTS会在这行写入成功后自动赋予一个更大值,保证此列的值是永久递增的。 + */ + @Deprecated + public static final PrimaryKeyValue AUTO_INCRMENT = new PrimaryKeyValue("AUTO_INCREMENT", null); + + public static final PrimaryKeyValue AUTO_INCREMENT = new PrimaryKeyValue("AUTO_INCREMENT", null); + + private Object value; + private byte[] rawData; // raw bytes for utf-8 string + private PrimaryKeyType type; + private int dataSize = 0; + + private PrimaryKeyValue(Object value, PrimaryKeyType type) { + this.value = value; + this.type = type; + + if (this.type != null) { + switch (this.type) { + case INTEGER: + this.dataSize = 8; + break; + case STRING: + this.dataSize = CalculateHelper.calcStringSizeInBytes(this.asString()); + break; + case BINARY: + this.dataSize = this.asBinary().length; + break; + default: + throw new IllegalStateException("Bug: not support the type : " + type); + } + } + } + + /** + * 获取主键列的类型。 + * + * @return 主键列的类型。 + */ + public PrimaryKeyType getType() { + return type; + } + + @Deprecated + public int getSize() { + return getDataSize(); + } + + /** + * 获取主键列值的大小,各类型大小计算公式为: + * - {@link PrimaryKeyType#INTEGER}: 恒定大小为8个字节 + * - {@link PrimaryKeyType#STRING}: 大小为按UTF-8编码后的字节数 + * + * @return 值的大小 + */ + @Override + public int getDataSize() { + return this.dataSize; + } + + /** + * 构造一个类型为{@link PrimaryKeyType#STRING}的主键列。 + *

注意:值不能为null pointer。

+ * + * @param value 字符串类型的值。 + * @return 生成的对象 + */ + public static PrimaryKeyValue fromString(String value) { + Preconditions.checkNotNull(value, "The value of primary key should not be null."); + return new PrimaryKeyValue(value, PrimaryKeyType.STRING); + } + + /** + * 构造一个类型为{@link PrimaryKeyType#INTEGER}的主键列。 + * + * @param value 长整型的值。 + * @return 生成的对象 + */ + public static PrimaryKeyValue fromLong(long value) { + return new PrimaryKeyValue(value, PrimaryKeyType.INTEGER); + } + + /** + * 构造一个类型为{@link PrimaryKeyType#BINARY}的主键列。 + *

注意:值不能为null pointer。

+ * + * @param value 二进制字符串类型的值。 + * @return 生成的对象 + */ + public static PrimaryKeyValue fromBinary(byte[] value) { + Preconditions.checkNotNull(value, "The value of primary key should not be null."); + return new PrimaryKeyValue(value, PrimaryKeyType.BINARY); + } + + public static PrimaryKeyValue fromColumn(ColumnValue value) { + switch (value.getType()) { + case STRING: + return fromString(value.asString()); + case INTEGER: + return fromLong(value.asLong()); + case BINARY: + return fromBinary(value.asBinary()); + default: + throw new IllegalArgumentException("Can not convert from column with not compatible type: " + value.getType()); + } + } + + /** + * 采用crc8算法得到一个checksum,主要用于计算cell的checksum + * @param crc + * @return checksum + */ + public byte getChecksum(byte crc) throws IOException { + if (isInfMin()) { + crc = PlainBufferCrc8.crc8(crc, VT_INF_MIN); + return crc; + } + if (isInfMax()) { + crc = PlainBufferCrc8.crc8(crc, VT_INF_MAX); + return crc; + } + if (isPlaceHolderForAutoIncr()) { + crc = PlainBufferCrc8.crc8(crc, VT_AUTO_INCREMENT); + return crc; + } + + switch (getType()) { + case STRING: { + byte[] rawData = asStringInBytes(); + crc = PlainBufferCrc8.crc8(crc, VT_STRING); + crc = PlainBufferCrc8.crc8(crc, rawData.length); + crc = PlainBufferCrc8.crc8(crc, rawData); + break; + } + case INTEGER: { + crc = PlainBufferCrc8.crc8(crc, VT_INTEGER); + crc = PlainBufferCrc8.crc8(crc, asLong()); + break; + } + case BINARY: { + byte[] rawData = asBinary(); + crc = PlainBufferCrc8.crc8(crc, VT_BLOB); + crc = PlainBufferCrc8.crc8(crc, rawData.length); + crc = PlainBufferCrc8.crc8(crc, rawData); + break; + } + default: + throw new IOException("Bug: unsupported column type: " + getType()); + } + return crc; + } + + public ColumnValue toColumnValue() throws IOException { + ColumnValue value = null; + if (isInfMin() || isInfMax() || isPlaceHolderForAutoIncr()) { + throw new IOException("Can not convert INF_MIN or INF_MAX or AUTO_INCREMENT into column value."); + } + switch (getType()) { + case INTEGER: { + value = ColumnValue.fromLong(asLong()); + break; + } + case STRING: { + value = ColumnValue.fromString(asString()); + break; + } + case BINARY: { + value = ColumnValue.fromBinary(asBinary()); + break; + } + default: + throw new IOException("Unsupported primary key type: " + getType()); + } + return value; + } + + /** + * 获取主键列的字符串类型的值。 + *

当前仅当数据类型为{@link PrimaryKeyType#STRING}才能获取到值。

+ * + * @return 字符串类型的值 + */ + public String asString() { + if (this.type != PrimaryKeyType.STRING) { + throw new IllegalStateException("The type of primary key is not STRING."); + } + + return (String) value; + } + + public byte[] asStringInBytes() { + if (rawData == null) { + rawData = Bytes.toBytes(asString()); + } + return rawData; + } + + /** + * 获取主键列的长整型类型的值。 + *

当前仅当数据类型为{@link PrimaryKeyType#INTEGER}才能获取到值。

+ * + * @return 长整型值 + */ + public long asLong() { + if (this.type != PrimaryKeyType.INTEGER) { + throw new IllegalStateException("The type of primary key is not INTEGER."); + } + + return (Long) value; + } + + /** + * 获取主键列的二进制字符串类型的值。 + *

当前仅当数据类型为{@link PrimaryKeyType#BINARY}才能获取到值。

+ * + * @return 二进制字符串类型的值 + */ + public byte[] asBinary() { + if (this.type != PrimaryKeyType.BINARY) { + throw new IllegalStateException("The type of primary key is not BINARY"); + } + return (byte[]) value; + } + + /** + * For internal use. DO NOT USE. + * @return true if it is INF_MIN + */ + public boolean isInfMin() { + return type == null && value.equals("INF_MIN"); + } + + /** + * For internal use. DO NOT USE. + * @return true if it is INF_MAX + */ + public boolean isInfMax() { + return type == null && value.equals("INF_MAX"); + } + + /** + * For internal use. DO NOT USE. + * @return true if it is AUTO_INCREMENT + */ + public boolean isPlaceHolderForAutoIncr() { + return type == null && value.equals("AUTO_INCREMENT"); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof PrimaryKeyValue)) { + return false; + } + + PrimaryKeyValue val = (PrimaryKeyValue) o; + if (this.type == val.type) { + if (this.type == PrimaryKeyType.BINARY) { + return Bytes.equals((byte[]) value, (byte[]) val.value); + } else { + return this.value.equals(val.value); + } + } else { + return false; + } + } + + @Override + public int hashCode() { + if (this.type == PrimaryKeyType.BINARY) { + return Arrays.hashCode(asBinary()) * 31 + this.type.hashCode(); + } else { + return this.value.hashCode() * 31 + (this.type != null ? this.type.hashCode() : 0 ); + } + } + + @Override + public String toString() { + if (this.type == PrimaryKeyType.BINARY) { + return Arrays.toString(asBinary()); + } else { + return this.value.toString(); + } + } + + /** + * 比较两个主键列的值的大小。 + *

注意:不同类型的主键列无法比较。

+ *

{@link #INF_MIN}和{@link #INF_MAX}可以与其他类型的主键列进行比较, + * 并且{@link #INF_MIN}比任何类型的主键列值小,{@link #INF_MAX}比任何类型的主键列值大。

+ * + * @param target + * @return 如果大于返回值大于0,等于返回0,小于返回值小于0 + */ + @Override + public int compareTo(PrimaryKeyValue target) { + if (this.type == null) { // INF_MIN or INF_MAX or AUTO_INCR + if (target.type == null && target.value.equals(this.value)) { + return 0; + } + + if (this.value.equals("INF_MIN")) { + return -1; + } else if (this.value.equals("INF_MAX")){ + return 1; + } else { + throw new IllegalArgumentException(this.value + " can't compare."); + } + } else { + if (target.type == null) { + if (target.value.equals("INF_MIN")) { + return 1; + } else { + return -1; + } + } + + if (this.type != target.type) { + throw new IllegalArgumentException("The type of primary key to compare must be the same."); + } + + switch (this.type) { + case STRING: + return ((String) value).compareTo(target.asString()); + case INTEGER: + return ((Long) value).compareTo(target.asLong()); + case BINARY: + byte[] b1 = (byte[]) this.value; + byte[] b2 = (byte[]) target.value; + return Bytes.compareByteArrayInLexOrder(b1, 0, b1.length, b2, 0, b2.length); + default: + throw new IllegalArgumentException("Unknown type: " + this.type); + } + } + } + + public static PrimaryKeyValue addOne(PrimaryKeyValue target) { + if (target.getType() == null) { + throw new IllegalArgumentException("cannot addOne for null type"); + } + ColumnValue value = null; + switch (target.getType()) { + case INTEGER: + value = ColumnValue.fromLong(target.asLong()); + if (value.asLong() == Long.MAX_VALUE) { + return new PrimaryKeyValue("INF_MAX", null); + } + Long integerVal = value.asLong() + 1; + return new PrimaryKeyValue(integerVal, PrimaryKeyType.INTEGER); + case STRING: + value = ColumnValue.fromString(target.asString()); + String stringVal = value.asString() + "\0"; + return new PrimaryKeyValue(stringVal, PrimaryKeyType.STRING); + case BINARY: + value = ColumnValue.fromBinary(target.asBinary()); + byte[] binaryVal = new byte[value.getDataSize() + 1]; + System.arraycopy(value.asBinary(), 0, binaryVal, 0, value.getDataSize()); + binaryVal[value.getDataSize()] = 0; + return new PrimaryKeyValue(binaryVal, PrimaryKeyType.BINARY); + default: + throw new IllegalArgumentException("Unknown type: " + target.getType()); + } + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/PutRowRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/PutRowRequest.java similarity index 60% rename from src/main/java/com/aliyun/openservices/ots/model/PutRowRequest.java rename to src/main/java/com/alicloud/openservices/tablestore/model/PutRowRequest.java index 6decde8..7cb3b86 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/PutRowRequest.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PutRowRequest.java @@ -1,8 +1,8 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; -public class PutRowRequest { +public class PutRowRequest extends TxnRequest { /** * PutRow操作的请求参数。 @@ -17,6 +17,14 @@ public PutRowRequest(RowPutChange rowChange) { setRowChange(rowChange); } + /** + * @return "PutRow" + */ + @Override + public String getOperationName() { + return OperationNames.OP_PUT_ROW; + } + /** * 获取PutRow的请求参数。 * @return PutRow的请求参数。 @@ -30,7 +38,7 @@ public RowPutChange getRowChange() { * @param rowChange PutRow的请求参数。 */ public void setRowChange(RowPutChange rowChange) { - assertParameterNotNull(rowChange, "rowChange"); + Preconditions.checkNotNull(rowChange, "The row change for PutRow should not be null."); this.rowChange = rowChange; } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/PutRowResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/PutRowResponse.java new file mode 100755 index 0000000..ad7a63e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/PutRowResponse.java @@ -0,0 +1,51 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + + +public class PutRowResponse extends Response implements Jsonizable { + /** + * 此次操作消耗的能力单元。 + */ + private ConsumedCapacity consumedCapacity; + + /** + * ReturnType指定返回的值。 + */ + private Row row; + + public PutRowResponse(Response meta, Row row, ConsumedCapacity consumedCapacity) { + super(meta); + Preconditions.checkNotNull(consumedCapacity); + this.consumedCapacity = consumedCapacity; + this.row = row; + } + + /** + * 获取此次操作消耗的能力单元。 + * + * @return 此次操作消耗的能力单元。 + */ + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"ConsumedCapacity\": "); + consumedCapacity.jsonize(sb, newline + " "); + sb.append("}"); + } + + public Row getRow() { + return row; + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RangeIteratorParameter.java b/src/main/java/com/alicloud/openservices/tablestore/model/RangeIteratorParameter.java similarity index 54% rename from src/main/java/com/aliyun/openservices/ots/model/RangeIteratorParameter.java rename to src/main/java/com/alicloud/openservices/tablestore/model/RangeIteratorParameter.java index 153ef9c..3b67956 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/RangeIteratorParameter.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RangeIteratorParameter.java @@ -1,63 +1,70 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; -/** - * 表示获取表(Table)中主键(Primary Key)的特定范围内多行数据的查询条件。 - * - */ public class RangeIteratorParameter extends RowQueryCriteria { - + private Direction direction = Direction.FORWARD; - + /** * 此次Iterator查询返回的最大行数,若count未设置,则返回查询范围下的所有行。 * 默认-1代表不对行数做限制,读取该范围下所有行。 */ - private int count = -1; - + private int maxCount = -1; + /** * Iterator分批查询时用到的buffer的大小,该大小决定了Iterator调用GetRange查询时每次请求返回的最大行数。 - * 默认-1代表不设置buffer的大小,每次按OTS一次请求最多返回行数来。 + * 默认-1代表不设置buffer的大小,每次按TableStore一次请求最多返回行数来。 */ private int bufferSize = -1; - - private RowPrimaryKey inclusiveStartPrimaryKey = new RowPrimaryKey(); - - private RowPrimaryKey exclusiveEndPrimaryKey = new RowPrimaryKey(); - + + private PrimaryKey inclusiveStartPrimaryKey; + + private PrimaryKey exclusiveEndPrimaryKey; + /** * 构造一个在给定名称的表中查询的条件。 - * @param tableName - * 查询的表名。 + * + * @param tableName 查询的表名。 */ - public RangeIteratorParameter(String tableName){ + public RangeIteratorParameter(String tableName) { super(tableName); } + public RangeIteratorParameter(RangeRowQueryCriteria criteria) { + super(criteria.getTableName()); + + criteria.copyTo(this); + this.direction = criteria.getDirection(); + this.bufferSize = criteria.getLimit(); + this.inclusiveStartPrimaryKey = criteria.getInclusiveStartPrimaryKey(); + this.exclusiveEndPrimaryKey = criteria.getExclusiveEndPrimaryKey(); + } + /** - * 获取操作时返回的最大行数。 + * Iterator最多返回的行数。 * -1 表示返回该范围内的所有行(默认值)。 + * * @return 本次操作返回的最大行数。 */ - public int getCount() { - return count; + public int getMaxCount() { + return maxCount; } /** - * 设置查询时单次请求返回的行数。 - * -1 表示全部符合条件的数据行(默认值)。 - * @param count 单次请求返回的行数。 + * 设置该Iterator最多返回的行数。 + * -1 表示返回该范围内的所有行(默认值) + * + * @param maxCount 单次请求返回的行数。 */ - public void setCount(int count) { - if (count <= 0) { - throw new IllegalArgumentException("Count must be greater than 0."); - } - this.count = count; + public void setMaxCount(int maxCount) { + Preconditions.checkArgument(maxCount > 0, "The max count must be greater than 0."); + this.maxCount = maxCount; } /** * 获取内部Buffer的大小。 + * * @return Buffer的大小。 */ public int getBufferSize() { @@ -66,17 +73,17 @@ public int getBufferSize() { /** * 设置Buffer的大小。 + * * @param bufferSize Buffer的大小。 */ public void setBufferSize(int bufferSize) { - if (bufferSize <= 0) { - throw new IllegalArgumentException("Buffer size must be greater than 0."); - } + Preconditions.checkArgument(bufferSize > 0, "The buffer size must be greater than 0."); this.bufferSize = bufferSize; } /** * 获取范围查询的读取顺序(正序(FORWARD)或反序(BACKWARD))。 + * * @return 读取顺序 */ public Direction getDirection() { @@ -85,18 +92,20 @@ public Direction getDirection() { /** * 设置范围查询的读取顺序(正序(FORWARD)或反序(BACKWARD))。 + * * @param direction 读取顺序 */ public void setDirection(Direction direction) { - assertParameterNotNull(direction, "direction"); + Preconditions.checkNotNull(direction, "The direction should not be null."); this.direction = direction; } - + /** * 获取范围查询的左边界的主键值。 + * * @return 范围查询的左边界的主键值。 */ - public RowPrimaryKey getInclusiveStartPrimaryKey() { + public PrimaryKey getInclusiveStartPrimaryKey() { return inclusiveStartPrimaryKey; } @@ -104,19 +113,21 @@ public RowPrimaryKey getInclusiveStartPrimaryKey() { * 范围查询需要用户指定一个主键的范围,该范围是一个左闭右开的区间,inclusiveStartPrimaryKey为该区间的左边界。 * 若direction为FORWARD,则inclusiveStartPrimaryKey必须小于exclusiveEndPrimaryKey。 * 若direction为BACKWARD,则inclusiveStartPrimaryKey必须大于exclusiveEndPrimaryKey。 - * inclusiveStartPrimaryKey必须包含表中定义的所有主键列,列的值可以定义PrimaryKeyRange.INF_MIN或者PrimaryKeyRange.INF_MAX用于表示该列的所有取值范围。 + * inclusiveStartPrimaryKey必须包含表中定义的所有主键列,列的值可以定义{@link PrimaryKeyValue#INF_MIN}或者{@link PrimaryKeyValue#INF_MAX}用于表示该列的所有取值范围。 + * * @param inclusiveStartPrimaryKey 范围查询的左边界的主键值。 */ - public void setInclusiveStartPrimaryKey(RowPrimaryKey inclusiveStartPrimaryKey) { - assertParameterNotNull(inclusiveStartPrimaryKey, "inclusiveStartPrimaryKey"); + public void setInclusiveStartPrimaryKey(PrimaryKey inclusiveStartPrimaryKey) { + Preconditions.checkArgument(inclusiveStartPrimaryKey != null && !inclusiveStartPrimaryKey.isEmpty(), "The start primary key should not be null or empty."); this.inclusiveStartPrimaryKey = inclusiveStartPrimaryKey; } /** * 获取范围查询的右边界的主键值。 + * * @return 范围查询的右边界的主键值。 */ - public RowPrimaryKey getExclusiveEndPrimaryKey() { + public PrimaryKey getExclusiveEndPrimaryKey() { return exclusiveEndPrimaryKey; } @@ -124,11 +135,12 @@ public RowPrimaryKey getExclusiveEndPrimaryKey() { * 范围查询需要用户指定一个主键的范围,该范围是一个左闭右开的区间,exclusiveEndPrimaryKey为该区间的右边界。 * 若direction为FORWARD,则exclusiveEndPrimaryKey必须大于inclusiveStartPrimaryKey。 * 若direction为BACKWARD,则exclusiveEndPrimaryKey必须小于inclusiveStartPrimaryKey。 - * exclusiveEndPrimaryKey必须包含表中定义的所有主键列,列的值可以定义PrimaryKeyRange.INF_MIN或者PrimaryKeyRange.INF_MAX用于表示该列的所有取值范围。 + * exclusiveEndPrimaryKey必须包含表中定义的所有主键列,列的值可以定义{@link PrimaryKeyValue#INF_MIN}或者{@link PrimaryKeyValue#INF_MAX}用于表示该列的所有取值范围。 + * * @param exclusiveEndPrimaryKey 范围查询的右边界的主键值。 */ - public void setExclusiveEndPrimaryKey(RowPrimaryKey exclusiveEndPrimaryKey) { - assertParameterNotNull(exclusiveEndPrimaryKey, "exclusiveEndPrimaryKey"); + public void setExclusiveEndPrimaryKey(PrimaryKey exclusiveEndPrimaryKey) { + Preconditions.checkArgument(exclusiveEndPrimaryKey != null && !exclusiveEndPrimaryKey.isEmpty(), "The end primary key should not be null or empty."); this.exclusiveEndPrimaryKey = exclusiveEndPrimaryKey; } } diff --git a/src/main/java/com/aliyun/openservices/ots/model/RangeRowQueryCriteria.java b/src/main/java/com/alicloud/openservices/tablestore/model/RangeRowQueryCriteria.java similarity index 57% rename from src/main/java/com/aliyun/openservices/ots/model/RangeRowQueryCriteria.java rename to src/main/java/com/alicloud/openservices/tablestore/model/RangeRowQueryCriteria.java index 42c8a4a..e175859 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/RangeRowQueryCriteria.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RangeRowQueryCriteria.java @@ -1,24 +1,27 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; -/** - * 表示获取表(Table)中主键(Primary Key)的特定范围内多行数据的查询条件。 - * - */ public class RangeRowQueryCriteria extends RowQueryCriteria { private Direction direction = Direction.FORWARD; /** - * 此次Iterator查询返回的最大行数,若count未设置,则返回查询范围下的所有行。 + * 返回的最大行数。 */ private int limit = -1; - private RowPrimaryKey inclusiveStartPrimaryKey = new RowPrimaryKey(); + private PrimaryKey inclusiveStartPrimaryKey; - private RowPrimaryKey exclusiveEndPrimaryKey = new RowPrimaryKey(); - + private PrimaryKey exclusiveEndPrimaryKey; + + /** + * 用于行内流式读, 标记位置和状态信息. + */ + private OptionalValue token = new OptionalValue("Token"); + + /** * 构造一个在给定名称的表中查询的条件。 * @param tableName @@ -43,6 +46,7 @@ public int getLimit() { * @param limit 单次请求返回的行数。 */ public void setLimit(int limit) { + Preconditions.checkArgument(limit > 0, "The limit must be greater than 0."); this.limit = limit; } @@ -59,7 +63,7 @@ public Direction getDirection() { * @param direction 读取顺序 */ public void setDirection(Direction direction) { - assertParameterNotNull(direction, "direction"); + Preconditions.checkNotNull(direction, "The direction should not be null."); this.direction = direction; } @@ -67,7 +71,7 @@ public void setDirection(Direction direction) { * 获取范围查询的左边界的主键值。 * @return 范围查询的左边界的主键值。 */ - public RowPrimaryKey getInclusiveStartPrimaryKey() { + public PrimaryKey getInclusiveStartPrimaryKey() { return inclusiveStartPrimaryKey; } @@ -75,11 +79,11 @@ public RowPrimaryKey getInclusiveStartPrimaryKey() { * 范围查询需要用户指定一个主键的范围,该范围是一个左闭右开的区间,inclusiveStartPrimaryKey为该区间的左边界。 * 若direction为FORWARD,则inclusiveStartPrimaryKey必须小于exclusiveEndPrimaryKey。 * 若direction为BACKWARD,则inclusiveStartPrimaryKey必须大于exclusiveEndPrimaryKey。 - * inclusiveStartPrimaryKey必须包含表中定义的所有主键列,列的值可以定义PrimaryKeyRange.INF_MIN或者PrimaryKeyRange.INF_MAX用于表示该列的所有取值范围。 + * inclusiveStartPrimaryKey必须包含表中定义的所有主键列,列的值可以定义{@link PrimaryKeyValue#INF_MIN}或者{@link PrimaryKeyValue#INF_MAX}用于表示该列的所有取值范围。 * @param inclusiveStartPrimaryKey 范围查询的左边界的主键值。 */ - public void setInclusiveStartPrimaryKey(RowPrimaryKey inclusiveStartPrimaryKey) { - assertParameterNotNull(inclusiveStartPrimaryKey, "inclusiveStartPrimaryKey"); + public void setInclusiveStartPrimaryKey(PrimaryKey inclusiveStartPrimaryKey) { + Preconditions.checkArgument(inclusiveStartPrimaryKey != null && !inclusiveStartPrimaryKey.isEmpty(), "The inclusive start primary key should not be null."); this.inclusiveStartPrimaryKey = inclusiveStartPrimaryKey; } @@ -87,7 +91,7 @@ public void setInclusiveStartPrimaryKey(RowPrimaryKey inclusiveStartPrimaryKey) * 获取范围查询的右边界的主键值。 * @return 范围查询的右边界的主键值。 */ - public RowPrimaryKey getExclusiveEndPrimaryKey() { + public PrimaryKey getExclusiveEndPrimaryKey() { return exclusiveEndPrimaryKey; } @@ -95,11 +99,28 @@ public RowPrimaryKey getExclusiveEndPrimaryKey() { * 范围查询需要用户指定一个主键的范围,该范围是一个左闭右开的区间,exclusiveEndPrimaryKey为该区间的右边界。 * 若direction为FORWARD,则exclusiveEndPrimaryKey必须大于inclusiveStartPrimaryKey。 * 若direction为BACKWARD,则exclusiveEndPrimaryKey必须小于inclusiveStartPrimaryKey。 - * exclusiveEndPrimaryKey必须包含表中定义的所有主键列,列的值可以定义rimaryKeyRange.INF_MIN或者PrimaryKeyRange.INF_MAX用于表示该列的所有取值范围。 + * exclusiveEndPrimaryKey必须包含表中定义的所有主键列,列的值可以定义{@link PrimaryKeyValue#INF_MIN}或者{@link PrimaryKeyValue#INF_MAX}用于表示该列的所有取值范围。 * @param exclusiveEndPrimaryKey 范围查询的右边界的主键值。 */ - public void setExclusiveEndPrimaryKey(RowPrimaryKey exclusiveEndPrimaryKey) { - assertParameterNotNull(exclusiveEndPrimaryKey, "exclusiveEndPrimaryKey"); + public void setExclusiveEndPrimaryKey(PrimaryKey exclusiveEndPrimaryKey) { + Preconditions.checkArgument(exclusiveEndPrimaryKey != null && !exclusiveEndPrimaryKey.isEmpty(), "The exclusive end primary key should not be null."); this.exclusiveEndPrimaryKey = exclusiveEndPrimaryKey; } + + public byte[] getToken() { + if (!this.token.isValueSet()) { + throw new IllegalStateException("The value of token is not set."); + } + return token.getValue(); + } + + public void setToken(byte[] token) { + if (token != null) { + this.token.setValue(token); + } + } + + public boolean hasSetToken() { + return this.token.isValueSet(); + } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RecordColumn.java b/src/main/java/com/alicloud/openservices/tablestore/model/RecordColumn.java new file mode 100644 index 0000000..55b7fe3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RecordColumn.java @@ -0,0 +1,93 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class RecordColumn implements Jsonizable { + + public enum ColumnType { + /** + * PUT类型 + * 表示写入该列 + */ + PUT, + + /** + * DELETE_ONE_VERSION类型 + * 表示删除该列的某一版本 + */ + DELETE_ONE_VERSION, + + /** + * DELETE_ALL_VERSION类型 + * 表示删除该列的全部版本 + */ + DELETE_ALL_VERSION + } + + /** + * 列的相关数据,包含列名、列值和时间戳(版本号) + */ + private Column column; + + /** + * 列的类型 + */ + private ColumnType columnType; + + public RecordColumn(Column column, ColumnType columnType) { + this.column = column; + this.columnType = columnType; + } + + /** + * 获取列的相关数据 + * @return 列的相关数据 + */ + public Column getColumn() { + return this.column; + } + + /** + * 获取列的类型 + * @return 列的类型 + */ + public ColumnType getColumnType() { + return columnType; + } + + @Override + public String toString() { + return column.toString() + ",ColumnType:" + columnType; + } + + @Override + public int hashCode() { + return column.hashCode() ^ columnType.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof RecordColumn)) { + return false; + } + + RecordColumn col = (RecordColumn) o; + return this.column.equals(col.getColumn()) && this.columnType.equals(col.getColumnType()); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"ColumnType\": \""); + sb.append(columnType.toString()); + sb.append("\", \"Column\": "); + column.jsonize(sb, newline + " "); + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RecordSequenceInfo.java b/src/main/java/com/alicloud/openservices/tablestore/model/RecordSequenceInfo.java new file mode 100644 index 0000000..72108a3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RecordSequenceInfo.java @@ -0,0 +1,93 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class RecordSequenceInfo implements Jsonizable { + + /** + * 解决机器时差带来的时序问题的标识 + */ + private int epoch; + + /** + * Record写入系统的时间 + */ + private long timestamp; + + /** + * 行位置标识 + */ + private int rowIndex; + + public RecordSequenceInfo() { + + } + + public RecordSequenceInfo(int epoch, long timestamp, int rowIndex) { + this.epoch = epoch; + this.timestamp = timestamp; + this.rowIndex = rowIndex; + } + + /** + * 获取行时序信息的epoch + * @return 返回epoch + */ + public int getEpoch() { + return epoch; + } + + public void setEpoch(int epoch) { + this.epoch = epoch; + } + + /** + * 获取改行插入系统的时间 + * @return 返回行插入系统的时间 + */ + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + /** + * 获取改行的行位置标识 + * @return 返回行位置标识 + */ + public int getRowIndex() { + return rowIndex; + } + public void setRowIndex(int rowIndex) { + this.rowIndex = rowIndex; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("(" + "Epoch:" + epoch + ")"); + sb.append("(" + "Timestamp:" + timestamp + ")"); + sb.append("(" + "RowIndex:" + rowIndex + ")"); + return sb.toString(); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"Epoch\": "); + sb.append(epoch); + sb.append(", \"Timestamp\": "); + sb.append(timestamp); + sb.append(", \"RowIndex\": "); + sb.append(rowIndex); + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Request.java b/src/main/java/com/alicloud/openservices/tablestore/model/Request.java new file mode 100644 index 0000000..2a6a948 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Request.java @@ -0,0 +1,5 @@ +package com.alicloud.openservices.tablestore.model; + +public interface Request { + public String getOperationName(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ReservedThroughput.java b/src/main/java/com/alicloud/openservices/tablestore/model/ReservedThroughput.java new file mode 100755 index 0000000..43fcbdc --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ReservedThroughput.java @@ -0,0 +1,64 @@ +package com.alicloud.openservices.tablestore.model; + +public class ReservedThroughput { + + /** + * 表的预留吞吐量配置。 + */ + private CapacityUnit capacityUnit; + + /** + * 初始化{@link ReservedThroughput},使用默认的预留读写吞吐量配置(0单位的读能力单元和0单位的写能力单元)。 + */ + public ReservedThroughput() { + capacityUnit = new CapacityUnit(0, 0); + } + + /** + * 初始化{@link ReservedThroughput}. + * @param capacityUnit 表的预留读写吞吐量设置。 + */ + public ReservedThroughput(CapacityUnit capacityUnit) { + setCapacityUnit(capacityUnit); + } + + /** + * 初始化{@link ReservedThroughput}. + * @param read 表的预留读吞吐量的配置。 + * @param write 表的预留写吞吐量的配置。 + */ + public ReservedThroughput(int read, int write) { + setCapacityUnit(new CapacityUnit(read, write)); + } + + /** + * 获取表的预留吞吐量的值。 + * @return CapacityUnit。 + */ + public CapacityUnit getCapacityUnit() { + return capacityUnit; + } + + /** + * 设置表的预留吞吐量的值,必须同时设置读和写能力单元。 + * @param capacityUnit capacityUnit。 + */ + public void setCapacityUnit(CapacityUnit capacityUnit) { + this.capacityUnit = capacityUnit; + } + + @Override + public int hashCode() { + return this.capacityUnit.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof ReservedThroughput)){ + return false; + } + + ReservedThroughput r1 = (ReservedThroughput)o; + return this.capacityUnit.equals(r1.capacityUnit); + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughputDetails.java b/src/main/java/com/alicloud/openservices/tablestore/model/ReservedThroughputDetails.java similarity index 59% rename from src/main/java/com/aliyun/openservices/ots/model/ReservedThroughputDetails.java rename to src/main/java/com/alicloud/openservices/tablestore/model/ReservedThroughputDetails.java index f8f74aa..8a06c84 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughputDetails.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ReservedThroughputDetails.java @@ -1,52 +1,46 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class ReservedThroughputDetails implements Jsonizable { -public class ReservedThroughputDetails { - /** * 当前表的预留吞吐量。 */ private CapacityUnit capacityUnit; - + /** * 最近一次上调读或写CapacityUnit的时间。 */ private long lastIncreaseTime; - + /** * 最近一次下调读或写CapacityUnit的时间。 */ private long lastDecreaseTime; - - /** - * 当天总过下调读或写CapacityUnit的次数。 - */ - private int numberOfDecreasesToday; - - ReservedThroughputDetails() { - this(null, 0, 0, 0); - } - - ReservedThroughputDetails(CapacityUnit capacityUnit, long lastIncreaseTime, long lastDecreaseTime, int numberOfDecreasesToday) { + + public ReservedThroughputDetails(CapacityUnit capacityUnit, long lastIncreaseTime, long lastDecreaseTime) { this.capacityUnit = capacityUnit; this.lastIncreaseTime = lastIncreaseTime; this.lastDecreaseTime = lastDecreaseTime; - this.numberOfDecreasesToday = numberOfDecreasesToday; } - + /** * 获取当前表的CapacityUnit设置。 + * * @return 当前表的CapacityUnit设置。 */ public CapacityUnit getCapacityUnit() { return capacityUnit; } - + void setCapacityUnit(CapacityUnit capacityUnit) { this.capacityUnit = capacityUnit; } /** * 获取最近一次上调读或写CapacityUnit的时间。 + * * @return 最近一次上调读或写CapacityUnit的时间。 */ public long getLastIncreaseTime() { @@ -59,6 +53,7 @@ void setLastIncreaseTime(long lastIncreaseTime) { /** * 获取最近一次下调读或写CapacityUnit的时间。若用户未下调过CapacityUnit,则返回时间为0。 + * * @return 最近一次下调读或写CapacityUnit的时间。 */ public long getLastDecreaseTime() { @@ -69,15 +64,28 @@ void setLastDecreaseTime(long lastDecreaseTime) { this.lastDecreaseTime = lastDecreaseTime; } - /** - * 获取当天总过下调读或写CapacityUnit的次数。 - * @return 当天总过下调读或写CapacityUnit的次数。 - */ - public int getNumberOfDecreasesToday() { - return numberOfDecreasesToday; + @Override + public String toString() { + return "" + capacityUnit + ", LastIncreaseTime: " + lastIncreaseTime + + ", LastDecreaseTime: " + lastDecreaseTime; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); } - void setNumberOfDecreasesToday(int numberOfDecreasesToday) { - this.numberOfDecreasesToday = numberOfDecreasesToday; + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append("\"CapacityUnit\": "); + capacityUnit.jsonize(sb, newline + " "); + sb.append(", \"LastIncreaseTime\": "); + sb.append(lastIncreaseTime); + sb.append(", \"LastDecreaseTime\": "); + sb.append(lastDecreaseTime); + sb.append("}"); } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Response.java b/src/main/java/com/alicloud/openservices/tablestore/model/Response.java new file mode 100755 index 0000000..799c95e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Response.java @@ -0,0 +1,70 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +/** + * 所有TableStore返回结果的基类,包含返回结果的元属性信息,例如RequestId、TraceId等。 + *

RequestId: TableStore为每个请求分配的唯一ID,若需要TableStore开发协助调查慢请求或者失败请求等问题,请提供该ID。

+ *

TraceId: 在SDK内部提供的日志中会追踪某个请求的各个阶段的执行信息,可以通过这个ID来追踪日志排查问题。

+ */ +public class Response { + private String requestId; + private String traceId; + + /** + * 内部用构造器,请不要使用。 + */ + public Response() { + } + + /** + * 内部用构造器,请不要使用。 + */ + public Response(Response meta) { + Preconditions.checkNotNull(meta, "meta must not be null."); + this.requestId = meta.requestId; + this.traceId = meta.traceId; + } + + /** + * 内部用构造器,请不要使用。 + * @param requestId + */ + public Response(String requestId) { + Preconditions.checkNotNull(requestId, "requestId must not be null."); + this.requestId = requestId; + } + + /** + * 获取该请求的RequestId。 + * @return RequestId + */ + public String getRequestId() { + return requestId; + } + + /** + * 设置RequestId。 + * @param requestId + */ + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + /** + * 获取该请求的TraceId。 + * @return TraceId + */ + public String getTraceId() { + return traceId; + } + + /** + * 设置TraceId。 + * @param traceId TraceId。 + */ + public void setTraceId(String traceId) { + Preconditions.checkNotNull(traceId, "traceId must not be null."); + this.traceId = traceId; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RetryStrategy.java b/src/main/java/com/alicloud/openservices/tablestore/model/RetryStrategy.java new file mode 100644 index 0000000..6e69993 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RetryStrategy.java @@ -0,0 +1,28 @@ +package com.alicloud.openservices.tablestore.model; + +public interface RetryStrategy { + + /** + * 返回一个同类型且尚未重试的RetryStrategy对象。 + * + * @return 同类型且尚未重试的RetryStrategy对象。 + */ + public RetryStrategy clone(); + + /** + * 返回当前重试的次数 + * + * @return 当前重试的次数 + */ + public int getRetries(); + + /** + * 得到发起第retries次重试前延迟的时间。SDK会在这一段时间之后发起第retries次重试。 + * 若返回值小于等于0, 表示不重试. + * + * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 + * @param ex 上次访问失败的错误信息、为ClientException或TableStoreException + * @return 发起第retries次重试前延迟的时间(单位毫秒)。小于等于0表示不可重试。 + */ + public long nextPause(String action, Exception ex); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/ReturnType.java b/src/main/java/com/alicloud/openservices/tablestore/model/ReturnType.java new file mode 100644 index 0000000..564be16 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/ReturnType.java @@ -0,0 +1,21 @@ +package com.alicloud.openservices.tablestore.model; + +/** + * 表示操作(PUT,UPDATE,DELETE)的返回结果中是否附带PK值,对于PK递增列,应该设置返回PK + */ +public enum ReturnType { + /** + * 不返回任何行数据。 + */ + RT_NONE, + + /** + * 返回PK列的数据。 + */ + RT_PK, + + /** + * 返回修改列的数据(如原子加的结果返回)。 + */ + RT_AFTER_MODIFY, +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Row.java b/src/main/java/com/alicloud/openservices/tablestore/model/Row.java new file mode 100644 index 0000000..abd54f8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Row.java @@ -0,0 +1,223 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.*; + +public class Row implements IRow { + + private PrimaryKey primaryKey; + + private Column[] columns; + + private NavigableMap> columnsMap; + + /** + * 构造函数。 + * + * @param primaryKey 行的主键,不能为null或者为空 + * @param columns 该行的属性列,不能为null + */ + public Row(PrimaryKey primaryKey, List columns) { + this(primaryKey, columns.toArray(new Column[columns.size()])); + } + + /** + * 构造函数。 + * + * @param primaryKey 行的主键,不能为null或者为空 + * @param columns 该行的属性列,不能为null + */ + public Row(PrimaryKey primaryKey, Column[] columns) { + Preconditions.checkArgument(primaryKey != null, "The primary key of row should not be null."); + Preconditions.checkNotNull(columns, "The columns of row should not be null."); + + this.primaryKey = primaryKey; + this.columns = columns; + sortColumns(); // it may not been sorted, so we should sort it first + } + + /** + * 将数组中的所有属性列按名称升序、timestamp降序的顺序重新排列。 + */ + private void sortColumns() { + // check if it is already sorted, optimized as in most time it is sorted. + boolean sorted = true; + for (int i = 0; i < columns.length - 1; i++) { + int ret = Column.NAME_TIMESTAMP_COMPARATOR.compare(columns[i], columns[i + 1]); + if (ret > 0) { + sorted = false; + break; + } + } + + if (!sorted) { + Arrays.sort(this.columns, Column.NAME_TIMESTAMP_COMPARATOR); + } + } + + /** + * 二分查找指定的列. + * @param name 要查找的列名 + * @return 如果包含查找的列, 返回对应的index; 如果不包含该列, 返回可以插入该列的位置; 如果所有元素都小于该列, 返回-1. + */ + private int binarySearch(String name) { + Column searchTerm = new Column(name, ColumnValue.INTERNAL_NULL_VALUE, Long.MAX_VALUE); + + // 若数组中有多列与searchTerm相同,那不保证一定返回第一列,Row中的数据是TableStore返回的,不会出现这种情况。 + // pos === ( -(insertion point) - 1) + int pos = Arrays.binarySearch(columns, searchTerm, Column.NAME_TIMESTAMP_COMPARATOR); + + if (pos < 0) { + pos = (pos + 1) * -1; + } + + if (pos == columns.length) { + return -1; + } + return pos; + } + + @Override + public PrimaryKey getPrimaryKey() { + return primaryKey; + } + + /** + * 获取所有的属性列。 + *

数组中的所有属性列按名称升序排列,相同名称的属性列按timestamp降序排列。

+ * + * @return 所有属性列 + */ + public Column[] getColumns() { + return columns; + } + + /** + * 获取某个特定名称的属性列的所有版本的值。 + *

返回结果中这些属性列按timestamp降序排列。

+ * + * @param name 属性列的名称 + * @return 若该属性列存在,则返回所有版本的值,按timestamp降序排列,否则返回空列表 + */ + public List getColumn(String name) { + List result = new ArrayList(); + + if (columns == null || columns.length == 0) { + return result; + } + + int pos = binarySearch(name); + if (pos == -1) { + return result; + } + + for (int i = pos; i < columns.length; i++) { + Column col = columns[i]; + if (col.getName().equals(name)) { + result.add(col); + } else { + break; + } + } + return result; + } + + /** + * 获取该属性列中最新版本的值。 + * + * @param name 属性列的名称 + * @return 若该属性列存在,则返回最新版本的值,否则返回null + */ + public Column getLatestColumn(String name) { + if (columns == null || columns.length == 0) { + return null; + } + + int pos = binarySearch(name); + if (pos == -1) { + return null; + } + + Column col = columns[pos]; + + if (col.getName().equals(name)) { + return col; + } else { + return null; + } + } + + /** + * 检查该行中是否有该名称的属性列。 + * + * @param name 属性列的名称 + * @return 若存在,则返回true,否则返回false + */ + public boolean contains(String name) { + return getLatestColumn(name) != null; + } + + /** + * 检查该行是否包含属性列。 + * + * @return 若该行不包含任何属性列,则返回true,否则返回false + */ + public boolean isEmpty() { + return columns == null || columns.length == 0; + } + + /** + * 返回一个包含所有属性列的Map。 + *

该Map为一个双层Map,第一层为属性列名称到所有版本属性列的映射,第二层为时间戳与属性列的映射。

+ *

属性列名称在Map中升序排列,属性列时间戳降序排列。

+ * + * @return 返回包含所有属性列的map + */ + public NavigableMap> getColumnsMap() { + if (columnsMap != null) { + return columnsMap; + } + + columnsMap = new TreeMap>(); + + if (isEmpty()) { + return columnsMap; + } + + for (Column col : this.columns) { + NavigableMap tsMap = columnsMap.get(col.getName()); + + if (tsMap == null) { + tsMap = new TreeMap(new Comparator() { + public int compare(Long l1, Long l2) { + return l2.compareTo(l1); + } + }); + columnsMap.put(col.getName(), tsMap); + } + + tsMap.put(col.getTimestamp(), col.getValue()); + } + return columnsMap; + } + + @Override + public int compareTo(IRow o) { + return this.primaryKey.compareTo(o.getPrimaryKey()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[PrimaryKey:]"); + sb.append(this.primaryKey); + sb.append("\n[Columns:]"); + for (Column column : this.getColumns()) { + sb.append("("); + sb.append(column); + sb.append(")"); + } + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RowChange.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowChange.java new file mode 100644 index 0000000..cd1db00 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowChange.java @@ -0,0 +1,147 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + + +/** + * 单行的数据变更操作的基础结构。 + *

若是PutRow操作,请参考{@link RowPutChange}。

+ *

若是UpdateRow操作,请参考{@link RowUpdateChange}。

+ *

若是DeleteRow操作,请参考{@link RowDeleteChange}。

+ */ +public abstract class RowChange implements IRow, Measurable { + /** + * 表的名称。 + */ + private String tableName; + + /** + * 表的主键。 + */ + private PrimaryKey primaryKey; + + /** + * 判断条件。 + */ + private Condition condition; + + /** + * 返回的数据类型,默认是不返回。 + */ + private ReturnType returnType; + + /** + * 指定本次修改需要返回列值的列名,支持修改类型:原子加。 + */ + private Set returnColumnNames = new HashSet(); + + /** + * 构造函数。 + * internal use + *

表的名称不能为null或者为空。

+ *

行的主键不能为null或者为空。

+ * + * @param tableName 表的名称 + * @param primaryKey 表的主键 + */ + public RowChange(String tableName, PrimaryKey primaryKey){ + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), "The name of table should not be null or empty."); + Preconditions.checkArgument(primaryKey != null && !primaryKey.isEmpty(), "The primary key of row should not be null or empty."); + this.tableName = tableName; + this.primaryKey = primaryKey; + this.condition = new Condition(); + this.returnType = ReturnType.RT_NONE; + } + + /** + * 构造函数。 + * internal use + *

表的名称不能为null或者为空。

+ * + * @param tableName 表的名称 + */ + public RowChange(String tableName) { + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), "The name of table should not be null or empty."); + this.tableName = tableName; + this.condition = new Condition(); + this.returnType = ReturnType.RT_NONE; + } + + /** + * 设置表的名称。 + */ + public void setTableName(String tableName) { + this.tableName = tableName; + } + + /** + * 获取表的名称。 + * + * @return 表的名称 + */ + public String getTableName() { + return tableName; + } + + /** + * 添加主键(Primary Key)列的名称和值。 + * @param primaryKey 行的主键。 + */ + public void setPrimaryKey(PrimaryKey primaryKey){ + Preconditions.checkNotNull(primaryKey, "primaryKey"); + + this.primaryKey = primaryKey; + } + + /** + * 获取该行的主键。 + * + * @return 行的主键 + */ + public PrimaryKey getPrimaryKey() { + return primaryKey; + } + + /** + * 获取判断条件。 + * @return 判断条件。 + */ + public Condition getCondition() { + return condition; + } + + /** + * 设置判断条件。 + * @param condition 判断条件。 + */ + public void setCondition(Condition condition) { + this.condition = condition; + } + + @Override + public int compareTo(IRow row) { + return this.primaryKey.compareTo(row.getPrimaryKey()); + } + + public ReturnType getReturnType() { + return returnType; + } + + public void setReturnType(ReturnType returnType) { + this.returnType = returnType; + } + + public void addReturnColumn(String columnName) { + Preconditions.checkArgument(columnName != null && !columnName.isEmpty(), "Column's name should not be null or empty."); + this.returnColumnNames.add(columnName); + } + + public Set getReturnColumnNames() { + return Collections.unmodifiableSet(returnColumnNames); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RowDeleteChange.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowDeleteChange.java new file mode 100755 index 0000000..7d036b8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowDeleteChange.java @@ -0,0 +1,28 @@ +package com.alicloud.openservices.tablestore.model; + +public class RowDeleteChange extends RowChange { + + /** + * 构造函数。 + * + * @param tableName 表的名称 + * @param primaryKey 要删除的行的主键 + */ + public RowDeleteChange(String tableName, PrimaryKey primaryKey) { + super(tableName, primaryKey); + } + + /** + * 构造函数。 + * + * @param tableName 表的名称 + */ + public RowDeleteChange(String tableName) { + super(tableName); + } + + @Override + public int getDataSize() { + return getPrimaryKey().getDataSize(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RowExistenceExpectation.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowExistenceExpectation.java new file mode 100755 index 0000000..52d8ec7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowExistenceExpectation.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.model; + +public enum RowExistenceExpectation { + /** + * 不对行是否存在做任何判断。 + */ + IGNORE, + + /** + * 期望该行存在。 + */ + EXPECT_EXIST, + + /** + * 期望该行不存在。 + */ + EXPECT_NOT_EXIST; +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowIterator.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowIterator.java similarity index 69% rename from src/main/java/com/aliyun/openservices/ots/model/RowIterator.java rename to src/main/java/com/alicloud/openservices/tablestore/model/RowIterator.java index 4514419..a8ed2a2 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/RowIterator.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowIterator.java @@ -1,42 +1,59 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; import java.util.Iterator; import java.util.NoSuchElementException; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTS; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.SyncClientInterface; public class RowIterator implements Iterator { - private OTS ots; + private SyncClientInterface client; private RangeIteratorParameter parameter; - private GetRangeResult result; + private GetRangeResponse result; private Iterator rowsIter; private int totalCount; private int bufferSize; private int rowsRead; - public RowIterator(OTS ots, RangeIteratorParameter parameter) { - this.ots = ots; + public RowIterator(SyncClientInterface client, RangeIteratorParameter parameter) { + this.client = client; this.parameter = parameter; this.rowsRead = 0; - this.totalCount = parameter.getCount(); + this.totalCount = parameter.getMaxCount(); this.bufferSize = parameter.getBufferSize(); - + if (bufferSize == -1) { bufferSize = totalCount; } else if (totalCount != -1 && bufferSize > totalCount) { bufferSize = totalCount; } - + fetchData(buildRequest()); } private GetRangeRequest buildRequest() { RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(parameter.getTableName()); criteria.setDirection(parameter.getDirection()); - criteria.setColumnsToGet(parameter.getColumnsToGet()); + criteria.addColumnsToGet(parameter.getColumnsToGet()); + if (parameter.hasSetCacheBlock()) { + criteria.setCacheBlocks(parameter.getCacheBlocks()); + } + + if (parameter.hasSetMaxVersions()) { + criteria.setMaxVersions(parameter.getMaxVersions()); + } + + if (parameter.hasSetTimeRange()) { + criteria.setTimeRange(parameter.getTimeRange()); + } + + if (parameter.hasSetFilter()) { + criteria.setFilter(parameter.getFilter()); + } + if (result == null) { criteria.setInclusiveStartPrimaryKey(parameter.getInclusiveStartPrimaryKey()); } else { @@ -51,14 +68,11 @@ private GetRangeRequest buildRequest() { criteria.setLimit(bufferSize); } } - if (parameter.getFilter() != null) { - criteria.setFilter(parameter.getFilter()); - } return new GetRangeRequest(criteria); } private void fetchData(GetRangeRequest request) { - GetRangeResult result = ots.getRange(request); + GetRangeResponse result = client.getRange(request); this.result = result; this.rowsIter = result.getRows().iterator(); this.rowsRead += result.getRows().size(); @@ -77,17 +91,18 @@ public boolean hasNext() { // has data in buffer if (isBufferHasMoreData()) { return true; - } - + } + // need to send one more request - RowPrimaryKey nextToken = result.getNextStartPrimaryKey(); - while (nextToken != null && !nextToken.getPrimaryKey().isEmpty() && totalCount != rowsRead) { + PrimaryKey nextToken = result.getNextStartPrimaryKey(); + while (nextToken != null && !nextToken.isEmpty() && totalCount != rowsRead) { fetchData(buildRequest()); if (isBufferHasMoreData()) { return true; } nextToken = result.getNextStartPrimaryKey(); } + return false; } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RowPutChange.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowPutChange.java new file mode 100755 index 0000000..83383e7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowPutChange.java @@ -0,0 +1,233 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.CalculateHelper; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; + +import java.util.ArrayList; +import java.util.List; + +public class RowPutChange extends RowChange { + + /** + * 行的属性列集合。 + */ + private List columnsToPut = new ArrayList(); + + private OptionalValue timestamp = new OptionalValue("Timestamp"); + + /** + * 构造函数。 + * + * @param tableName 表的名称 + */ + public RowPutChange(String tableName) { + super(tableName); + } + + /** + * 构造函数。 + * + * @param tableName 表的名称 + * @param primaryKey 行的主键 + */ + public RowPutChange(String tableName, PrimaryKey primaryKey) { + super(tableName, primaryKey); + } + + /** + * 构造函数。 + *

允许用户设置一个默认的时间戳,若写入的列没有带时间戳,则会使用该默认时间戳。

+ * + * @param tableName 表的名称 + * @param primaryKey 行的主键 + * @param ts 默认时间戳 + */ + public RowPutChange(String tableName, PrimaryKey primaryKey, long ts) { + super(tableName, primaryKey); + this.timestamp.setValue(ts); + } + + /** + * 拷贝构造函数 + * + * @param toCopy + */ + public RowPutChange(RowPutChange toCopy) { + super(toCopy.getTableName(), toCopy.getPrimaryKey()); + if (toCopy.timestamp.isValueSet()) { + timestamp.setValue(toCopy.timestamp.getValue()); + } + + columnsToPut.addAll(toCopy.columnsToPut); + } + + /** + * 新写入一个属性列。 + * + * @param column + * @return this (for invocation chain) + */ + public RowPutChange addColumn(Column column) { + this.columnsToPut.add(column); + return this; + } + + /** + * 新写入一个属性列。 + *

若设置过{@link #timestamp},则使用该默认的时间戳。

+ * + * @param name 属性列的名称 + * @param value 属性列的值 + * @return this (for invocation chain) + */ + public RowPutChange addColumn(String name, ColumnValue value) { + Column column = null; + if (this.timestamp.isValueSet()) { + column = new Column(name, value, this.timestamp.getValue()); + } else { + column = new Column(name, value); + } + + this.columnsToPut.add(column); + return this; + } + + /** + * 新写入一个属性列。 + * + * @param name 属性列的名称 + * @param value 属性列的值 + * @param ts 属性列的时间戳 + * @return this (for invocation chain) + */ + public RowPutChange addColumn(String name, ColumnValue value, long ts) { + this.columnsToPut.add(new Column(name, value, ts)); + return this; + } + + /** + * 新写入一批属性列。 + *

属性列的写入顺序与列表中的顺序一致。

+ * + * @param columns 属性列列表 + * @return this (for invocation chain) + */ + public RowPutChange addColumns(List columns) { + this.columnsToPut.addAll(columns); + return this; + } + + /** + * 新写入一批属性列。 + *

属性列的写入顺序与数组中的顺序一致。

+ * + * @param columns + * @return this (for invocation chain) + */ + public RowPutChange addColumns(Column[] columns) { + for (Column column : columns) { + this.columnsToPut.add(column); + } + return this; + } + + /** + * 获取所有要写入的属性列列表。 + * + * @return 属性列列表 + */ + public List getColumnsToPut() { + return this.columnsToPut; + } + + /** + * 获取名称与指定名称相同的所有属性列的列表。 + * + * @param name 属性列名称 + * @return 若找到对应的属性列,则返回包含这些元素的列表,否则返回一个空列表。 + */ + public List getColumnsToPut(String name) { + List result = new ArrayList(); + + for (Column col : columnsToPut) { + if (col.getName().equals(name)) { + result.add(col); + } + } + return result; + } + + @Override + public int getDataSize() { + int valueTotalSize = 0; + for (Column col : columnsToPut) { + valueTotalSize += col.getDataSize(); + } + return getPrimaryKey().getDataSize() + valueTotalSize; + } + + /** + * 检查是否已经有相同名称的属性列写入,忽略时间戳和值是否相等。 + * + * @param name 属性列名称 + * @return 若有返回true,否则返回false + */ + public boolean has(String name) { + for (Column col : columnsToPut) { + if (col.getName().equals(name)) { + return true; + } + } + return false; + } + + /** + * 检查是否有相同名称和相同时间戳的属性列写入,忽略值是否相等。 + * + * @param name 属性列名称 + * @param ts 属性列时间戳 + * @return 若有返回true,否则返回false + */ + public boolean has(String name, long ts) { + for (Column col : columnsToPut) { + if (col.getName().equals(name) && (col.hasSetTimestamp() && col.getTimestamp() == ts)) { + return true; + } + } + return false; + } + + /** + * 检查是否有相同名称和相同值的属性列写入,忽略时间戳是否相等。 + * + * @param name 属性列名称 + * @param value 属性列值 + * @return 若有返回true,否则返回false + */ + public boolean has(String name, ColumnValue value) { + for (Column col : columnsToPut) { + if (col.getName().equals(name) && col.getValue().equals(value)) { + return true; + } + } + return false; + } + + /** + * 检查是否有相同名称、相同时间戳并且相同值的属性列写入。 + * + * @param name 属性列名称 + * @param ts 属性列时间戳 + * @param value 属性列值 + * @return 若有返回true,否则返回false + */ + public boolean has(String name, long ts, ColumnValue value) { + for (Column col : columnsToPut) { + if (col.getName().equals(name) && (col.hasSetTimestamp() && col.getTimestamp() == ts) && + value.equals(col.getValue())) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RowQueryCriteria.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowQueryCriteria.java new file mode 100755 index 0000000..21685a8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowQueryCriteria.java @@ -0,0 +1,344 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.model.filter.Filter; + +import java.util.*; + +/** + * 从TableStore内读取数据操作的基本参数,主要包含: + *
    + *
  • ColumnsToGet: 要读取的属性列名列表,若为空,则代表读取该行所有的列。
  • + *
  • TimeRange: 要读取的时间戳的范围,若未设置,则代表读取所有的版本。
  • + *
  • MaxVersions: 要返回的列的版本的个数,若未设置,则返回OTS当前保留的所有版本。
  • + *
  • Filter: 代表本次查询使用的Filter,Filter能够对查询范围内的数据在服务端进行初步的过滤,以减少额外的传输数据。
  • + *
+ */ +public class RowQueryCriteria { + /** + * 查询的表的名称。 + */ + private String tableName; + + /** + * 要读取的属性列名列表,若为空,则代表读取该行所有的列。 + */ + private Set columnsToGet = new HashSet(); + + /** + * 要读取的时间戳的范围,若未设置,则代表读取所有的版本。 + */ + private OptionalValue timeRange = new OptionalValue("TimeRange"); + + /** + * 要返回的列的版本的个数,若未设置,则返回OTS当前保留的所有版本。 + */ + private OptionalValue maxVersions = new OptionalValue("MaxVersions"); + + /** + * 本次查询使用的Filter。 + */ + private OptionalValue filter = new OptionalValue("Filter"); + + /** + * 查询的列范围的起始位置. + */ + private OptionalValue startColumn = new OptionalValue("StartColumn"); + + /** + * 查询的列范围的终止位置. + */ + private OptionalValue endColumn = new OptionalValue("EndColumn"); + + + /** + * 内部参数。 + */ + private OptionalValue cacheBlocks = new OptionalValue("CacheBlocks"); + + /** + * 构造函数。 + * + * @param tableName 查询的表名 + */ + public RowQueryCriteria(String tableName) { + Preconditions.checkArgument( + tableName != null && !tableName.isEmpty(), + "The name of table should not be null or empty."); + this.tableName = tableName; + } + + /** + * 设置查询的表名。 + * + * @param tableName 表的名称。 + */ + public void setTableName(String tableName) { + Preconditions.checkArgument( + tableName != null && !tableName.isEmpty(), + "The name of table should not be null or empty."); + this.tableName = tableName; + } + + /** + * 返回查询的表名。 + * + * @return 表的名称 + */ + public String getTableName() { + return tableName; + } + + /** + * 返回要读取的列的名称列表(只读)。 + * + * @return 列的名称的列表(只读)。 + */ + public Set getColumnsToGet() { + return Collections.unmodifiableSet(columnsToGet); + } + + /** + * 添加要读取的列。 + * + * @param columnName 要返回列的名称。 + */ + public void addColumnsToGet(String columnName) { + Preconditions.checkArgument(columnName != null && !columnName.isEmpty(), "Column's name should not be null or empty."); + this.columnsToGet.add(columnName); + } + + /** + * 添加要读取的列。 + * + * @param columnNames 要返回列的名称。 + */ + public void addColumnsToGet(String[] columnNames) { + Preconditions.checkNotNull(columnNames, "columnNames should not be null."); + for (int i = 0; i < columnNames.length; ++i) { + addColumnsToGet(columnNames[i]); + } + } + + /** + * 添加要读取的列。 + * + * @param columnsToGet + */ + public void addColumnsToGet(Collection columnsToGet) { + this.columnsToGet.addAll(columnsToGet); + } + + /** + * 将设置过的要读取的列的名称列表清空。 + */ + public void clearColumnsToGet() { + this.columnsToGet.clear(); + } + + /** + * 返回要读取的列的个数。 + * + * @return 要读取的列的个数。 + */ + public int numColumnsToGet() { + return this.columnsToGet.size(); + } + + /** + * 设置MaxVersions。 + * + * @param maxVersions + */ + public void setMaxVersions(int maxVersions) { + Preconditions.checkArgument(maxVersions > 0, "The value of maxVersions must be greater than 0."); + this.maxVersions.setValue(maxVersions); + } + + /** + * 获取设置过的MaxVersions。 + * + * @return MaxVersions + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public int getMaxVersions() { + if (!this.maxVersions.isValueSet()) { + throw new IllegalStateException("The value of maxVersions is not set."); + } + return this.maxVersions.getValue(); + } + + /** + * 查询是否设置了MaxVersions。 + * + * @return 若设置过MaxVersions,则返回true,否则返回false。 + */ + public boolean hasSetMaxVersions() { + return this.maxVersions.isValueSet(); + } + + /** + * 设置要读取的时间戳范围。 + * + * @param timeRange 时间戳范围 + */ + public void setTimeRange(TimeRange timeRange) { + Preconditions.checkNotNull(timeRange, "The time range should not be null."); + this.timeRange.setValue(timeRange); + } + + /** + * 设置要读取的某个特定时间戳。 + * + * @param timestamp 时间戳 + */ + public void setTimestamp(long timestamp) { + Preconditions.checkArgument(timestamp >= 0, "The timestamp must be positive."); + this.timeRange.setValue(new TimeRange(timestamp, timestamp + 1)); + } + + /** + * 获取设置过的时间戳范围。 + * + * @return TimeRange + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public TimeRange getTimeRange() { + if (!this.timeRange.isValueSet()) { + throw new IllegalStateException("The value of timeRange is not set."); + } + return this.timeRange.getValue(); + } + + /** + * 查询是否设置过TimeRange。 + * + * @return 若设置过TimeRange,则返回true,否则返回false + */ + public boolean hasSetTimeRange() { + return this.timeRange.isValueSet(); + } + + /** + * 设置本次查询使用的Filter。 + * + * @param filter + */ + public void setFilter(Filter filter) { + Preconditions.checkNotNull(filter, "The filter should not be null"); + this.filter.setValue(filter); + } + + /** + * 获取本次查询使用的Filter。 + * + * @return Filter + * @throws java.lang.IllegalStateException 若没有设置Filter + */ + public Filter getFilter() { + if (!this.filter.isValueSet()) { + throw new IllegalStateException("The value of filter is not set."); + } + return this.filter.getValue(); + } + + /** + * 查询是否设置了Filter。 + * + * @return 若设置了Filter,则返回true,否则返回false。 + */ + public boolean hasSetFilter() { + return this.filter.isValueSet(); + } + + + /** + * 设置本次读操作返回数据是否要进BlockCache。 + * + * @param cacheBlocks 若为true,读取的数据会进入BlockCache + */ + public void setCacheBlocks(boolean cacheBlocks) { + this.cacheBlocks.setValue(cacheBlocks); + } + + /** + * 获取CacheBlocks的设置的值。 + * + * @return CacheBlocks + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public boolean getCacheBlocks() { + if (!this.cacheBlocks.isValueSet()) { + throw new IllegalStateException("The value of cacheBlocks is not set."); + } + return this.cacheBlocks.getValue(); + } + + /** + * 查询是否设置了CacheBlocks。 + * + * @return 若设置了CacheBlocks,则返回true,否则返回false。 + */ + public boolean hasSetCacheBlock() { + return this.cacheBlocks.isValueSet(); + } + + public String getStartColumn() { + if (!this.startColumn.isValueSet()) { + throw new IllegalStateException("The value of startColumn is not set."); + } + return startColumn.getValue(); + } + + public void setStartColumn(String startColumn) { + this.startColumn.setValue(startColumn); + } + + public boolean hasSetStartColumn() { + return this.startColumn.isValueSet(); + } + + public String getEndColumn() { + if (!this.endColumn.isValueSet()) { + throw new IllegalStateException("The value of endColumn is not set."); + } + return endColumn.getValue(); + } + + public void setEndColumn(String endColumn) { + this.endColumn.setValue(endColumn); + } + + public boolean hasSetEndColumn() { + return this.endColumn.isValueSet(); + } + + public void copyTo(RowQueryCriteria target) { + target.tableName = tableName; + target.columnsToGet.addAll(columnsToGet); + if (timeRange.isValueSet()) { + target.timeRange.setValue(timeRange.getValue()); + } + + if (maxVersions.isValueSet()) { + target.maxVersions.setValue(maxVersions.getValue()); + } + + if (cacheBlocks.isValueSet()) { + target.cacheBlocks.setValue(cacheBlocks.getValue()); + } + + if (filter.isValueSet()) { + target.filter.setValue(filter.getValue()); + } + + if (startColumn.isValueSet()) { + target.startColumn.setValue(startColumn.getValue()); + } + + if (endColumn.isValueSet()) { + target.endColumn.setValue(endColumn.getValue()); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RowRangeColumnIteratorImpl.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowRangeColumnIteratorImpl.java new file mode 100644 index 0000000..b4aeed9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowRangeColumnIteratorImpl.java @@ -0,0 +1,84 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.ClientException; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +public class RowRangeColumnIteratorImpl extends AbstractColumnIteratorImpl { + + private WideRowIterator wideRowIterator; + private PrimaryKey primaryKey; + private Iterator columnIterator; + private boolean complete = false; + private boolean close = false; + + public RowRangeColumnIteratorImpl(WideRowIterator wideRowIterator, PrimaryKey primaryKey, + Iterator columnIterator, boolean complete) { + this.wideRowIterator = wideRowIterator; + this.primaryKey = primaryKey; + this.columnIterator = columnIterator; + this.complete = complete; + } + + private boolean doHasNext() { + while (!complete && !columnIterator.hasNext()) { + this.wideRowIterator.fetchData(); + } + if (columnIterator.hasNext()) { + return true; + } + return false; + } + + private Column doNext() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return columnIterator.next(); + } + + @Override + public boolean hasNext() { + if (close) { + throw new ClientException("The iterator has been closed."); + } + return doHasNext(); + } + + @Override + public Column next() { + if (close) { + throw new ClientException("The iterator has been closed."); + } + return doNext(); + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + public void setColumnIterator(Iterator columnIterator) { + this.columnIterator = columnIterator; + } + + public boolean isComplete() { + return complete; + } + + public void setComplete(boolean complete) { + this.complete = complete; + } + + public PrimaryKey getPrimaryKey() { + return primaryKey; + } + + public void close() { + close = true; + while (doHasNext()) { + doNext(); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/RowUpdateChange.java b/src/main/java/com/alicloud/openservices/tablestore/model/RowUpdateChange.java new file mode 100755 index 0000000..0597e2f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/RowUpdateChange.java @@ -0,0 +1,203 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.alicloud.openservices.tablestore.core.utils.CalculateHelper; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Pair; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class RowUpdateChange extends RowChange { + public static enum Type { + /** + * 代表写入该Column的某个特定版本的值。 + */ + PUT, + + /** + * 代表删除该Column的某个特定版本,版本号的时间戳等于{@link Column#timestamp}。 + */ + DELETE, + + /** + * 代表删除该Column的所有版本的值。 + */ + DELETE_ALL, + + /** + * 代表对该column的最新版本执行原子加。 + */ + INCREMENT + } + + /** + * 所有要更新的属性列。 + *

若类型为{@link Type#PUT},则代表写入一个属性列。

+ *

若类型为{@link Type#DELETE},则代表删除一个属性列的某个特定版本,对应的Column中的value无效。

+ *

若类型为{@link Type#DELETE_ALL},则代表删除一个属性列的所有版本,对应的Column中的value和timestamp均无效。

+ */ + private List> columnsToUpdate = new ArrayList>(); + + private OptionalValue timestamp = new OptionalValue("Timestamp"); + + /** + * 构造函数。 + *

表的名称不能为null或者为空。

+ * + * @param tableName 表的名称 + */ + public RowUpdateChange(String tableName) { + super(tableName); + } + + /** + * 构造函数。 + *

表的名称不能为null或者为空。

+ *

行的主键不能为null或者为空。

+ * + * @param tableName 表的名称 + * @param primaryKey 行的主键 + */ + public RowUpdateChange(String tableName, PrimaryKey primaryKey) { + super(tableName, primaryKey); + } + + /** + * 构造函数。 + *

允许用户设置一个默认的时间戳,若写入的列没有带时间戳,则会使用该默认时间戳。

+ *

默认的时间戳与删除动作无关,。

+ *

表的名称不能为null或者为空。

+ *

行的主键不能为null或者为空。

+ * + * @param tableName 表的名称 + * @param primaryKey 行的主键 + * @param ts 默认时间戳 + */ + public RowUpdateChange(String tableName, PrimaryKey primaryKey, long ts) { + super(tableName, primaryKey); + this.timestamp.setValue(ts); + } + + /** + * 拷贝构造函数 + * + * @param toCopy + */ + public RowUpdateChange(RowUpdateChange toCopy) { + super(toCopy.getTableName(), toCopy.getPrimaryKey()); + if (toCopy.timestamp.isValueSet()) { + timestamp.setValue(toCopy.timestamp.getValue()); + } + + columnsToUpdate.addAll(toCopy.columnsToUpdate); + } + + /** + * 新写入一个属性列。 + * + * @param column + * @return this (for invocation chain) + */ + public RowUpdateChange put(Column column) { + this.columnsToUpdate.add(new Pair(column, Type.PUT)); + return this; + } + + /** + * 新写入一个属性列。 + *

若设置过{@link #timestamp},则使用该默认的时间戳。

+ * + * @param name 属性列的名称 + * @param value 属性列的值 + * @return this (for invocation chain) + */ + public RowUpdateChange put(String name, ColumnValue value) { + Column column = null; + if (this.timestamp.isValueSet()) { + column = new Column(name, value, this.timestamp.getValue()); + } else { + column = new Column(name, value); + } + + this.columnsToUpdate.add(new Pair(column, Type.PUT)); + return this; + } + + /** + * 新写入一个属性列。 + * + * @param name 属性列的名称 + * @param value 属性列的值 + * @param ts 属性列的时间戳 + * @return this (for invocation chain) + */ + public RowUpdateChange put(String name, ColumnValue value, long ts) { + this.columnsToUpdate.add(new Pair(new Column(name, value, ts), Type.PUT)); + return this; + } + + /** + * 新写入一批属性列。 + *

属性列的写入顺序与列表中的顺序一致。

+ * + * @param columns 属性列列表 + * @return this (for invocation chain) + */ + public RowUpdateChange put(List columns) { + for (Column col : columns) { + put(col); + } + return this; + } + + /** + * 删除某一属性列的特定版本。 + * + * @param name 属性列的名称 + * @param ts 属性列的时间戳 + * @return this for chain invocation + */ + public RowUpdateChange deleteColumn(String name, long ts) { + this.columnsToUpdate.add(new Pair(new Column(name, ColumnValue.INTERNAL_NULL_VALUE, ts), Type.DELETE)); + return this; + } + + /** + * 删除某一属性列的所有版本。 + * + * @param name 属性列的名称 + * @return this for chain invocation + */ + public RowUpdateChange deleteColumns(String name) { + this.columnsToUpdate.add(new Pair(new Column(name, ColumnValue.INTERNAL_NULL_VALUE), Type.DELETE_ALL)); + return this; + } + + public RowUpdateChange increment(Column column) { + this.columnsToUpdate.add(new Pair(column, Type.INCREMENT)); + return this; + } + + /** + * 获取所有要更新的列。 + *

若类型为{@link Type#PUT},则代表写入一个属性列,对应的Column即要写入的属性列。

+ *

若类型为{@link Type#DELETE},则代表删除一个属性列的某个特定版本,对应的Column中的value无效。

+ *

若类型为{@link Type#DELETE_ALL},则代表删除一个属性列的所有版本,对应的Column中的value和timestamp均无效。

+ * + * @return 所有要更新的列 + */ + public List> getColumnsToUpdate() { + return this.columnsToUpdate; + } + + @Override + public int getDataSize() { + int valueTotalSize = 0; + for (Pair col : columnsToUpdate) { + valueTotalSize += col.getFirst().getDataSize(); + } + return getPrimaryKey().getDataSize() + valueTotalSize; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/SingleRowQueryCriteria.java b/src/main/java/com/alicloud/openservices/tablestore/model/SingleRowQueryCriteria.java new file mode 100755 index 0000000..75c603c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/SingleRowQueryCriteria.java @@ -0,0 +1,79 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +/** + * 从TableStore表中查询单行数据所需的参数,可以支持以下几种读取行为: + *
    + *
  • 读取某些列或所有列的某个特定版本
  • + *
  • 读取某些列或所有列的某个版本范围内的所有版本或最大的N个版本
  • + *
  • 读取某些列或所有列的最大的N个版本(N最小为 1,最大为MaxVersions)
  • + *
+ */ +public class SingleRowQueryCriteria extends RowQueryCriteria implements IRow { + + private PrimaryKey primaryKey; + + /** + * 用于行内流式读, 标记位置和状态信息. + */ + private OptionalValue token = new OptionalValue("Token"); + + /** + * 构造一个在给定名称的表中查询的条件。 + * + * @param tableName 查询的表名 + */ + public SingleRowQueryCriteria(String tableName) { + super(tableName); + } + + /** + * 构造一个在给定名称的表中查询的条件。 + * + * @param tableName 查询的表名 + * @param primaryKey 行的主键 + */ + public SingleRowQueryCriteria(String tableName, PrimaryKey primaryKey) { + super(tableName); + setPrimaryKey(primaryKey); + } + + /** + * 设置行的主键。 + * + * @param primaryKey 行的主键。 + */ + public void setPrimaryKey(PrimaryKey primaryKey) { + Preconditions.checkArgument(primaryKey != null && !primaryKey.isEmpty(), "The row's primary key should not be null or empty."); + this.primaryKey = primaryKey; + } + + public byte[] getToken() { + if (!this.token.isValueSet()) { + throw new IllegalStateException("The value of token is not set."); + } + return token.getValue(); + } + + public void setToken(byte[] token) { + if (token != null) { + this.token.setValue(token); + } + } + + public boolean hasSetToken() { + return this.token.isValueSet(); + } + + @Override + public int compareTo(IRow row) { + return this.primaryKey.compareTo(row.getPrimaryKey()); + } + + @Override + public PrimaryKey getPrimaryKey() { + return this.primaryKey; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Split.java b/src/main/java/com/alicloud/openservices/tablestore/model/Split.java new file mode 100644 index 0000000..9aa897d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Split.java @@ -0,0 +1,88 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +/** + * + * ComputeSplitsBySize接口根据用户制定的数据大小进行分块后的数据块类,每个split类表示一串连续的主键值行,每个主键行的遵守目标表格的结构设计。 + * 每个数据块保证其中所包含的数据约等于用户指定的大小。 + */ +public class Split implements Jsonizable { + + /** + * 数据分块所在的partition分区的ID的哈希值。 + * + */ + private String location; + + /** + * 数据块所包含的起始行的主键值,遵循左闭右开区间。 + * + */ + private PrimaryKey lowerBound; + + /** + * 数据块所包含的末尾行的下一行的主键值,遵循左闭右开区间。 + * + */ + private PrimaryKey upperBound; + + public Split() { + } + + public Split(String location, PrimaryKey lowerBound, PrimaryKey upperBound) { + this.location = location; + this.lowerBound = lowerBound; + this.upperBound = upperBound; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public PrimaryKey getLowerBound() { + return lowerBound; + } + + public void setLowerBound(PrimaryKey lowerBound) { + this.lowerBound = lowerBound; + } + + public PrimaryKey getUpperBound() { + return upperBound; + } + + public void setUpperBound(PrimaryKey upperBound) { + this.upperBound = upperBound; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"Location\": " + this.getLocation() + ", "); + sb.append("\"lowerBound\": "); + if (this.getLowerBound() != null) { + sb.append(this.getLowerBound().jsonize() + " "); + } else { + sb.append("null"); + } + sb.append(", "); + sb.append("\"upperBound\": "); + if (this.getUpperBound() != null) { + sb.append(this.getUpperBound().jsonize() + " "); + } else { + sb.append("null"); + } + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionRequest.java new file mode 100644 index 0000000..233d7bb --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionRequest.java @@ -0,0 +1,68 @@ +package com.alicloud.openservices.tablestore.model; + + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class StartLocalTransactionRequest implements Request{ + + /** + * 表的名称。 + */ + private String tableName; + + /** + * 表的主键。 + */ + private PrimaryKey primaryKey; + + /** + * 设置表的名称。 + */ + public void setTableName(String tableName) { + this.tableName = tableName; + } + + /** + * 获取表的名称。 + * + * @return 表的名称 + */ + public String getTableName() { + return tableName; + } + + /** + * 添加主键(Primary Key)列的名称和值。 + * @param primaryKey 行的主键。 + */ + public void setPrimaryKey(PrimaryKey primaryKey){ + Preconditions.checkNotNull(primaryKey, "primaryKey"); + + this.primaryKey = primaryKey; + } + + /** + * 获取该行的主键。 + * + * @return 行的主键 + */ + public PrimaryKey getPrimaryKey() { + return primaryKey; + } + + /** + * 初始化StartLocalTransactionRequest实例。 + * + * @param tableName 表名。 + * @param key 主键,对于本地事务,只需要指定第一个主键即可。 + */ + public StartLocalTransactionRequest(String tableName, PrimaryKey key) { + setTableName(tableName); + setPrimaryKey(key); + } + + @Override + public String getOperationName() { + return OperationNames.OP_START_LOCAL_TRANSACTION; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionResponse.java new file mode 100644 index 0000000..0c11fb6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/StartLocalTransactionResponse.java @@ -0,0 +1,52 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + + +public class StartLocalTransactionResponse extends Response implements Jsonizable { + /** + * 事务的ID。 + */ + private String transactionID; + + /** + * 设置事务的ID。 + */ + public void setTransactionID(String transactionID) { + this.transactionID = transactionID; + } + + /** + * 获取事务的ID。 + * + * @return 事务的ID + */ + public String getTransactionID() { + return transactionID; + } + + /* + * 内部接口。请勿使用。 + */ + public StartLocalTransactionResponse(Response meta) { + super(meta); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"TransactionID\": \""); + sb.append(this.transactionID); + sb.append('\"'); + sb.append(newline); + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/Stream.java b/src/main/java/com/alicloud/openservices/tablestore/model/Stream.java new file mode 100644 index 0000000..5f85945 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/Stream.java @@ -0,0 +1,108 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class Stream implements Jsonizable { + + /** + * Stream的Id + */ + private String streamId; + + /** + * 所属的表的名称 + */ + private String tableName; + + /** + * Stream的创建时间,单位微秒 + */ + private long creationTime; + + /** + * 设置streamId + * @param streamId + */ + public void setStreamId(String streamId) { + this.streamId = streamId; + } + + /** + * 获取streamId + * @return + */ + public String getStreamId() { + return streamId; + } + + /** + * 设置所属表名 + * @param tableName + */ + public void setTableName(String tableName) { + this.tableName = tableName; + } + + /** + * 获取所属表名 + * @return + */ + public String getTableName() { + return tableName; + } + + /** + * 设置Stream的创建时间,单位微秒 + * @param creationTime + */ + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } + + /** + * 获取Stream的创建时间,单位微秒 + * @return + */ + public long getCreationTime() { + return creationTime; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"StreamId\": "); + sb.append("\""); + sb.append(streamId); + sb.append("\", "); + sb.append(newline); + sb.append("\"TableName\": "); + sb.append("\""); + sb.append(tableName); + sb.append("\", "); + sb.append(newline); + sb.append("\"CreationTime\": "); + sb.append(creationTime); + sb.append(newline); + sb.append("}"); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("StreamId: "); + sb.append(streamId); + sb.append(", TableName: "); + sb.append(tableName); + sb.append(", CreationTime: "); + sb.append(creationTime); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/StreamDetails.java b/src/main/java/com/alicloud/openservices/tablestore/model/StreamDetails.java new file mode 100644 index 0000000..f6d029d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/StreamDetails.java @@ -0,0 +1,131 @@ +package com.alicloud.openservices.tablestore.model; + + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class StreamDetails implements Jsonizable { + + /** + * 是否开启Stream + */ + private boolean enableStream; + + /** + * Stream的Id + * 开启Stream时有效 + */ + private String streamId; + + /** + * Stream的过期时间,单位小时 + * 开启Stream时有效 + */ + private int expirationTime; + + /** + * 上次开启Stream的时间,单位微秒 + */ + private long lastEnableTime; + + public StreamDetails() { + + } + + public StreamDetails(boolean enableStream, String streamId, int expirationTime, int lastEnableTime) { + setEnableStream(enableStream); + setStreamId(streamId); + setExpirationTime(expirationTime); + setLastEnableTime(lastEnableTime); + } + + /** + * 获取是否开启Stream + * @return 是否开启Stream + */ + public boolean isEnableStream() { + return enableStream; + } + + public void setEnableStream(boolean enableStream) { + this.enableStream = enableStream; + } + + /** + * 获取Stream的Id + * @return Stream的Id + */ + public String getStreamId() { + return streamId; + } + + public void setStreamId(String streamId) { + this.streamId = streamId; + } + + /** + * 获取Stream的过期时间,单位小时 + * @return Stream的过期时间 + */ + public int getExpirationTime() { + return expirationTime; + } + + public void setExpirationTime(int expirationTime) { + this.expirationTime = expirationTime; + } + + /** + * 获取上次开启Stream的时间,单位微秒 + * @return 上次开启Stream的时间 + */ + public long getLastEnableTime() { + return lastEnableTime; + } + + public void setLastEnableTime(long lastEnableTime) { + this.lastEnableTime = lastEnableTime; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"EnableStream\": "); + sb.append(enableStream); + sb.append(","); + sb.append(newline); + sb.append("\"StreamId\": "); + sb.append("\"" + streamId + "\""); + sb.append(","); + sb.append(newline); + sb.append("\"ExpirationTime\": "); + sb.append(expirationTime); + sb.append(","); + sb.append(newline); + sb.append("\"LastEnableTime\": "); + sb.append(lastEnableTime); + sb.append(newline); + sb.append("}"); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("EnableStream: "); + sb.append(enableStream); + sb.append(", StreamId: "); + sb.append(streamId); + sb.append(", ExpirationTime: "); + sb.append(expirationTime); + sb.append(", LastEnableTime: "); + sb.append(lastEnableTime); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/StreamRecord.java b/src/main/java/com/alicloud/openservices/tablestore/model/StreamRecord.java new file mode 100644 index 0000000..66c5fde --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/StreamRecord.java @@ -0,0 +1,117 @@ +package com.alicloud.openservices.tablestore.model; + +import java.util.ArrayList; +import java.util.List; + +public class StreamRecord { + + public enum RecordType { + /** + * PUT类型 + * 如果对应行已存在,该Record需要覆盖原有数据。 + */ + PUT, + + /** + * UPDATE类型 + * 如果对应行已存在,该Record是在原有数据上的更新。 + */ + UPDATE, + + /** + * DELETE类型 + * 表明要删除对应的行。 + */ + DELETE + } + + /** + * Record的类型 + */ + private RecordType recordType; + + /** + * 对应行的主键 + */ + private PrimaryKey primaryKey; + + /** + * 对应行的时序信息 + */ + private RecordSequenceInfo sequenceInfo; + + /** + * 该Record包含的属性列,为RecordColumn类型 + */ + private List columns; + + /** + * 获取Record的类型 + * @return Record的类型 + */ + public RecordType getRecordType() { + return recordType; + } + + public void setRecordType(RecordType recordType) { + this.recordType = recordType; + } + + /** + * 获取对应行的主键 + * @return 对应行的主键 + */ + public PrimaryKey getPrimaryKey() { + return primaryKey; + } + + public void setPrimaryKey(PrimaryKey primaryKey) { + this.primaryKey = primaryKey; + } + + /** + * 获取该行的时序信息 + * @return 该行的时序信息 + */ + public RecordSequenceInfo getSequenceInfo() { + return sequenceInfo; + } + public void setSequenceInfo(RecordSequenceInfo sequenceInfo) { + this.sequenceInfo = sequenceInfo; + } + + /** + * 获取该Record包含的属性列列表 + * @return 该Record包含的属性列列表 + */ + public List getColumns() { + if (columns != null) { + return columns; + } else { + return new ArrayList(); + } + } + + public void setColumns(List columns) { + this.columns = columns; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[RecordType:]"); + sb.append(this.recordType); + sb.append("\n[RecordSequenceInfo:]"); + sb.append(this.sequenceInfo); + sb.append("\n[PrimaryKey:]"); + sb.append(this.primaryKey); + sb.append("\n[Columns:]"); + for (RecordColumn column : this.getColumns()) { + sb.append("("); + sb.append(column); + sb.append(")"); + } + return sb.toString(); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/StreamShard.java b/src/main/java/com/alicloud/openservices/tablestore/model/StreamShard.java new file mode 100644 index 0000000..846b375 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/StreamShard.java @@ -0,0 +1,101 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class StreamShard implements Jsonizable { + /** + * Shard的Id + */ + private String shardId; + + /** + * 父Shard的Id + */ + private String parentId; + + /** + * 父同级Shard的Id + */ + private String parentSiblingId; + + public StreamShard(String shardId) { + setShardId(shardId); + } + + /** + * 获取ShardId + * @return shardId + */ + public String getShardId() { + return shardId; + } + + public void setShardId(String shardId) { + this.shardId = shardId; + } + + /** + * 获取ParentId + * @return parentId + */ + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + /** + * 获取ParentSiblingId + * @return parentSiblingId + */ + public String getParentSiblingId() { + return parentSiblingId; + } + + public void setParentSiblingId(String parentSiblingId) { + this.parentSiblingId = parentSiblingId; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"ShardId\": "); + sb.append("\""); + sb.append(shardId); + sb.append("\", "); + sb.append(newline); + sb.append("\"ParentId\": "); + sb.append("\""); + sb.append(parentId); + sb.append("\", "); + sb.append(newline); + sb.append("\"ParentSiblingId\": "); + sb.append("\""); + sb.append(parentSiblingId); + sb.append("\""); + sb.append(newline); + sb.append("}"); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ShardId: "); + sb.append(shardId); + sb.append(", ParentId: "); + sb.append(parentId); + sb.append(", ParentSiblingId: "); + sb.append(parentSiblingId); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/StreamSpecification.java b/src/main/java/com/alicloud/openservices/tablestore/model/StreamSpecification.java new file mode 100644 index 0000000..293e2e2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/StreamSpecification.java @@ -0,0 +1,123 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class StreamSpecification implements Jsonizable { + + /** + * 是否开启Stream + */ + private boolean enableStream = false; + + /** + * 当开启Stream时,该参数用于设置数据过期时间,单位为小时。 + */ + private OptionalValue expirationTime = new OptionalValue("ExpirationTime"); + + /** + * 构造一个StreamSpecification对象。 + * 注意:传入的enableStream必须为false,原因是当enableStream为true时,必须指定expirationTime。 + * 如果需要设置开启Stream,请使用另一构造函数。 + * @param enableStream 必须为false,代表关闭Stream + */ + public StreamSpecification(boolean enableStream) { + if (enableStream) { + throw new ClientException("Expiration time is required when enableStream is true."); + } + setEnableStream(enableStream); + } + + /** + * 构造一个StreamSpecification对象。 + * 注意:传入的enableStream必须为true,原因是当enableStream为false时,不能指定expirationTime。 + * 如果需要设置关闭Stream,请使用另一构造函数。 + * @param enableStream 必须为true,代表开启Stream + * @param expirationTime 单位为小时,必须大于0 + */ + public StreamSpecification(boolean enableStream, int expirationTime) { + if (!enableStream) { + throw new ClientException("Expiration time cannot be set when enableStream is false."); + } + setEnableStream(enableStream); + setExpirationTime(expirationTime); + } + + /** + * 返回是否开启Stream + * + * @return + */ + public boolean isEnableStream() { + return enableStream; + } + + /** + * 设置是否开启Stream + * + * @param enableStream + */ + public void setEnableStream(boolean enableStream) { + this.enableStream = enableStream; + } + + /** + * 获取expirationTime参数,单位为小时 + * + * @return expirationTime,若返回-1,代表该值未设置。 + */ + public int getExpirationTime() { + if (expirationTime.isValueSet()) { + return expirationTime.getValue(); + } else { + return -1; + } + } + + /** + * 设置expirationTime参数,单位为小时 + * + * @param expirationTime + */ + public void setExpirationTime(int expirationTime) { + Preconditions.checkArgument(expirationTime > 0, "The expiration time must be greater than 0."); + this.expirationTime.setValue(expirationTime); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"EnableStream\": "); + sb.append(enableStream); + if (expirationTime.isValueSet()) { + sb.append(","); + sb.append(newline); + sb.append("\"ExpirationTime\": "); + sb.append(expirationTime.getValue()); + sb.append(newline); + } + sb.append("}"); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("EnableStream: "); + sb.append(enableStream); + if (expirationTime.isValueSet()) { + sb.append(", ExpirationTime: "); + sb.append(expirationTime.getValue()); + } + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/StreamStatus.java b/src/main/java/com/alicloud/openservices/tablestore/model/StreamStatus.java new file mode 100644 index 0000000..0d55a91 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/StreamStatus.java @@ -0,0 +1,9 @@ +package com.alicloud.openservices.tablestore.model; + +public enum StreamStatus { + + ENABLING, + + ACTIVE + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/TableMeta.java b/src/main/java/com/alicloud/openservices/tablestore/model/TableMeta.java new file mode 100755 index 0000000..2b262f8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/TableMeta.java @@ -0,0 +1,340 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +import java.util.*; + +/** + * 表的结构信息,包含表的名称以及表的主键定义。 + */ +public class TableMeta implements Jsonizable { + /** + * 表的名称。 + */ + private String tableName; + + /** + * 表的主键定义。 + * 字典内的主键是有顺序的,顺序与用户添加主键的顺序相同。 + */ + private List primaryKey = new ArrayList(); + + private Map primaryKeySchemaMap; + + /** + * 表的预定义列定义。 + */ + private List definedColumns = new ArrayList(); + + private Map definedColumnsSchemaMap; + + /** + * 创建一个新的给定表名的TableMeta实例。 + * + * @param tableName 表名。 + */ + public TableMeta(String tableName) { + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), "The name of table should not be null or empty."); + this.tableName = tableName; + } + + /** + * 返回表的名称。 + * + * @return 表的名称。 + */ + public String getTableName() { + return tableName; + } + + /** + * 设置表的名称。 + * + * @param tableName 表的名称。 + */ + public void setTableName(String tableName) { + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), "The name of table should not be null or empty."); + + this.tableName = tableName; + } + + /** + * 返回主键的列名与类型的对应字典,该字典的遍历顺序与表中主键的顺序一致。 + * + * @return 主键的列名与类型对应的字典。 + */ + public Map getPrimaryKeyMap() { + Map result = new LinkedHashMap(); + for (PrimaryKeySchema key : primaryKey) { + result.put(key.getName(), key.getType()); + } + return result; + } + + /** + * 返回主键的列名与类型定义的对应字典,该字典的遍历顺序与表中主键的顺序一致。 + * + * @return 主键的列名与类型定义对应的字典。 + */ + public Map getPrimaryKeySchemaMap() { + if (primaryKeySchemaMap == null) { + Map temp = new LinkedHashMap(); + for (PrimaryKeySchema key : primaryKey) { + temp.put(key.getName(), key); + } + primaryKeySchemaMap = temp; + } + + return Collections.unmodifiableMap(primaryKeySchemaMap); + } + + /** + * 返回包含所有主键列定义的只读列表。 + * + * @return 包含所有主键列定义的只读列表。 + */ + public List getPrimaryKeyList() { + return Collections.unmodifiableList(primaryKey); + } + + /** + * 添加一个主键列。 + *

最终创建的表中主键的顺序与用户添加主键的顺序相同。

+ * + * @param name 主键列的名称。 + * @param type 主键列的数据类型。 + */ + public void addPrimaryKeyColumn(String name, PrimaryKeyType type) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of primary key should not be null or empty."); + Preconditions.checkNotNull(type, "The type of primary key should not be null."); + + this.primaryKey.add(new PrimaryKeySchema(name, type)); + primaryKeySchemaMap = null; + } + + /** + * 添加一个主键列。 + *

最终创建的表中主键的顺序与用户添加主键的顺序相同。

+ * + * @param name 主键列的名称。 + * @param type 主键列的数据类型。 + * @param option 主键列的属性。 + */ + public void addPrimaryKeyColumn(String name, PrimaryKeyType type, PrimaryKeyOption option) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of primary key should not be null or empty."); + Preconditions.checkNotNull(type, "The type of primary key should not be null."); + Preconditions.checkNotNull(option, "The option of primary key should not be null."); + + this.primaryKey.add(new PrimaryKeySchema(name, type, option)); + primaryKeySchemaMap = null; + } + + /** + * 添加一个主键自增列。 + *

最终创建的表中主键的顺序与用户添加主键的顺序相同。

+ * + * @param name 主键自增列的名称。 + */ + public void addAutoIncrementPrimaryKeyColumn(String name) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of primary key should not be null or empty."); + + this.primaryKey.add(new PrimaryKeySchema(name, PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + primaryKeySchemaMap = null; + } + + /** + * 添加一个主键列。 + *

最终创建的表中主键的顺序与用户添加主键的顺序相同。

+ * + * @param key 主键列的定义 + */ + public void addPrimaryKeyColumn(PrimaryKeySchema key) { + Preconditions.checkNotNull(key, "The primary key schema should not be null."); + this.primaryKey.add(key); + primaryKeySchemaMap = null; + } + + /** + * 添加一组主键列。 + *

最终创建的表中主键的顺序与用户添加主键的顺序相同。

+ * + * @param pks 主键列的定义 + */ + public void addPrimaryKeyColumns(List pks) { + Preconditions.checkArgument(pks != null && !pks.isEmpty(), "The primary key schema should not be null or empty."); + this.primaryKey.addAll(pks); + primaryKeySchemaMap = null; + } + + /** + * 添加一组主键列。 + *

最终创建的表中主键的顺序与用户添加主键的顺序相同。

+ * + * @param pks 主键列的定义 + */ + public void addPrimaryKeyColumns(PrimaryKeySchema[] pks) { + Preconditions.checkArgument(pks != null && pks.length != 0, "The primary key schema should not be null or empty."); + Collections.addAll(this.primaryKey, pks); + primaryKeySchemaMap = null; + } + + /** + * 返回预定义列的列名与类型的对应字典。 + * + * @return 预定义列的列名与类型对应的字典。 + */ + public Map getDefinedColumnMap() { + Map result = new LinkedHashMap(); + for (DefinedColumnSchema key : definedColumns) { + result.put(key.getName(), key.getType()); + } + return result; + } + + /** + * 返回预定义列的列名与类型定义的对应字典。 + * + * @return 预定义列的列名与类型定义对应的字典。 + */ + public Map getDefinedColumnSchemaMap() { + if (definedColumnsSchemaMap == null) { + Map temp = new LinkedHashMap(); + for (DefinedColumnSchema key : definedColumns) { + temp.put(key.getName(), key); + } + definedColumnsSchemaMap = temp; + } + + return Collections.unmodifiableMap(definedColumnsSchemaMap); + } + + /** + * 返回包含所有预定义列定义的只读列表。 + * + * @return 包含所有预定义列定义的只读列表。 + */ + public List getDefinedColumnsList() { + return Collections.unmodifiableList(definedColumns); + } + + /** + * 添加一个预定义列。 + * + * @param name 预定义列的名称。 + * @param type 预定义列的数据类型。 + */ + public void addDefinedColumn(String name, DefinedColumnType type) { + Preconditions.checkArgument(name != null && !name.isEmpty(), "The name of defined column should not be null or empty."); + Preconditions.checkNotNull(type, "The type of defined column should not be null."); + + this.definedColumns.add(new DefinedColumnSchema(name, type)); + definedColumnsSchemaMap = null; + } + + /** + * 添加一个预定义列。 + * + * @param column 预定义列的定义 + */ + public void addDefinedColumn(DefinedColumnSchema column) { + Preconditions.checkNotNull(column, "The defined column schema should not be null."); + this.definedColumns.add(column); + definedColumnsSchemaMap = null; + } + + /** + * 添加一组预定义列。 + * + * @param columns 预定义列的定义 + */ + public void addDefinedColumns(List columns) { + Preconditions.checkArgument(columns != null && !columns.isEmpty(), "The defined column schema should not be null or empty."); + this.definedColumns.addAll(columns); + definedColumnsSchemaMap = null; + } + + /** + * 添加一组预定义列。 + * + * @param columns 预定义列的定义 + */ + public void addDefinedColumns(DefinedColumnSchema[] columns) { + Preconditions.checkArgument(columns != null && columns.length != 0, "The defined column schema should not be null or empty."); + Collections.addAll(this.definedColumns, columns); + definedColumnsSchemaMap = null; + } + + @Override + public String toString() { + String s = "TableName: " + tableName + ", PrimaryKeySchema: "; + boolean first = true; + for (PrimaryKeySchema pk : primaryKey) { + if (first) { + first = false; + } else { + s += ","; + } + s += pk.toString(); + } + s += ", DefinedColumnSchema: "; + first = true; + for (DefinedColumnSchema defCol : definedColumns) { + if (first) { + first = false; + } else { + s += ","; + } + s += defCol.toString(); + } + return s; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"TableName\": \""); + sb.append(tableName); + sb.append('\"'); + sb.append(","); + sb.append(newline); + sb.append("\"PrimaryKey\": ["); + String curNewLine = newline + " "; + sb.append(curNewLine); + ListIterator iter = primaryKey.listIterator(); + if (iter.hasNext()) { + PrimaryKeySchema pk = iter.next(); + pk.jsonize(sb, curNewLine); + } + for(; iter.hasNext(); ) { + sb.append(","); + sb.append(curNewLine); + PrimaryKeySchema pk = iter.next(); + pk.jsonize(sb, curNewLine); + } + sb.append("],"); + sb.append(newline); + sb.append("\"DefinedColumn\": ["); + sb.append(curNewLine); + ListIterator defColIter = definedColumns.listIterator(); + if (defColIter.hasNext()) { + DefinedColumnSchema defCol = defColIter.next(); + defCol.jsonize(sb, curNewLine); + } + for(; defColIter.hasNext(); ) { + sb.append(","); + sb.append(newline); + DefinedColumnSchema defCol = defColIter.next(); + defCol.jsonize(sb, curNewLine); + } + sb.append("]}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/TableOptions.java b/src/main/java/com/alicloud/openservices/tablestore/model/TableOptions.java new file mode 100644 index 0000000..ba18b8b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/TableOptions.java @@ -0,0 +1,220 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +/** + * 表的配置选项,用于配置TTL、MaxVersions. + *

TTL: TimeToLive的缩写, TableStore支持数据自动过期, TimeToLive即为数据的存活时间.

+ * 服务端根据当前时间, 每列每个版本的版本号, 表的TTL设置决定该列该版本是否过期, 过期的数据会自动清理. + *

MaxVersions: TableStore每行每列中, 最多保存的版本数. 当写入的版本超过MaxVersions时, TableStore只保留版本号最大的MaxVersions个版本.

+ *

MaxTimeDeviation: TableStore写入数据所指定的版本与系统时间的偏差允许的最大值,不允许写入与系统偏差大于MaxTimeDeviation的数据。

+ */ +public class TableOptions implements Jsonizable { + /** + * 表数据的TTL时间,单位为秒。 + * 在表创建后,该配置项可通过调用{@link com.alicloud.openservices.tablestore.SyncClient#updateTable(UpdateTableRequest)}动态更改。 + */ + private OptionalValue timeToLive = new OptionalValue("TimeToLive"); + + /** + * 属性列的最大保留版本数。 + * 在表创建后,该配置项可通过调用{@link com.alicloud.openservices.tablestore.SyncClient#updateTable(UpdateTableRequest)}动态更改。 + */ + private OptionalValue maxVersions = new OptionalValue("MaxVersions"); + + /** + * 指定版本写入数据时所指定的版本与系统当前时间偏差允许的最大值,单位为秒。 + * 不允许写入该偏差范围外的数据。 + * 在表创建后,该配置项可通过调用{@link com.alicloud.openservices.tablestore.SyncClient#updateTable(UpdateTableRequest)}动态更改。 + */ + private OptionalValue maxTimeDeviation = new OptionalValue("MaxTimeDeviation"); + + /** + * 构造TableOptions对象。 + */ + public TableOptions() { + } + + /** + * 构造TableOptions对象。 + * + * @param timeToLive TTL时间 + */ + public TableOptions(int timeToLive) { + setTimeToLive(timeToLive); + } + + /** + * 构造TableOptions对象。 + * + * @param timeToLive TTL时间 + * @param maxVersions 最大保留版本数 + */ + public TableOptions(int timeToLive, int maxVersions) { + setTimeToLive(timeToLive); + setMaxVersions(maxVersions); + } + + /** + * 构造TableOptions对象。 + * + * @param timeToLive TTL时间 + * @param maxVersions 最大保留版本数 + * @param maxTimeDeviation 允许写入的指定版本与系统时间最大偏差 + */ + public TableOptions(int timeToLive, int maxVersions, long maxTimeDeviation) { + setTimeToLive(timeToLive); + setMaxVersions(maxVersions); + setMaxTimeDeviation(maxTimeDeviation); + } + + /** + * 获取TTL时间,单位为秒。 + * + * @return TTL时间 + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public int getTimeToLive() { + if (!timeToLive.isValueSet()) { + throw new IllegalStateException("The value of TimeToLive is not set."); + } + return timeToLive.getValue(); + } + + /** + * 设置表数据的TTL时间,单位为秒。 + * + * @param timeToLive TTL时间,单位为秒 + */ + public void setTimeToLive(int timeToLive) { + Preconditions.checkArgument(timeToLive > 0 || timeToLive == -1, + "The value of timeToLive can be -1 or any positive value."); + this.timeToLive.setValue(timeToLive); + } + + /** + * 查询是否调用{@link #setTimeToLive(int)}设置了TTL。 + * + * @return 是否有设置TTL。 + */ + public boolean hasSetTimeToLive() { + return this.timeToLive.isValueSet(); + } + + /** + * 获取最大版本数。 + * + * @return 最大版本数 + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public int getMaxVersions() { + if (!maxVersions.isValueSet()) { + throw new IllegalStateException("The value of MaxVersions is not set."); + } + return maxVersions.getValue(); + } + + /** + * 设置最大版本数。 + * + * @param maxVersions 最大版本数 + */ + public void setMaxVersions(int maxVersions) { + Preconditions.checkArgument(maxVersions > 0, "MaxVersions must be greater than 0."); + this.maxVersions.setValue(maxVersions); + } + + /** + * 查询是否调用{@link #setMaxVersions(int)}设置了MaxVerisons。 + * + * @return 是否有设置MaxVersions。 + */ + public boolean hasSetMaxVersions() { + return maxVersions.isValueSet(); + } + + /** + * 获取允许的指定版本写入数据时所指定的版本与系统当前时间的最大偏差。 + * + * @return 最大偏差 + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public long getMaxTimeDeviation() { + if (!maxTimeDeviation.isValueSet()) { + throw new IllegalStateException("The value of MaxTimeDeviation is not set."); + } + return maxTimeDeviation.getValue(); + } + + /** + * 设置允许的指定版本写入数据时所指定的版本与系统当前时间的最大偏差。 + * + * @param maxTimeDeviation 最大偏差,单位秒 + */ + public void setMaxTimeDeviation(long maxTimeDeviation) { + Preconditions.checkArgument(maxTimeDeviation > 0, "MaxTimeDeviation must be greater than 0."); + this.maxTimeDeviation.setValue(maxTimeDeviation); + } + + /** + * 查询是否调用{@link #setMaxTimeDeviation(long)}设置了MaxTimeDeviation。 + * + * @return 是否有设置MaxTimeDeviation。 + */ + public boolean hasSetMaxTimeDeviation() { + return maxTimeDeviation.isValueSet(); + } + + @Override + public String toString() { + return timeToLive + ", " + maxVersions + ", " + maxTimeDeviation; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{"); + this.jsonizeFields(sb, true); + sb.append("}"); + } + + protected boolean jsonizeFields(StringBuilder sb, boolean firstItem) { + if (this.timeToLive.isValueSet()) { + if (firstItem) { + firstItem = false; + } else { + sb.append(", "); + } + sb.append("\"TimeToLive\": "); + sb.append(this.timeToLive.getValue()); + } + if (this.maxVersions.isValueSet()) { + if (firstItem) { + firstItem = false; + } else { + sb.append(", "); + } + sb.append("\"MaxVersions\": "); + sb.append(this.maxVersions.getValue()); + } + if (this.maxTimeDeviation.isValueSet()) { + if (firstItem) { + firstItem = false; + } else { + sb.append(", "); + } + sb.append("\"MaxTimeDeviation\": "); + sb.append(this.maxTimeDeviation.getValue()); + } + return firstItem; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/TimeRange.java b/src/main/java/com/alicloud/openservices/tablestore/model/TimeRange.java new file mode 100644 index 0000000..1192fff --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/TimeRange.java @@ -0,0 +1,119 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +public class TimeRange { + private long start = 0L; // inclusive + private long end = Long.MAX_VALUE; // exclusive + private boolean eternal = false; + + /** + * 默认构造函数。 + * 默认的时间戳区间为[0, Long.MAX_VALUE)(范围内覆盖所有可写入的时间戳) + */ + public TimeRange() { + this.eternal = true; + } + + /** + * 构造一个时间戳区间为[start, Long.MAX_VALUE)。 + * + * @param start 起始时间戳(inclusive) + */ + public TimeRange(long start) { + Preconditions.checkArgument(start >= 0, "The start timestamp should be greater than 0."); + this.start = start; + } + + /** + * 构造一个时间戳区间为[start, end)。 + * + * @param start 起始时间戳(inclusive) + * @param end 最大时间戳(exclusive) + */ + public TimeRange(long start, long end) { + Preconditions.checkArgument(end > start, "end is smaller than start"); + Preconditions.checkArgument(start >= 0, "The start timestamp should be greater than 0."); + + this.start = start; + this.end = end; + } + + /** + * @return 起始时间戳 + */ + public long getStart() { + return this.start; + } + + /** + * @return 终止时间戳 + */ + public long getEnd() { + return this.end; + } + + /** + * 检查指定时间戳是否在该时间戳区间内。 + * + * @param timestamp 时间戳 + * @return 如果在区间内则返回true,否则返回false + */ + public boolean withinTimeRange(long timestamp) { + if (this.eternal) return true; + // check if >= minStamp + return (this.start <= timestamp && timestamp < this.end); + } + + /** + * 比较时间戳和时间戳范围 + * + * @param timestamp 时间戳 + * @return -1 if timestamp is less than timerange, + * 0 if timestamp is within timerange, + * 1 if timestamp is greater than timerange + */ + public int compare(long timestamp) { + if (timestamp < this.start) { + return -1; + } else if (timestamp >= this.end) { + return 1; + } else { + return 0; + } + } + + /** + * 检查该TimeRange内是否只包含一个版本。 + * + * @return 如果只包含一个版本,则返回true,否则返回false + */ + public boolean containsOnlyOneVersion() { + return this.end - this.start == 1; + } + + @Override + public int hashCode() { + return (int)(this.start * 31 + this.end); + } + + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof TimeRange)) { + return false; + } + + TimeRange target = (TimeRange) o; + return target.start == this.start && target.end == this.end; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("start="); + sb.append(this.start); + sb.append(", end="); + sb.append(this.end); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/TxnRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/TxnRequest.java new file mode 100644 index 0000000..62797e6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/TxnRequest.java @@ -0,0 +1,42 @@ +package com.alicloud.openservices.tablestore.model; + + +import com.alicloud.openservices.tablestore.core.utils.OptionalValue; + +public abstract class TxnRequest implements Request{ + /** + * 事务ID。 + */ + private OptionalValue transactionId = new OptionalValue("TransactionId"); + + /** + * 设置本次事务的ID。 + * + * @param transactionId 本次事务的ID + */ + public void setTransactionId(String transactionId) { + this.transactionId.setValue(transactionId); + } + + /** + * 获取TransactionId的设置的值。 + * + * @return TransactionId + * @throws java.lang.IllegalStateException 若没有配置该参数 + */ + public String getTransactionId() { + if (!this.transactionId.isValueSet()) { + throw new IllegalStateException("The value of TransactionId is not set."); + } + return this.transactionId.getValue(); + } + + /** + * 查询是否设置了TransactionId。 + * + * @return 若设置了TransactionId,则返回true,否则返回false。 + */ + public boolean hasSetTransactionId() { + return this.transactionId.isValueSet(); + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/model/UpdateRowRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateRowRequest.java similarity index 58% rename from src/main/java/com/aliyun/openservices/ots/model/UpdateRowRequest.java rename to src/main/java/com/alicloud/openservices/tablestore/model/UpdateRowRequest.java index c8933a6..10538d0 100755 --- a/src/main/java/com/aliyun/openservices/ots/model/UpdateRowRequest.java +++ b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateRowRequest.java @@ -1,8 +1,8 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; -public class UpdateRowRequest { +public class UpdateRowRequest extends TxnRequest { /** * UpdateRow操作的请求参数。 @@ -17,6 +17,11 @@ public UpdateRowRequest(RowUpdateChange rowChange) { setRowChange(rowChange); } + @Override + public String getOperationName() { + return OperationNames.OP_UPDATE_ROW; + } + /** * 获取UpdateRow的请求参数。 * @return UpdateRow的请求参数。 @@ -27,10 +32,10 @@ public RowUpdateChange getRowChange() { /** * 设置UpdateRow的请求参数。 - * @param rowChange + * @param rowChange UpdateRow的请求参数。 */ public void setRowChange(RowUpdateChange rowChange) { - assertParameterNotNull(rowChange, "rowChange"); + Preconditions.checkNotNull(rowChange, "The row change for UpdateRow should not be null."); this.rowChange = rowChange; } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/UpdateRowResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateRowResponse.java new file mode 100755 index 0000000..a41988d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateRowResponse.java @@ -0,0 +1,50 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class UpdateRowResponse extends Response implements Jsonizable { + /** + * 此次操作消耗的能力单元。 + */ + private ConsumedCapacity consumedCapacity; + + /** + * ReturnType指定返回的值。 + */ + private Row row; + + public UpdateRowResponse(Response meta, Row row, ConsumedCapacity consumedCapacity) { + super(meta); + Preconditions.checkNotNull(consumedCapacity); + this.row = row; + this.consumedCapacity = consumedCapacity; + } + + /** + * 获取此次操作消耗的能力单元。 + * + * @return 此次操作消耗的能力单元。 + */ + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append("{\"ConsumedCapacity\": "); + consumedCapacity.jsonize(sb, newline + " "); + sb.append("}"); + } + + public Row getRow() { + return row; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableRequest.java new file mode 100755 index 0000000..59e6864 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableRequest.java @@ -0,0 +1,118 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; + +/** + * UpdateTableRequest包含更新一张表所必需的一些参数,包括表的名称、预留吞吐量更改和表的配置更改等。 + *

用户通过UpdateTable可以单独对预留吞吐量进行更改或者单独对表部分配置项进行更改,或者一起。

+ */ +public class UpdateTableRequest implements Request { + + /** + * 表的名称。 + */ + private String tableName; + + /** + * 表的预留吞吐量变更。 + * 可以单独更改读能力单元或者写能力单元。 + */ + private ReservedThroughput reservedThroughputForUpdate; + + /** + * 表的配置参数选项。 + */ + private TableOptions tableOptionsForUpdate; + + /** + * 表的Stream配置变更。 + */ + private StreamSpecification streamSpecification; + + public UpdateTableRequest() { + } + + public UpdateTableRequest(String tableName) { + setTableName(tableName); + } + + /** + * 获取表的名称。 + * + * @return 表的名称。 + */ + public String getTableName() { + Preconditions.checkNotNull(tableName); + return tableName; + } + + /** + * 设置表的名称 + * + * @param tableName 表的名称 + */ + public void setTableName(String tableName) { + Preconditions.checkNotNull(tableName, "tableName must not be null."); + Preconditions.checkArgument(!tableName.isEmpty(), + "The name of table must not be empty."); + this.tableName = tableName; + } + + /** + * 获取表的预留吞吐量变更。 + * + * @return 表的预留吞吐量变更。 + */ + public ReservedThroughput getReservedThroughputForUpdate() { + return reservedThroughputForUpdate; + } + + /** + * 设置表的预留吞吐量变更。 + * + * @param reservedThroughputForUpdate 表的预留吞吐量更改。 + */ + public void setReservedThroughputForUpdate(ReservedThroughput reservedThroughputForUpdate) { + this.reservedThroughputForUpdate = reservedThroughputForUpdate; + } + + /** + * 获取表的参数更改。 + * + * @return 表的参数更改。 + */ + public TableOptions getTableOptionsForUpdate() { + return tableOptionsForUpdate; + } + + /** + * 设置表的参数更改。 + * + * @param tableOptionsForUpdate 表的参数更改。 + */ + public void setTableOptionsForUpdate(TableOptions tableOptionsForUpdate) { + this.tableOptionsForUpdate = tableOptionsForUpdate; + } + + public String getOperationName() { + return OperationNames.OP_UPDATE_TABLE; + } + + /** + * 获取表的Stream配置变更。 + * + * @return 表的Stream配置变更。 + */ + public StreamSpecification getStreamSpecification() { + return streamSpecification; + } + + /** + * 设置表的Stream配置变更。 + * + * @param streamSpecification 表的Stream配置变更。 + */ + public void setStreamSpecification(StreamSpecification streamSpecification) { + this.streamSpecification = streamSpecification; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableResponse.java new file mode 100755 index 0000000..1285a05 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/UpdateTableResponse.java @@ -0,0 +1,91 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +/** + * UpdateTable操作的返回结果,包含预留吞吐量的变更细节以及更改之后表的当前配置参数。 + */ +public class UpdateTableResponse extends Response implements Jsonizable { + /** + * 表当前的预留吞吐量的变更细节信息。 + */ + private ReservedThroughputDetails reservedThroughputDetails; + + /** + * 表的当前配置参数。 + */ + private TableOptions tableOptions; + + /** + * 表的Stream信息。 + */ + private StreamDetails streamDetails; + + public UpdateTableResponse(Response meta) { + super(meta); + } + + /** + * 获取表当前的预留吞吐量的更改信息。 + * + * @return 表当前的预留吞吐量的更改信息。 + */ + public ReservedThroughputDetails getReservedThroughputDetails() { + return reservedThroughputDetails; + } + + public void setReservedThroughputDetails( + ReservedThroughputDetails reservedThroughputDetails) + { + this.reservedThroughputDetails = reservedThroughputDetails; + } + + /** + * 获取表当前的配置参数。 + * + * @return 表的配置参数。 + */ + public TableOptions getTableOptions() { + return tableOptions; + } + + public void setTableOptions(TableOptions tableOptions) { + this.tableOptions = tableOptions; + } + + /** + * 获取表的Stream信息。 + * @return 表的Stream信息。 + */ + public StreamDetails getStreamDetails() { + return streamDetails; + } + + public void setStreamDetails(StreamDetails streamDetails) { + this.streamDetails = streamDetails; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"ReservedThroughputDetails\": "); + reservedThroughputDetails.jsonize(sb, newline + " "); + sb.append(","); + sb.append(newline); + sb.append("\"TableOptionsEx\": "); + tableOptions.jsonize(sb, newline + " "); + sb.append(","); + sb.append(newline); + sb.append("\"StreamDetails\": "); + streamDetails.jsonize(sb, newline + " "); + sb.append('}'); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/WideColumnIterator.java b/src/main/java/com/alicloud/openservices/tablestore/model/WideColumnIterator.java new file mode 100644 index 0000000..79f77b5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/WideColumnIterator.java @@ -0,0 +1,30 @@ +package com.alicloud.openservices.tablestore.model; + +public class WideColumnIterator implements IRow { + + private PrimaryKey primaryKey; + private AbstractColumnIteratorImpl columnIteratorImpl; + + public WideColumnIterator(PrimaryKey primaryKey, AbstractColumnIteratorImpl columnIteratorImpl) { + this.primaryKey = primaryKey; + this.columnIteratorImpl = columnIteratorImpl; + } + + @Override + public PrimaryKey getPrimaryKey() { + return primaryKey; + } + + @Override + public int compareTo(IRow o) { + return this.primaryKey.compareTo(o.getPrimaryKey()); + } + + public boolean hasNextColumn() { + return columnIteratorImpl.hasNext(); + } + + public Column nextColumn() { + return columnIteratorImpl.next(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/WideRowIterator.java b/src/main/java/com/alicloud/openservices/tablestore/model/WideRowIterator.java new file mode 100644 index 0000000..2033331 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/WideRowIterator.java @@ -0,0 +1,116 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.InternalClient; +import com.alicloud.openservices.tablestore.core.utils.Pair; + +import java.util.*; + +public class WideRowIterator implements Iterator { + + private InternalClient internalClient; + private RangeIteratorParameter parameter; + private PrimaryKey nextStartPrimaryKey; + private byte[] nextToken; + private int totalCount; + private int bufferSize; + private int rowsRead = 0; + private RowRangeColumnIteratorImpl columnIterator; + private Iterator > rowIterator; + + public WideRowIterator(InternalClient client, RangeIteratorParameter rangeIteratorParameter) { + this.internalClient = client; + this.parameter = rangeIteratorParameter; + this.totalCount = rangeIteratorParameter.getMaxCount(); + this.bufferSize = rangeIteratorParameter.getBufferSize(); + if (this.bufferSize == -1) { + this.bufferSize = this.totalCount; + } else if (totalCount != -1 && bufferSize > totalCount) { + bufferSize = totalCount; + } + this.columnIterator = new RowRangeColumnIteratorImpl(this, null, new ArrayList().iterator(), true); + this.nextStartPrimaryKey = this.parameter.getInclusiveStartPrimaryKey(); + } + + private GetRangeRequest buildRequest() { + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(parameter.getTableName()); + parameter.copyTo(criteria); + criteria.setDirection(parameter.getDirection()); + criteria.setInclusiveStartPrimaryKey(nextStartPrimaryKey); + criteria.setExclusiveEndPrimaryKey(parameter.getExclusiveEndPrimaryKey()); + criteria.setToken(nextToken); + if (bufferSize > 0) { + if (totalCount != -1 && totalCount - rowsRead < bufferSize) { + criteria.setLimit(totalCount - rowsRead); + } else { + criteria.setLimit(bufferSize); + } + } + return new GetRangeRequest(criteria); + } + + void fetchData() { + GetRangeResponse result = null; + try { + result = internalClient.getRange(buildRequest(), null).get(); + } catch (Exception e) { + throw new ClientException(e); + } + + int idx = 0; + List rows = result.getRows(); + if (!columnIterator.isComplete() && (rows.size() > 0) && (rows.get(0).getPrimaryKey().equals(columnIterator.getPrimaryKey()))) { + columnIterator.setColumnIterator(Arrays.asList(rows.get(0).getColumns()).iterator()); + idx = 1; + } + + List> rowsWithStatus = new ArrayList>(); + for (int i = idx; i < rows.size(); i++) { + if ((i == (rows.size() - 1)) && (rows.get(i).getPrimaryKey().equals(result.getNextStartPrimaryKey()))) { + rowsWithStatus.add(new Pair(rows.get(i), false)); + } else { + rowsWithStatus.add(new Pair(rows.get(i), true)); + rowsRead++; + } + } + rowIterator = rowsWithStatus.iterator(); + + nextStartPrimaryKey = result.getNextStartPrimaryKey(); + nextToken = result.getNextToken(); + if (!columnIterator.isComplete()) { + if (!columnIterator.getPrimaryKey().equals(nextStartPrimaryKey)) { + columnIterator.setComplete(true); + rowsRead++; + } + } + } + + @Override + public boolean hasNext() { + columnIterator.close(); + while ((nextStartPrimaryKey != null) && !rowIterator.hasNext() && (rowsRead < totalCount)) { + fetchData(); + } + if (rowIterator.hasNext()) { + return true; + } + return false; + } + + @Override + public WideColumnIterator next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + Pair rowWithStatus = rowIterator.next(); + Row row = rowWithStatus.getFirst(); + boolean complete = rowWithStatus.getSecond(); + columnIterator = new RowRangeColumnIteratorImpl(this, row.getPrimaryKey(), Arrays.asList(row.getColumns()).iterator(), complete); + return new WideColumnIterator(row.getPrimaryKey(), columnIterator); + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnCondition.java b/src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnCondition.java new file mode 100644 index 0000000..c0afd05 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnCondition.java @@ -0,0 +1,17 @@ +package com.alicloud.openservices.tablestore.model.condition; + +import com.google.protobuf.ByteString; + +/** + * TableStore支持条件更新功能, 在进行PutRow, UpdateRow, DeleteRow或BatchWriteRow操作时, 可以设置条件{@link com.alicloud.openservices.tablestore.model.Condition}. + * Condition包括行存在性条件{@link com.alicloud.openservices.tablestore.model.RowExistenceExpectation}和列条件{@link ColumnCondition}. + * + * {@link ColumnCondition}目前包括{@link SingleColumnValueCondition} 和 {@link CompositeColumnValueCondition}, + * 前者用于设置某一列值的条件, 比如条件为"列A的值大于0", 后者可以设置组合列值条件, 比如" 列A的值大于0 且 列B的值小于'abc' ". + */ +public interface ColumnCondition { + + ColumnConditionType getConditionType(); + + ByteString serialize(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnConditionType.java b/src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnConditionType.java new file mode 100644 index 0000000..54cae9d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/condition/ColumnConditionType.java @@ -0,0 +1,6 @@ +package com.alicloud.openservices.tablestore.model.condition; + +public enum ColumnConditionType { + COMPOSITE_COLUMN_VALUE_CONDITION, + SINGLE_COLUMN_VALUE_CONDITION; +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/condition/CompositeColumnValueCondition.java b/src/main/java/com/alicloud/openservices/tablestore/model/condition/CompositeColumnValueCondition.java new file mode 100644 index 0000000..c6b776c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/condition/CompositeColumnValueCondition.java @@ -0,0 +1,112 @@ +package com.alicloud.openservices.tablestore.model.condition; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.filter.CompositeColumnValueFilter; +import com.google.protobuf.ByteString; + +import java.util.ArrayList; +import java.util.List; + +/** + * 组合列值条件, 用于TableStore的条件更新功能. + * {@link CompositeColumnValueCondition}可以对{@link SingleColumnValueCondition}或{@link CompositeColumnValueCondition}进行逻辑条件组合, 有NOT、AND和OR三种逻辑关系条件,其中NOT和AND表示二元或多元的关系,NOT只表示一元的关系。 + *

逻辑关系通过构造函数{@link CompositeColumnValueCondition#CompositeColumnValueCondition(CompositeColumnValueCondition.LogicOperator)}的参数提供。

+ *

若逻辑关系为{@link CompositeColumnValueCondition.LogicOperator#NOT},可以通过{@link CompositeColumnValueCondition#addCondition(ColumnCondition)}添加ColumnCondition,但是添加的ColumnCondition有且只有一个。

+ *

若逻辑关系为{@link CompositeColumnValueCondition.LogicOperator#AND},可以通过{@link CompositeColumnValueCondition#addCondition(ColumnCondition)}添加ColumnCondition,添加的ColumnCondition必须大于等于两个。

+ *

若逻辑关系为{@link CompositeColumnValueCondition.LogicOperator#OR},可以通过{@link CompositeColumnValueCondition#addCondition(ColumnCondition)}添加ColumnCondition,但是添加的ColumnCondition必须大于等于两个。

+ */ +public class CompositeColumnValueCondition implements ColumnCondition { + + public enum LogicOperator { + NOT, AND, OR; + } + + private LogicOperator type; + private List conditions; + + public CompositeColumnValueCondition(LogicOperator loType) { + Preconditions.checkNotNull(loType, "The operation type should not be null."); + this.type = loType; + this.conditions = new ArrayList(); + } + + /** + * 增加逻辑关系组中的ColumnCondition。 + *

若逻辑关系为{@link CompositeColumnValueCondition.LogicOperator#NOT},有且只能添加一个ColumnCondition。

+ *

若逻辑关系为{@link CompositeColumnValueCondition.LogicOperator#AND},必须添加至少两个ColumnCondition。

+ *

若逻辑关系为{@link CompositeColumnValueCondition.LogicOperator#OR},必须添加至少两个ColumnCondition。

+ * + * @param condition + * @return + */ + public CompositeColumnValueCondition addCondition(ColumnCondition condition) { + Preconditions.checkNotNull(condition, "The condition should not be null."); + this.conditions.add(condition); + return this; + } + + /** + * 清空逻辑关系组中的所有ColumnCondition。 + */ + public void clear() { + this.conditions.clear(); + } + + /** + * 查看当前设置的逻辑关系。 + * + * @return 逻辑关系符号。 + */ + public LogicOperator getOperationType() { + return this.type; + } + + /** + * 返回逻辑关系组中的所有ColumnCondition。 + * + * @return 所有ColumnCondition。 + */ + public List getSubConditions() { + return this.conditions; + } + + @Override + public ColumnConditionType getConditionType() { + return ColumnConditionType.COMPOSITE_COLUMN_VALUE_CONDITION; + } + + public CompositeColumnValueFilter toFilter() { + CompositeColumnValueFilter.LogicOperator logicOperator; + switch (type) { + case NOT: + logicOperator = CompositeColumnValueFilter.LogicOperator.NOT; + break; + case AND: + logicOperator = CompositeColumnValueFilter.LogicOperator.AND; + break; + case OR: + logicOperator = CompositeColumnValueFilter.LogicOperator.OR; + break; + default: + throw new ClientException("Unknown logicOperator: " + type.name()); + } + CompositeColumnValueFilter compositeColumnValueFilter = new CompositeColumnValueFilter(logicOperator); + for (ColumnCondition condition : getSubConditions()) { + if (condition instanceof SingleColumnValueCondition) { + compositeColumnValueFilter.addFilter(((SingleColumnValueCondition) condition).toFilter()); + } else if (condition instanceof CompositeColumnValueCondition) { + compositeColumnValueFilter.addFilter(((CompositeColumnValueCondition) condition).toFilter()); + } else { + throw new ClientException("Unknown condition type: " + condition.getConditionType()); + } + } + return compositeColumnValueFilter; + } + + @Override + public ByteString serialize() { + return OTSProtocolBuilder.buildCompositeColumnValueFilter(toFilter()); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/condition/SingleColumnValueCondition.java b/src/main/java/com/alicloud/openservices/tablestore/model/condition/SingleColumnValueCondition.java new file mode 100644 index 0000000..705f00a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/condition/SingleColumnValueCondition.java @@ -0,0 +1,198 @@ +package com.alicloud.openservices.tablestore.model.condition; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import com.google.protobuf.ByteString; + +/** + * 单行列值条件,用于TableStore的条件更新功能, 可以设置列值与设定值的大小关系条件. + *

支持的比较关系包括:EQUAL(=), NOT_EQUAL(!=), GREATER_THAN(>), GREATER_EQUAL(>=), LESS_THAN(<)以及LESS_EQUAL(<=)。

+ *

由于TableStore一行的属性列不固定,有可能存在条件中的列在该行不存在的情况,这时{@link SingleColumnValueCondition#passIfMissing}参数控制在这种情况下条件是否通过。

+ * 如果设置{@link SingleColumnValueCondition#passIfMissing}为true,则若列在该行中不存在,则条件通过; + * 如果设置{@link SingleColumnValueCondition#passIfMissing}为false,则若列在该行中不存在,则条件不通过。 + * 默认值为true。 + *

由于TableStore的属性列可能有多个版本,有可能存在该列的一个版本的值与给定值匹配但是另一个版本的值不匹配的情况, + * 这时{@link SingleColumnValueCondition#latestVersionsOnly}参数控制在这种情况下对该行的过滤结果。 + * 如果设置{@link SingleColumnValueCondition#latestVersionsOnly}为true,则只会对最新版本的值进行比较, 默认值为true. + * 需要注意的是, 如果{@link SingleColumnValueCondition#latestVersionsOnly}为false, 会对该列的所有版本(最新的max_versions个)进行比较,只要有一个版本的值匹配就认为条件成立。

+ */ +public class SingleColumnValueCondition implements ColumnCondition { + + public enum CompareOperator { + EQUAL, NOT_EQUAL, GREATER_THAN, GREATER_EQUAL, LESS_THAN, LESS_EQUAL; + } + + private CompareOperator operator; + private String columnName; + private ColumnValue columnValue; + private boolean passIfMissing = true; + private boolean latestVersionsOnly = true; + + /** + * 构造函数。 + * + * @param columnName 列的名称 + * @param operator 比较函数 + * @param columnValue 列的值 + */ + public SingleColumnValueCondition(String columnName, final CompareOperator operator, final ColumnValue columnValue) { + setColumnName(columnName); + setOperator(operator); + setColumnValue(columnValue); + } + + /** + * 获取列的比较操作符。 + * + * @return 比较操作符。 + */ + public CompareOperator getOperator() { + return operator; + } + + /** + * 设置列的比较操作符。 + * + * @param operator 比较操作符 + * @return this for chain invocation + */ + public SingleColumnValueCondition setOperator(CompareOperator operator) { + Preconditions.checkNotNull(operator, "The operator should not be null."); + this.operator = operator; + return this; + } + + /** + * 获取列名。 + * + * @return 列的名称。 + */ + public String getColumnName() { + return columnName; + } + + /** + * 设置列的名称。 + * + * @param columnName 列的名称 + * @return this for chain invocation + */ + public SingleColumnValueCondition setColumnName(String columnName) { + Preconditions.checkArgument(columnName != null && !columnName.isEmpty(), "The name of column should not be null or empty."); + this.columnName = columnName; + return this; + } + + /** + * 获取列的对比值。 + * + * @return 列的对比值。 + */ + public ColumnValue getColumnValue() { + return columnValue; + } + + /** + * 设置列的对比值。 + * + * @param columnValue 列的对比值。 + * @return this for chain invocation + */ + public SingleColumnValueCondition setColumnValue(ColumnValue columnValue) { + Preconditions.checkNotNull(columnValue, "The value of column should not be null."); + this.columnValue = columnValue; + return this; + } + + /** + * 返回设置的passIfMissing的值。 + * + * @return passIfMissing的值。 + */ + public boolean isPassIfMissing() { + return passIfMissing; + } + + /** + * 设置passIfMissing。 + *

由于TableStore一行的属性列不固定,有可能存在条件中的列在该行不存在的情况,这时{@link SingleColumnValueCondition#passIfMissing}参数控制在这种情况下条件是否通过。

+ *

如果设置{@link SingleColumnValueCondition#passIfMissing}为true,则若列在该行中不存在,则条件通过;

+ *

如果设置{@link SingleColumnValueCondition#passIfMissing}为false,则若列在该行中不存在,则条件不通过。

+ *

默认值为true。

+ * + * @param passIfMissing + * @return this for chain invocation + */ + public SingleColumnValueCondition setPassIfMissing(boolean passIfMissing) { + this.passIfMissing = passIfMissing; + return this; + } + + /** + * 返回设置的latestVersionsOnly的值。 + * + * @return latestVersionsOnly的值。 + */ + public boolean isLatestVersionsOnly() { + return latestVersionsOnly; + } + + /** + * 设置latestVersionsOnly。 + *

由于TableStore的属性列可能有多个版本,有可能存在该列的一个版本的值与给定值匹配但是另一个版本的值不匹配的情况,

+ *

这时{@link SingleColumnValueCondition#latestVersionsOnly}参数控制在这种情况下对该行的过滤结果。

+ *

如果设置{@link SingleColumnValueCondition#latestVersionsOnly}为true,则只会对最新版本的值进行比较, 默认值为true.

+ *

需要注意的是, 如果{@link SingleColumnValueCondition#latestVersionsOnly}为false, 会对该列的所有版本(最新的max_versions个)进行比较,只要有一个版本的值匹配就认为条件成立。

+ * + * @param latestVersionsOnly + * @return + */ + public SingleColumnValueCondition setLatestVersionsOnly(boolean latestVersionsOnly) { + this.latestVersionsOnly = latestVersionsOnly; + return this; + } + + @Override + public ColumnConditionType getConditionType() { + return ColumnConditionType.SINGLE_COLUMN_VALUE_CONDITION; + } + + public SingleColumnValueFilter toFilter() { + SingleColumnValueFilter.CompareOperator filterOperator; + switch (operator) { + case EQUAL: + filterOperator = SingleColumnValueFilter.CompareOperator.EQUAL; + break; + case NOT_EQUAL: + filterOperator = SingleColumnValueFilter.CompareOperator.NOT_EQUAL; + break; + case GREATER_THAN: + filterOperator = SingleColumnValueFilter.CompareOperator.GREATER_THAN; + break; + case GREATER_EQUAL: + filterOperator = SingleColumnValueFilter.CompareOperator.GREATER_EQUAL; + break; + case LESS_THAN: + filterOperator = SingleColumnValueFilter.CompareOperator.LESS_THAN; + break; + case LESS_EQUAL: + filterOperator = SingleColumnValueFilter.CompareOperator.LESS_EQUAL; + break; + default: + throw new ClientException("Unknown operator: " + operator.name()); + } + + SingleColumnValueFilter singleColumnValueFilter = new SingleColumnValueFilter(columnName, filterOperator, columnValue); + singleColumnValueFilter.setLatestVersionsOnly(latestVersionsOnly); + singleColumnValueFilter.setPassIfMissing(passIfMissing); + return singleColumnValueFilter; + } + + @Override + public ByteString serialize() { + return OTSProtocolBuilder.buildSingleColumnValueFilter(toFilter()); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnPaginationFilter.java b/src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnPaginationFilter.java new file mode 100644 index 0000000..53082df --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnPaginationFilter.java @@ -0,0 +1,46 @@ +package com.alicloud.openservices.tablestore.model.filter; + +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.google.protobuf.ByteString; + +public class ColumnPaginationFilter implements Filter { + + private int limit; + private int offset; + + public ColumnPaginationFilter(int limit) { + this.limit = limit; + this.offset = 0; + } + + public ColumnPaginationFilter(int limit, int offset) { + this.limit = limit; + this.offset = offset; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + @Override + public FilterType getFilterType() { + return FilterType.COLUMN_PAGINATION_FILTER; + } + + @Override + public ByteString serialize() { + return OTSProtocolBuilder.buildColumnPaginationFilter(this); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnValueFilter.java b/src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnValueFilter.java new file mode 100644 index 0000000..60a3b8e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/filter/ColumnValueFilter.java @@ -0,0 +1,5 @@ +package com.alicloud.openservices.tablestore.model.filter; + +public abstract class ColumnValueFilter implements Filter { + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/filter/CompositeColumnValueFilter.java b/src/main/java/com/alicloud/openservices/tablestore/model/filter/CompositeColumnValueFilter.java new file mode 100644 index 0000000..a9d5cb1 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/filter/CompositeColumnValueFilter.java @@ -0,0 +1,111 @@ +package com.alicloud.openservices.tablestore.model.filter; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.condition.CompositeColumnValueCondition; +import com.google.protobuf.ByteString; + +import java.util.ArrayList; +import java.util.List; + +/** + * TableStore查询操作时使用的过滤器,CompositeColumnValueFilter用于表示ColumnValueFilter之间的逻辑关系条件,主要有NOT、AND和OR三种逻辑关系条件,其中NOT和AND表示二元或多元的关系,NOT只表示一元的关系。 + *

逻辑关系通过构造函数{@link CompositeColumnValueFilter#CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator)}的参数提供。

+ *

若逻辑关系为{@link CompositeColumnValueFilter.LogicOperator#NOT},可以通过{@link CompositeColumnValueFilter#addFilter(ColumnValueFilter)}添加ColumnValueFilter,添加的ColumnValueFilter有且只有一个。

+ *

若逻辑关系为{@link CompositeColumnValueFilter.LogicOperator#AND},可以通过{@link CompositeColumnValueFilter#addFilter(ColumnValueFilter)}添加ColumnValueFilter,添加的ColumnValueFilter必须大于等于两个。

+ *

若逻辑关系为{@link CompositeColumnValueFilter.LogicOperator#OR},可以通过{@link CompositeColumnValueFilter#addFilter(ColumnValueFilter)}添加ColumnValueFilter,添加的ColumnValueFilter必须大于等于两个。

+ */ +public class CompositeColumnValueFilter extends ColumnValueFilter { + + public enum LogicOperator { + NOT, AND, OR; + } + + private LogicOperator type; + private List filters; + + public CompositeColumnValueFilter(LogicOperator loType) { + Preconditions.checkNotNull(loType, "The operation type should not be null."); + this.type = loType; + this.filters = new ArrayList(); + } + + /** + * 增加逻辑关系组中的ColumnValueFilter。 + *

若逻辑关系为{@link CompositeColumnValueFilter.LogicOperator#NOT},有且只能添加一个ColumnValueFilter。

+ *

若逻辑关系为{@link CompositeColumnValueFilter.LogicOperator#AND},必须添加至少两个ColumnValueFilter。

+ *

若逻辑关系为{@link CompositeColumnValueFilter.LogicOperator#OR},必须添加至少两个ColumnValueFilter。

+ * + * @param filter + * @return + */ + public CompositeColumnValueFilter addFilter(ColumnValueFilter filter) { + Preconditions.checkNotNull(filter, "The filter should not be null."); + this.filters.add(filter); + return this; + } + + /** + * 清空逻辑关系组中的所有ColumnValueFilter。 + */ + public void clear() { + this.filters.clear(); + } + + /** + * 查看当前设置的逻辑关系。 + * + * @return 逻辑关系符号。 + */ + public LogicOperator getOperationType() { + return this.type; + } + + /** + * 返回逻辑关系组中的所有ColumnValueFilter。 + * + * @return 所有ColumnValueFilter。 + */ + public List getSubFilters() { + return this.filters; + } + + public CompositeColumnValueCondition toCondition() { + CompositeColumnValueCondition.LogicOperator logicOperator; + switch (type) { + case NOT: + logicOperator = CompositeColumnValueCondition.LogicOperator.NOT; + break; + case AND: + logicOperator = CompositeColumnValueCondition.LogicOperator.AND; + break; + case OR: + logicOperator = CompositeColumnValueCondition.LogicOperator.OR; + break; + default: + throw new ClientException("Unknown logicOperator: " + type.name()); + } + CompositeColumnValueCondition compositeColumnValueCondition = new CompositeColumnValueCondition(logicOperator); + for (Filter filter : getSubFilters()) { + if (filter instanceof SingleColumnValueFilter) { + compositeColumnValueCondition.addCondition(((SingleColumnValueFilter) filter).toCondition()); + } else if (filter instanceof CompositeColumnValueFilter) { + compositeColumnValueCondition.addCondition(((CompositeColumnValueFilter) filter).toCondition()); + } else { + throw new ClientException("Unknown filter type: " + filter.getFilterType()); + } + } + return compositeColumnValueCondition; + } + + @Override + public FilterType getFilterType() { + return FilterType.COMPOSITE_COLUMN_VALUE_FILTER; + } + + @Override + public ByteString serialize() { + return OTSProtocolBuilder.buildCompositeColumnValueFilter(this); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/filter/Filter.java b/src/main/java/com/alicloud/openservices/tablestore/model/filter/Filter.java new file mode 100644 index 0000000..5144315 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/filter/Filter.java @@ -0,0 +1,13 @@ +package com.alicloud.openservices.tablestore.model.filter; + +import com.google.protobuf.ByteString; + +/** + * TableStore支持在查询时设置过滤器{@link Filter}, 查询操作包括GetRow, BatchGetRow, GetRange, 过滤器会在服务端对查询出的结果进行过滤后返回. + */ +public interface Filter { + + FilterType getFilterType(); + + ByteString serialize(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/filter/FilterType.java b/src/main/java/com/alicloud/openservices/tablestore/model/filter/FilterType.java new file mode 100644 index 0000000..94ddb47 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/filter/FilterType.java @@ -0,0 +1,7 @@ +package com.alicloud.openservices.tablestore.model.filter; + +public enum FilterType { + SINGLE_COLUMN_VALUE_FILTER, + COMPOSITE_COLUMN_VALUE_FILTER, + COLUMN_PAGINATION_FILTER +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/filter/SingleColumnValueFilter.java b/src/main/java/com/alicloud/openservices/tablestore/model/filter/SingleColumnValueFilter.java new file mode 100644 index 0000000..fb9559a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/filter/SingleColumnValueFilter.java @@ -0,0 +1,199 @@ +package com.alicloud.openservices.tablestore.model.filter; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.core.protocol.OTSProtocolBuilder; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.condition.SingleColumnValueCondition; +import com.alicloud.openservices.tablestore.model.filter.Filter; +import com.google.protobuf.ByteString; + +/** + * TableStore查询操作时使用的过滤器,SingleColumnValueFilter用于表示查询的行内数据列和数据值的比较关系。 + *

可以表示的列与值的比较关系包括:EQUAL(=), NOT_EQUAL(!=), GREATER_THAN(>), GREATER_EQUAL(>=), LESS_THAN(<)以及LESS_EQUAL(<=)。

+ *

由于TableStore一行的属性列不固定,有可能存在有filter条件的列在该行不存在的情况,这时{@link SingleColumnValueFilter#passIfMissing}参数控制在这种情况下对该行的过滤结果。

+ * 如果设置{@link SingleColumnValueFilter#passIfMissing}为true,则若列在该行中不存在,则返回该行; + * 如果设置{@link SingleColumnValueFilter#passIfMissing}为false,则若列在该行中不存在,则不返回该行。 + * 默认值为true。 + *

由于TableStore的属性列可能有多个版本,有可能存在该列的一个版本的值与给定值匹配但是另一个版本的值不匹配的情况,

+ * 这时{@link SingleColumnValueFilter#latestVersionsOnly}参数控制在这种情况下对该行的过滤结果。 + * 如果设置{@link SingleColumnValueFilter#latestVersionsOnly}为true,则只会对最新版本的值进行比较,否则会对该列的所有版本(最新的max_versions个)进行比较, + * 只要有一个版本的值匹配就认为条件成立。默认值为true。 + * + */ +public class SingleColumnValueFilter extends ColumnValueFilter { + public enum CompareOperator { + EQUAL, NOT_EQUAL, GREATER_THAN, GREATER_EQUAL, LESS_THAN, LESS_EQUAL; + } + + private CompareOperator operator; + private String columnName; + private ColumnValue columnValue; + private boolean passIfMissing = true; + private boolean latestVersionsOnly = true; + + /** + * 构造函数。 + * + * @param columnName 列的名称 + * @param operator 比较函数 + * @param columnValue 列的值 + */ + public SingleColumnValueFilter(String columnName, final CompareOperator operator, final ColumnValue columnValue) { + setColumnName(columnName); + setOperator(operator); + setColumnValue(columnValue); + } + + /** + * 获取列的比较操作符。 + * + * @return 比较操作符。 + */ + public CompareOperator getOperator() { + return operator; + } + + /** + * 设置列的比较操作符。 + * + * @param operator 比较操作符 + * @return this for chain invocation + */ + public SingleColumnValueFilter setOperator(CompareOperator operator) { + Preconditions.checkNotNull(operator, "The operator should not be null."); + this.operator = operator; + return this; + } + + /** + * 获取列名。 + * + * @return 列的名称。 + */ + public String getColumnName() { + return columnName; + } + + /** + * 设置列的名称。 + * + * @param columnName 列的名称 + * @return this for chain invocation + */ + public SingleColumnValueFilter setColumnName(String columnName) { + Preconditions.checkArgument(columnName != null && !columnName.isEmpty(), "The name of column should not be null or empty."); + this.columnName = columnName; + return this; + } + + /** + * 获取列的对比值。 + * + * @return 列的对比值。 + */ + public ColumnValue getColumnValue() { + return columnValue; + } + + /** + * 设置列的对比值。 + * + * @param columnValue 列的对比值。 + * @return this for chain invocation + */ + public SingleColumnValueFilter setColumnValue(ColumnValue columnValue) { + Preconditions.checkNotNull(columnValue, "The value of column should not be null."); + this.columnValue = columnValue; + return this; + } + + /** + * 返回设置的passIfMissing的值。 + * + * @return passIfMissing的值。 + */ + public boolean isPassIfMissing() { + return passIfMissing; + } + + /** + * 设置passIfMissing。 + *

由于TableStore一行的属性列不固定,有可能存在有filter条件的列在该行不存在的情况,这时{@link SingleColumnValueFilter#passIfMissing}参数控制在这种情况下对该行的过滤结果。

+ *

如果设置{@link SingleColumnValueFilter#passIfMissing}为true,则若列在该行中不存在,则返回该行;

+ *

如果设置{@link SingleColumnValueFilter#passIfMissing}为false,则若列在该行中不存在,则不返回该行。

+ *

默认值为true。

+ * + * @param passIfMissing + * @return this for chain invocation + */ + public SingleColumnValueFilter setPassIfMissing(boolean passIfMissing) { + this.passIfMissing = passIfMissing; + return this; + } + + /** + * 返回设置的latestVersionsOnly的值。 + * + * @return latestVersionsOnly的值。 + */ + public boolean isLatestVersionsOnly() { + return latestVersionsOnly; + } + + /** + * 设置latestVersionsOnly。 + *

由于TableStore的属性列可能有多个版本,有可能存在该列的一个版本的值与给定值匹配但是另一个版本的值不匹配的情况,

+ * 这时{@link SingleColumnValueFilter#latestVersionsOnly}参数控制在这种情况下对该行的过滤结果。 + *

如果设置{@link SingleColumnValueFilter#latestVersionsOnly}为true,则只会对最新版本的值进行比较,否则会对该列的所有版本(最新的max_versions个)进行比较,

+ *

只要有一个版本的值匹配就认为filter条件成立。默认值为true。

+ * + * @param latestVersionsOnly + * @return + */ + public SingleColumnValueFilter setLatestVersionsOnly(boolean latestVersionsOnly) { + this.latestVersionsOnly = latestVersionsOnly; + return this; + } + + public SingleColumnValueCondition toCondition() { + SingleColumnValueCondition.CompareOperator filterOperator; + switch (operator) { + case EQUAL: + filterOperator = SingleColumnValueCondition.CompareOperator.EQUAL; + break; + case NOT_EQUAL: + filterOperator = SingleColumnValueCondition.CompareOperator.NOT_EQUAL; + break; + case GREATER_THAN: + filterOperator = SingleColumnValueCondition.CompareOperator.GREATER_THAN; + break; + case GREATER_EQUAL: + filterOperator = SingleColumnValueCondition.CompareOperator.GREATER_EQUAL; + break; + case LESS_THAN: + filterOperator = SingleColumnValueCondition.CompareOperator.LESS_THAN; + break; + case LESS_EQUAL: + filterOperator = SingleColumnValueCondition.CompareOperator.LESS_EQUAL; + break; + default: + throw new ClientException("Unknown operator: " + operator.name()); + } + + SingleColumnValueCondition singleColumnValueCondition = new SingleColumnValueCondition(columnName, filterOperator, columnValue); + singleColumnValueCondition.setLatestVersionsOnly(latestVersionsOnly); + singleColumnValueCondition.setPassIfMissing(passIfMissing); + return singleColumnValueCondition; + } + + @Override + public FilterType getFilterType() { + return FilterType.SINGLE_COLUMN_VALUE_FILTER; + } + + @Override + public ByteString serialize() { + return OTSProtocolBuilder.buildSingleColumnValueFilter(this); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/Collapse.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/Collapse.java new file mode 100644 index 0000000..0abaeee --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/Collapse.java @@ -0,0 +1,20 @@ +package com.alicloud.openservices.tablestore.model.search; + +/** + * 字段折叠,能够实现某个字段的结果去重 + *

场景举例:

+ *

app点餐场景下,我想吃八大菜系最火的菜。如果用传统的方法,我们可能需要对8个菜的type进行分别查询最火的菜。 + * 但是我们通过设置{@link Collapse}为菜系type,就可以返回8个最火的菜(每个菜系只返回一个,因为{@link Collapse}帮我们进行了去重)。一次查询搞定用户的需求。

+ */ +public class Collapse { + + private String fieldName; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexRequest.java new file mode 100644 index 0000000..7439f55 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexRequest.java @@ -0,0 +1,58 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class CreateSearchIndexRequest implements Request { + + /** + * TableStore中的表名称 + */ + private String tableName; + /** + * SearchIndex的名称。 + */ + private String indexName; + + /** + * SearchIndex的schema结构 + */ + private IndexSchema indexSchema; + + public CreateSearchIndexRequest() { + } + + public CreateSearchIndexRequest(String tableName, String indexName) { + this.tableName = tableName; + this.indexName = indexName; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + + public IndexSchema getIndexSchema() { + return indexSchema; + } + + public void setIndexSchema(IndexSchema indexSchema) { + this.indexSchema = indexSchema; + } + + @Override + public String getOperationName() { + return OperationNames.OP_CREATE_SEARCH_INDEX; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexResponse.java new file mode 100644 index 0000000..4f71fef --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/CreateSearchIndexResponse.java @@ -0,0 +1,10 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.Response; + +public class CreateSearchIndexResponse extends Response { + + public CreateSearchIndexResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexRequest.java new file mode 100644 index 0000000..215b52e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexRequest.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class DeleteSearchIndexRequest implements Request { + + private String tableName; + private String indexName; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_DELETE_SEARCH_INDEX; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexResponse.java new file mode 100644 index 0000000..d3622dc --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/DeleteSearchIndexResponse.java @@ -0,0 +1,10 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.Response; + +public class DeleteSearchIndexResponse extends Response { + + public DeleteSearchIndexResponse(Response meta) { + super(meta); + } +} \ No newline at end of file diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexRequest.java new file mode 100644 index 0000000..aa456e6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexRequest.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class DescribeSearchIndexRequest implements Request { + + private String tableName; + private String indexName; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_DESCRIBE_SEARCH_INDEX; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexResponse.java new file mode 100644 index 0000000..b969c2b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/DescribeSearchIndexResponse.java @@ -0,0 +1,68 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; +import com.alicloud.openservices.tablestore.model.Response; + +public class DescribeSearchIndexResponse extends Response implements Jsonizable { + + private IndexSchema schema; + private SyncStat syncStat; + private MeteringInfo meteringInfo; + + public DescribeSearchIndexResponse(Response meta) { + super(meta); + } + + public IndexSchema getSchema() { + return schema; + } + + public void setSchema(IndexSchema schema) { + this.schema = schema; + } + + public SyncStat getSyncStat() { + return syncStat; + } + + public void setSyncStat(SyncStat syncStat) { + this.syncStat = syncStat; + } + + public MeteringInfo getMeteringInfo() { + return meteringInfo; + } + + public void setMeteringInfo(MeteringInfo meteringInfo) { + this.meteringInfo = meteringInfo; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"IndexSchema\": "); + if (schema != null) { + schema.jsonize(sb, newline + " "); + } else { + sb.append("null"); + } + sb.append(","); + sb.append(newline); + sb.append("\"SyncStat\": "); + if (syncStat != null) { + syncStat.jsonize(sb, newline + " "); + } else { + sb.append("null"); + } + sb.append(newline.substring(0, newline.length() - 2)); + sb.append("}"); + } +} \ No newline at end of file diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/FieldSchema.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/FieldSchema.java new file mode 100644 index 0000000..92ad560 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/FieldSchema.java @@ -0,0 +1,238 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +import java.util.List; + +/** + * SearchIndex的字段的设计 + */ +public class FieldSchema implements Jsonizable { + + public enum Analyzer { + SingleWord("single_word"), + MaxWord("max_word"); + + private String value; + Analyzer(String value) { + this.value = value; + } + + public String toString() { + return value; + } + + public static Analyzer fromString(String value) { + if (value.equals(SingleWord.toString())) { + return SingleWord; + } else if (value.equals(MaxWord.toString())) { + return MaxWord; + } else { + throw new ClientException("Unknown analyzer"); + } + } + } + + /** + * 字段名 + */ + private String fieldName; + /** + * 字段类型,详见{@link FieldType} + */ + private FieldType fieldType; + /** + * 是否开启索引,默认开启 + */ + private Boolean index = true; + /** + * 倒排索引的配置选项 + */ + private IndexOptions indexOptions; + /** + * 分词器设置 + */ + private Analyzer analyzer; + /** + * 是否开启排序和聚合功能 + */ + private Boolean enableSortAndAgg; + + /** + * 附加存储,是否在SearchIndex中附加存储该字段的值。 + * 开启后,可以直接从SearchIndex中读取该字段的值,而不必反查主表,可用于查询性能优化。 + */ + private Boolean store; + + /** + * 存的值是否是一个数组 + */ + private Boolean isArray; + + /** + * 如果 FiledType 是 NESTED ,则可使用该字段,声明一个嵌套的FieldSchema + */ + private List subFieldSchemas; + + public FieldSchema(String fieldName, FieldType fieldType) { + this.fieldName = fieldName; + this.fieldType = fieldType; + } + + public String getFieldName() { + return fieldName; + } + + public FieldSchema setFieldName(String fieldName) { + this.fieldName = fieldName; + return this; + } + + public FieldType getFieldType() { + return fieldType; + } + + public FieldSchema setFieldType(FieldType fieldType) { + this.fieldType = fieldType; + return this; + } + + public Boolean isIndex() { + return index; + } + + public FieldSchema setIndex(boolean index) { + this.index = index; + return this; + } + + public IndexOptions getIndexOptions() { + return indexOptions; + } + + public FieldSchema setIndexOptions(IndexOptions indexOptions) { + this.indexOptions = indexOptions; + return this; + } + + public Analyzer getAnalyzer() { + return analyzer; + } + + public FieldSchema setAnalyzer(Analyzer analyzer) { + this.analyzer = analyzer; + return this; + } + + public Boolean isEnableSortAndAgg() { + return enableSortAndAgg; + } + + public FieldSchema setEnableSortAndAgg(boolean enableSortAndAgg) { + this.enableSortAndAgg = enableSortAndAgg; + return this; + } + + public Boolean isStore() { + return store; + } + + public FieldSchema setStore(Boolean store) { + this.store = store; + return this; + } + + public Boolean isArray() { + return isArray; + } + + public FieldSchema setIsArray(boolean array) { + isArray = array; + return this; + } + + public List getSubFieldSchemas() { + return subFieldSchemas; + } + + public FieldSchema setSubFieldSchemas(List subFieldSchemas) { + this.subFieldSchemas = subFieldSchemas; + return this; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"FieldName\": \""); + sb.append(fieldName); + sb.append("\""); + sb.append(","); + sb.append(newline); + if (fieldType != null) { + sb.append("\"FieldType\": \""); + sb.append(fieldType.name()); + sb.append("\""); + sb.append(","); + sb.append(newline); + } + if (index != null) { + sb.append("\"Index\": "); + sb.append(index.toString()); + sb.append(","); + sb.append(newline); + } + if (indexOptions != null) { + sb.append("\"IndexOptions\": "); + sb.append(indexOptions.toString()); + sb.append(","); + sb.append(newline); + } + if (analyzer != null) { + sb.append("\"Analyzer\": "); + sb.append(analyzer.toString()); + sb.append(","); + sb.append(newline); + } + if (enableSortAndAgg != null) { + sb.append("\"EnableSortAndAgg\": "); + sb.append(enableSortAndAgg.toString()); + sb.append(","); + sb.append(newline); + } + if (store != null) { + sb.append("\"Store\": "); + sb.append(store.toString()); + sb.append(","); + sb.append(newline); + } + if (isArray != null) { + sb.append("\"IsArray\": "); + sb.append(isArray.toString()); + sb.append(","); + sb.append(newline); + } + sb.append("\"SubFieldSchemas\": ["); + boolean first = true; + for (FieldSchema schema : subFieldSchemas) { + if (first) { + first = false; + } else { + sb.append(","); + sb.append(newline + " "); + } + schema.jsonize(sb, newline + " "); + } + sb.append("]"); + sb.append(newline.substring(0, newline.length() - 2)); + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/FieldType.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/FieldType.java new file mode 100644 index 0000000..16176c5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/FieldType.java @@ -0,0 +1,20 @@ +package com.alicloud.openservices.tablestore.model.search; + +/** + * SearchIndex中支持的 Field 类型 + */ +public enum FieldType { + LONG, + DOUBLE, + BOOLEAN, + /** + * 字符串类型,同Text的区别是keyword不分词,一般作为一个整体。如果想要进行聚合统计分析,请使用该类型。 + */ + KEYWORD, + /** + * 字符串类型,同keyword的区别是text会进行分词,一般在模糊查询的场景使用。 + */ + TEXT, + NESTED, + GEO_POINT +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/GeoPoint.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/GeoPoint.java new file mode 100644 index 0000000..b689f06 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/GeoPoint.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.model.search; + +/** + * 经纬度的实体类 + */ +public class GeoPoint { + + private double lat; + private double lon; + + public GeoPoint(double lat, double lon) { + this.lat = lat; + this.lon = lon; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexOptions.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexOptions.java new file mode 100644 index 0000000..130f891 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexOptions.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.model.search; + +/** + * 支持的索引选项控制 + */ +public enum IndexOptions { + DOCS, + FREQS, + POSITIONS, + OFFSETS +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSchema.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSchema.java new file mode 100644 index 0000000..98774c6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSchema.java @@ -0,0 +1,91 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; +import com.alicloud.openservices.tablestore.model.search.sort.Sort; + +import java.util.ArrayList; +import java.util.List; + +/** + * index的schema实体类 + */ +public class IndexSchema implements Jsonizable { + + /** + * 关于某个index的设置 + */ + private IndexSetting indexSetting; + + /** + * 该index的所有字段的设置 + */ + private List fieldSchemas; + + /** + * 自定义索引的预排序方式 + * @return + */ + private Sort indexSort; + + public IndexSetting getIndexSetting() { + return indexSetting; + } + + public void setIndexSetting(IndexSetting indexSetting) { + this.indexSetting = indexSetting; + } + + public List getFieldSchemas() { + return fieldSchemas; + } + + public void setFieldSchemas(List fieldSchemas) { + this.fieldSchemas = fieldSchemas; + } + + public void addFieldSchema(FieldSchema fieldSchema) { + if (this.fieldSchemas == null) { + this.fieldSchemas = new ArrayList(); + } + this.fieldSchemas.add(fieldSchema); + } + + public Sort getIndexSort() { + return indexSort; + } + + public void setIndexSort(Sort indexSort) { + this.indexSort = indexSort; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + sb.append("\"IndexSetting\": "); + indexSetting.jsonize(sb, newline + " "); + sb.append(","); + sb.append(newline); + sb.append("\"FieldSchemas\": ["); + boolean first = true; + for (FieldSchema schema : fieldSchemas) { + if (first) { + first = false; + } else { + sb.append(","); + sb.append(newline + " "); + } + schema.jsonize(sb, newline + " "); + } + sb.append("]"); + sb.append(newline.substring(0, newline.length() - 2)); + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSetting.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSetting.java new file mode 100644 index 0000000..cce1c71 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/IndexSetting.java @@ -0,0 +1,68 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; +import com.alicloud.openservices.tablestore.core.utils.Objects; + +import java.util.List; + +/** + * index的设置,主要包括分片数,路由规则设置等 + */ +public class IndexSetting implements Jsonizable { + + /** + * 自定义路由字段 + *

注意:默认为空。如果不熟悉该功能,请咨询开发人员或者提工单询问

+ */ + private List routingFields; + + public IndexSetting() { + } + + public List getRoutingFields() { + return routingFields; + } + + public void setRoutingFields(List routingFields) { + this.routingFields = routingFields; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || !(o instanceof IndexSetting)) { + return false; + } + IndexSetting setting = (IndexSetting) o; + return Objects.equals(routingFields, setting.routingFields); + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + if (routingFields != null) { + sb.append("\"RoutingFields\": ["); + boolean first = true; + for (String field : routingFields) { + if (first) { + first = false; + } else { + sb.append(","); + sb.append(newline + " "); + } + sb.append(field); + } + sb.append("]"); + } + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexRequest.java new file mode 100644 index 0000000..9c0ca8a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexRequest.java @@ -0,0 +1,25 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class ListSearchIndexRequest implements Request { + + /** + * TableStore的表名字 + */ + private String tableName; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_LIST_SEARCH_INDEX; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexResponse.java new file mode 100644 index 0000000..9872575 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/ListSearchIndexResponse.java @@ -0,0 +1,24 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.Response; + +import java.util.List; + +public class ListSearchIndexResponse extends Response { + + private List indexInfos; + + public ListSearchIndexResponse(Response meta) { + super(meta); + } + + public List getIndexInfos() { + return indexInfos; + } + + public void setIndexInfos(List indexInfos) { + this.indexInfos = indexInfos; + } + + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/MeteringInfo.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/MeteringInfo.java new file mode 100644 index 0000000..9d3efeb --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/MeteringInfo.java @@ -0,0 +1,58 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.ReservedThroughput; + +public class MeteringInfo { + + /** + * 索引表的预留吞吐量。 + */ + private ReservedThroughput reservedThroughput; + + /** + * 索引表的存储大小,该大小为上一次计量时(通过timestamp获取计量时间)统计到的值,并非当前时刻的值。 + */ + private long storageSize; + + /** + * 索引表的总行数,该行数为上一次计量时(通过timestamp获取计量时间)统计到的值,并非当前时刻的值。 + */ + private long docCount; + + /** + * 索引表上一次计量的时间。 + */ + private long timestamp; + + public ReservedThroughput getReservedThroughput() { + return reservedThroughput; + } + + public void setReservedThroughput(ReservedThroughput reservedThroughput) { + this.reservedThroughput = reservedThroughput; + } + + public long getStorageSize() { + return storageSize; + } + + public void setStorageSize(long storageSize) { + this.storageSize = storageSize; + } + + public long getDocCount() { + return docCount; + } + + public void setDocCount(long docCount) { + this.docCount = docCount; + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchIndexInfo.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchIndexInfo.java new file mode 100644 index 0000000..03e2192 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchIndexInfo.java @@ -0,0 +1,28 @@ +package com.alicloud.openservices.tablestore.model.search; + +public class SearchIndexInfo { + + private String tableName; + private String indexName; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + + + public String toString() { + return "{TableName:" + tableName + ",IndexName:" + indexName + "}"; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchQuery.java new file mode 100644 index 0000000..9b0db25 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchQuery.java @@ -0,0 +1,103 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.search.query.Query; +import com.alicloud.openservices.tablestore.model.search.sort.Sort; + +/** + * 构建SearchQuery,该实体类会通过SearchRequest传递给服务器,告诉服务器我们的搜索参数 + */ +public class SearchQuery { + + /** + * 分页起始数量 + */ + private Integer offset; + + /** + * 分页大小,即返回的行数 + */ + private Integer limit; + + /** + * 查询语句 + */ + private Query query; + + /** + * 字段折叠 + * 能够实现某个字段的结果去重。 + */ + private Collapse collapse; + + /** + * 排序 + *

设置结果的排序方式,该参数支持多字段排序

+ */ + private Sort sort; + + private boolean getTotalCount = false; + + private byte[] token; + + public Integer getOffset() { + return offset; + } + + public SearchQuery setOffset(Integer offset) { + this.offset = offset; + return this; + } + + public Integer getLimit() { + return limit; + } + + public SearchQuery setLimit(Integer limit) { + this.limit = limit; + return this; + } + + public Query getQuery() { + return query; + } + + public SearchQuery setQuery(Query query) { + this.query = query; + return this; + } + + public Collapse getCollapse() { + return collapse; + } + + public SearchQuery setCollapse(Collapse collapse) { + this.collapse = collapse; + return this; + } + + public Sort getSort() { + return sort; + } + + public SearchQuery setSort(Sort sort) { + this.sort = sort; + return this; + } + + public boolean isGetTotalCount() { + return getTotalCount; + } + + public void setGetTotalCount(boolean getTotalCount) { + this.getTotalCount = getTotalCount; + } + + public byte[] getToken() { + return token; + } + + public void setToken(byte[] token) { + this.token = token; + this.sort = null; // Token中编码了Sort条件,所以设置Token时不需要设置Sort + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchRequest.java new file mode 100644 index 0000000..33504b8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchRequest.java @@ -0,0 +1,110 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.PrimaryKey; +import com.alicloud.openservices.tablestore.model.Request; + +import java.util.List; + + +/** + * SearchIndex的搜索的Request + */ +public class SearchRequest implements Request { + + public static class ColumnsToGet { + private List columns; + private boolean returnAll; + + public List getColumns() { + return columns; + } + + public void setColumns(List columns) { + this.columns = columns; + } + + public boolean isReturnAll() { + return returnAll; + } + + public void setReturnAll(boolean returnAll) { + this.returnAll = returnAll; + } + } + + public SearchRequest(String tableName, String indexName, SearchQuery searchQuery) { + this.tableName = tableName; + this.indexName = indexName; + this.searchQuery = searchQuery; + } + + /** + * TableStore的表名 + */ + private String tableName; + /** + * SearchIndex中的index名 + */ + private String indexName; + /** + * 查询语句,具体参数详见{@link SearchQuery} + */ + private SearchQuery searchQuery; + /** + * 指定哪些属性列需要返回 + *

如果SearchIndex中的属性列太多,而只想要某些属性列,则可以减少网络传输的数据量,提高响应速度

+ */ + private ColumnsToGet columnsToGet; + /** + * 路由字段 + * 默认为空,大多数场景下不需要使用该值。如果使用了自定义路由,可以指定路由字段。 + *

注意:高级特性。如需了解或使用请提工单或联系开发人员

+ */ + private List routingValues; + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + + public SearchQuery getSearchQuery() { + return searchQuery; + } + + public void setSearchQuery(SearchQuery searchQuery) { + this.searchQuery = searchQuery; + } + + public ColumnsToGet getColumnsToGet() { + return columnsToGet; + } + + public void setColumnsToGet(ColumnsToGet columnsToGet) { + this.columnsToGet = columnsToGet; + } + + public List getRoutingValues() { + return routingValues; + } + + public void setRoutingValues(List routingValues) { + this.routingValues = routingValues; + } + + @Override + public String getOperationName() { + return OperationNames.OP_SEARCH; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchResponse.java new file mode 100644 index 0000000..02edbd8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/SearchResponse.java @@ -0,0 +1,66 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.model.Response; +import com.alicloud.openservices.tablestore.model.Row; + +import java.util.List; + +/** + * SearchIndex的返回结果 + */ +public class SearchResponse extends Response { + + /** + * 根据输入的Query语句进行查询,SearchIndex引擎返回的总命中数 + *

注:是查询到的实际数量,不是该Response中返回的具体的行数。行数可以由其他参数来控制,进行类似分页的操作

+ */ + private long totalCount; + + /** + * Query查询的具体返回结果列表 + */ + private List rows; + + /** + * 是否查询成功 + */ + private boolean isAllSuccess; + + private byte[] nextToken; + + public SearchResponse(Response meta) { + super(meta); + } + + public long getTotalCount() { + return totalCount; + } + + public void setTotalCount(long totalCount) { + this.totalCount = totalCount; + } + + public List getRows() { + return rows; + } + + public void setRows(List rows) { + this.rows = rows; + } + + public boolean isAllSuccess() { + return isAllSuccess; + } + + public void setAllSuccess(boolean allSuccess) { + isAllSuccess = allSuccess; + } + + public byte[] getNextToken() { + return nextToken; + } + + public void setNextToken(byte[] nextToken) { + this.nextToken = nextToken; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/SyncStat.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/SyncStat.java new file mode 100644 index 0000000..f4d4920 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/SyncStat.java @@ -0,0 +1,57 @@ +package com.alicloud.openservices.tablestore.model.search; + +import com.alicloud.openservices.tablestore.core.utils.Jsonizable; + +public class SyncStat implements Jsonizable { + + public static enum SyncPhase { + FULL, + INCR + } + + private SyncPhase syncPhase; + private Long currentSyncTimestamp; + + public SyncPhase getSyncPhase() { + return syncPhase; + } + + public void setSyncPhase(SyncPhase syncPhase) { + this.syncPhase = syncPhase; + } + + public Long getCurrentSyncTimestamp() { + return currentSyncTimestamp; + } + + public void setCurrentSyncTimestamp(Long currentSyncTimestamp) { + this.currentSyncTimestamp = currentSyncTimestamp; + } + + @Override + public String jsonize() { + StringBuilder sb = new StringBuilder(); + jsonize(sb, "\n "); + return sb.toString(); + } + + @Override + public void jsonize(StringBuilder sb, String newline) { + sb.append('{'); + sb.append(newline); + if (syncPhase != null) { + sb.append("\"SyncPhase\": \""); + sb.append(syncPhase.name()); + sb.append("\""); + sb.append(","); + sb.append(newline); + } + if (currentSyncTimestamp != null) { + sb.append("\"CurrentSyncTimestamp\": "); + sb.append(currentSyncTimestamp.toString()); + sb.append(","); + sb.append(newline); + } + sb.append("}"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/BoolQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/BoolQuery.java new file mode 100644 index 0000000..e2f6769 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/BoolQuery.java @@ -0,0 +1,88 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +import java.util.List; + +/** + * 联合查询(复杂查询条件下用的最多的一个查询)。Bool查询对应Lucene中的BooleanQuery,它由一个或者多个子句组成,每个子句都有特定的类型。 + *
    + *
  • must: 文档必须完全匹配条件
  • + *
  • should: should下面会带一个以上的条件,至少满足一个条件,这个文档就符合should
  • + *
  • must_not: 文档必须不匹配条件
  • + *
+ */ +public class BoolQuery implements Query{ + + /** + * 文档必须完全匹配所有的子query + */ + private List mustQueries; + /** + * 文档必须不能匹配任何子query + */ + private List mustNotQueries; + /** + * 文档必须完全匹配所有的子filter + */ + private List filterQueries; + /** + * 文档应该至少匹配一个should,匹配多的得分会高 + */ + private List shouldQueries; + /** + * 定义了至少满足几个should子句。 + */ + private Integer minimumShouldMatch; + + public List getMustQueries() { + return mustQueries; + } + + public void setMustQueries(List mustQueries) { + this.mustQueries = mustQueries; + } + + public List getMustNotQueries() { + return mustNotQueries; + } + + public void setMustNotQueries(List mustNotQueries) { + this.mustNotQueries = mustNotQueries; + } + + public List getFilterQueries() { + return filterQueries; + } + + public void setFilterQueries(List filterQueries) { + this.filterQueries = filterQueries; + } + + public List getShouldQueries() { + return shouldQueries; + } + + public void setShouldQueries(List shouldQueries) { + this.shouldQueries = shouldQueries; + } + + public Integer getMinimumShouldMatch() { + return minimumShouldMatch; + } + + public void setMinimumShouldMatch(int minimumShouldMatch) { + this.minimumShouldMatch = minimumShouldMatch; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_BoolQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildBoolQuery(this).toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/ConstScoreQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/ConstScoreQuery.java new file mode 100644 index 0000000..5800241 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/ConstScoreQuery.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 当我们不关心检索词频率TF(Term Frequency)对搜索结果排序的影响时,可以使用constant_score将查询语句query或者过滤语句filter包装起来,达到提高搜索速度。 + *

举例:我们班有100个人,有一个字段叫“name”,我们想要获得名字中包含“王”的人,我们并不关心排序结果,使用ConstScoreQuery(将原来的Query放在" private Query filter;"中)将会大大提高搜索速度。

+ */ +public class ConstScoreQuery implements Query { + + private Query filter; + + public Query getFilter() { + return filter; + } + + public void setFilter(Query filter) { + this.filter = filter; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_ConstScoreQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildConstScoreQuery(this).toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/FieldValueFactor.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/FieldValueFactor.java new file mode 100644 index 0000000..47cf3e0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/FieldValueFactor.java @@ -0,0 +1,22 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +/** + * field_value_factor的目的是通过文档中某个字段的值计算出一个分数,以此分数来影响文档的排序。请结合{@link FunctionScoreQuery} 使用。 + *

举例:HR管理系统的场景,我们想查名字中包含“王”、出生地包含“京”的人,但是想让结果根据根据身高排序。就可以把身高设置在FieldValueFactor中

+ */ +public class FieldValueFactor { + + private String fieldName; + + public FieldValueFactor(String fieldName) { + this.fieldName = fieldName; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/FunctionScoreQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/FunctionScoreQuery.java new file mode 100644 index 0000000..22562a9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/FunctionScoreQuery.java @@ -0,0 +1,48 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 用于处理文档分值的Query,它会在查询结束后对每一个匹配的文档进行一系列的重打分操作,最后以生成的最终分数进行排序。 + *

举例见{@link FieldValueFactor}

+ */ +public class FunctionScoreQuery implements Query { + + /** + * 正常的{@link Query} + */ + private Query query; + private FieldValueFactor fieldValueFactor; + + public FunctionScoreQuery(Query query, FieldValueFactor fieldValueFactor) { + this.query = query; + this.fieldValueFactor = fieldValueFactor; + } + + public Query getQuery() { + return query; + } + + public void setQuery(Query query) { + this.query = query; + } + + public FieldValueFactor getFieldValueFactor() { + return fieldValueFactor; + } + + public void setFieldValueFactor(FieldValueFactor fieldValueFactor) { + this.fieldValueFactor = fieldValueFactor; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_FunctionScoreQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildFunctionScoreQuery(this).toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoBoundingBoxQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoBoundingBoxQuery.java new file mode 100644 index 0000000..d26e756 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoBoundingBoxQuery.java @@ -0,0 +1,58 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 找出经纬度落在指定矩形内的数据。 + *

场景举例:订单区域画像分析的场景,想分析A小区购买力,而恰好这A小区是矩形的。我们通过统计A小区订单数量(或总价)即可。

+ *

方法:在SearchQuery的中构造一个{@link BoolQuery},其 mustQueries 中放入一个{@link GeoBoundingBoxQuery}的矩形地理位置,然后mustQueries再放入查询订单数量的query,就可以获得想要的结果。

+ */ +public class GeoBoundingBoxQuery implements Query { + + private String fieldName; + /** + * 矩形的左上角的经纬度 + *

示例:"46.24123424, 23.2342424"

+ */ + private String topLeft; + /** + * 矩形的右下角经纬度 + *

示例:"46.24123424, 23.2342424"

+ */ + private String bottomRight; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getTopLeft() { + return topLeft; + } + + public void setTopLeft(String topLeft) { + this.topLeft = topLeft; + } + + public String getBottomRight() { + return bottomRight; + } + + public void setBottomRight(String bottomRight) { + this.bottomRight = bottomRight; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_GeoBoundingBoxQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildGeoBoundingBoxQuery(this).toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoDistanceQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoDistanceQuery.java new file mode 100644 index 0000000..010d603 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoDistanceQuery.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 找出与某个位置某个距离内的数据。 + *

常用场景:搜索我附近1千米内的人。

+ *

通过设置我的centerPoint(一个经纬度信息),然后设置举例信息distanceInMeter=1000,进行查询即可。

+ */ +public class GeoDistanceQuery implements Query { + + /** + * 字段名 + */ + private String fieldName; + /** + * 中心点 + */ + private String centerPoint; + /** + * 与中心点的距离(单位:米) + */ + private double distanceInMeter; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getCenterPoint() { + return centerPoint; + } + + public void setCenterPoint(String centerPoint) { + this.centerPoint = centerPoint; + } + + public double getDistanceInMeter() { + return distanceInMeter; + } + + public void setDistanceInMeter(double distanceInMeter) { + this.distanceInMeter = distanceInMeter; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_GeoDistanceQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildGeoDistanceQuery(this).toByteString(); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoPolygonQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoPolygonQuery.java new file mode 100644 index 0000000..853be2f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/GeoPolygonQuery.java @@ -0,0 +1,49 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +import java.util.List; + +/** + * 找出落在指定多边形包围起来的图形内的数据 + *

注意:这个查询器使用代价很大,请避免使用

+ *

场景举例:小黄车只能在繁华的地方服务,出了市区要收额外的服务费,而繁华的城市的边界是多边形的。我们想查询该车辆是否需要付额外的服务费,就需要通过搜索用户的经纬度是否在多边形内。

+ */ +public class GeoPolygonQuery implements Query { + + /** + * 字段名 + */ + private String fieldName; + /** + * 经纬度字符串的List + */ + private List points; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public List getPoints() { + return points; + } + + public void setPoints(List points) { + this.points = points; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_GeoPolygonQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildGeoPolygonQuery(this).toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchAllQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchAllQuery.java new file mode 100644 index 0000000..be6b02f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchAllQuery.java @@ -0,0 +1,20 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 获取所有的文档,所有文档分数为1。返回的结果中:命中数永远都是正确的。加入返回的结果过多,SearchIndex会只返回部分数据。 + */ +public class MatchAllQuery implements Query { + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_MatchAllQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildMatchAllQuery().toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchPhraseQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchPhraseQuery.java new file mode 100644 index 0000000..62ee84d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchPhraseQuery.java @@ -0,0 +1,39 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 类似 {@link MatchQuery} (MatchQuery 仅匹配某个词即可),但是 MatchPhraseQuery会匹配所有的短语。 + */ +public class MatchPhraseQuery implements Query { + + private String fieldName; + private String text; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_MatchPhraseQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildMatchPhraseQuery(this).toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchQuery.java new file mode 100644 index 0000000..1be3d5f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/MatchQuery.java @@ -0,0 +1,73 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 包括模糊匹配和短语或邻近查询 + */ +public class MatchQuery implements Query { + /** + * 字段 + */ + private String fieldName; + /** + * 模糊匹配的值 + */ + private String text; + + /** + * 最小匹配个数 + * @return + */ + private Integer minimumShouldMatch; + + /** + * 操作符 + * @return + */ + private QueryOperator operator; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public QueryOperator getOperator() { + return operator; + } + + public void setOperator(QueryOperator operator) { + this.operator = operator; + } + + public Integer getMinimumShouldMatch() { + return minimumShouldMatch; + } + + public void setMinimumShouldMatch(Integer minimumShouldMatch) { + this.minimumShouldMatch = minimumShouldMatch; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_MatchQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildMatchQuery(this).toByteString(); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/NestedQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/NestedQuery.java new file mode 100644 index 0000000..ad80ac7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/NestedQuery.java @@ -0,0 +1,58 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 嵌套查询可以查询嵌套的对象/文档。 + *

举例:我们的文档是这样的:{"id":"1","os":{"name":"win7","ip":"127.0.0.1"}},我们想搜索os的name, + * 但是不能直接查询,需要通过{@link NestedQuery}来进行查询。在"path"设置为“os”,然后query中放一个正常的Query

+ */ +public class NestedQuery implements Query { + /** + * 嵌套文档的路径 + */ + private String path; + /** + * 一个query + */ + private Query query; + /** + * 多值字段获取文档得分的模式 + */ + private ScoreMode scoreMode; + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_NestedQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildNestedQuery(this).toByteString(); + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public Query getQuery() { + return query; + } + + public void setQuery(Query query) { + this.query = query; + } + + public ScoreMode getScoreMode() { + return scoreMode; + } + + public void setScoreMode(ScoreMode scoreMode) { + this.scoreMode = scoreMode; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/PrefixQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/PrefixQuery.java new file mode 100644 index 0000000..cd68c3e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/PrefixQuery.java @@ -0,0 +1,42 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 匹配前缀。比如搜索“name”是以“王”字开头的所有人。 + */ +public class PrefixQuery implements Query { + + private String fieldName; + /** + * 字符串前缀 + */ + private String prefix; + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_PrefixQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildPrefixQuery(this).toByteString(); + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/Query.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/Query.java new file mode 100644 index 0000000..cc2ec0d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/Query.java @@ -0,0 +1,14 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.google.protobuf.ByteString; + +/** + * Query接口,具体介绍请查看具体的实现类的说明 + */ +public interface Query { + + QueryType getQueryType(); + + ByteString serialize(); + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryOperator.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryOperator.java new file mode 100644 index 0000000..bfdbb8e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryOperator.java @@ -0,0 +1,6 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +public enum QueryOperator { + OR, + AND +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryType.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryType.java new file mode 100644 index 0000000..0927dc2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/QueryType.java @@ -0,0 +1,23 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +/** + * SearchIndex支持的Query类型 + */ +public enum QueryType { + QueryType_None, + QueryType_MatchQuery, + QueryType_MatchPhraseQuery, + QueryType_TermQuery, + QueryType_RangeQuery, + QueryType_PrefixQuery, + QueryType_BoolQuery, + QueryType_ConstScoreQuery, + QueryType_FunctionScoreQuery, + QueryType_NestedQuery, + QueryType_WildcardQuery, + QueryType_MatchAllQuery, + QueryType_GeoBoundingBoxQuery, + QueryType_GeoDistanceQuery, + QueryType_GeoPolygonQuery, + QueryType_TermsQuery +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/RangeQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/RangeQuery.java new file mode 100644 index 0000000..8216a7a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/RangeQuery.java @@ -0,0 +1,108 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.google.protobuf.ByteString; + +/** + * 范围查询。通过设置一个范围(from,to),查询该范围内的所有数据。 + */ +public class RangeQuery implements Query { + + /** + * 字段名 + */ + private String fieldName; + /** + * 字段取值的下界 + */ + private ColumnValue from; + /** + * 字段取值的上界 + */ + private ColumnValue to; + /** + * 范围取值是否包含下届 + */ + private boolean includeLower; + /** + * 范围取值是否包含上届 + */ + private boolean includeUpper; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public void greaterThan(ColumnValue value) { + this.setFrom(value, false); + } + + public void greaterThanOrEqual(ColumnValue value) { + this.setFrom(value, true); + } + + public void lessThan(ColumnValue value) { + this.setTo(value, false); + } + + public void lessThanOrEqual(ColumnValue value) { + this.setTo(value, true); + } + + public void setFrom(ColumnValue value, boolean includeLower) { + this.from = value; + this.includeLower = includeLower; + } + + public void setTo(ColumnValue value, boolean includeUpper) { + this.to = value; + this.includeUpper = includeUpper; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_RangeQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildRangeQuery(this).toByteString(); + } + + public ColumnValue getFrom() { + return from; + } + + public void setFrom(ColumnValue from) { + this.from = from; + } + + public ColumnValue getTo() { + return to; + } + + public void setTo(ColumnValue to) { + this.to = to; + } + + public boolean isIncludeLower() { + return includeLower; + } + + public void setIncludeLower(boolean includeLower) { + this.includeLower = includeLower; + } + + public boolean isIncludeUpper() { + return includeUpper; + } + + public void setIncludeUpper(boolean includeUpper) { + this.includeUpper = includeUpper; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/ScoreMode.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/ScoreMode.java new file mode 100644 index 0000000..25b2a6c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/ScoreMode.java @@ -0,0 +1,13 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +/** + * 一个字段多个值的情况下,采用哪个值来进行排序。 + *

举例:有一个小学生学生状态监测系统,其中存了小学生的身高,但是小学生身高一直在长,所以“身高”这个字段,采用了array的方式。然后我们查询的时候,想根据身高进行排序,就可以设置ScoreMode为MAX,这样就能得到最近的一次身高

+ */ +public enum ScoreMode { + None, + Avg, + Max, + Min, + Total, +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermQuery.java new file mode 100644 index 0000000..9acdc2c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermQuery.java @@ -0,0 +1,40 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.google.protobuf.ByteString; + +/** + * 精确的term查询。 + */ +public class TermQuery implements Query { + + private String fieldName; + private ColumnValue term; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public ColumnValue getTerm() { + return term; + } + + public void setTerm(ColumnValue term) { + this.term = term; + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_TermQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildTermQuery(this).toByteString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermsQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermsQuery.java new file mode 100644 index 0000000..d8397b3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/TermsQuery.java @@ -0,0 +1,51 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.google.protobuf.ByteString; + +import java.util.ArrayList; +import java.util.List; + +/** + * 多个term查询。 + */ +public class TermsQuery implements Query { + + private String fieldName; + private List terms; + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public List getTerms() { + return terms; + } + + public void setTerms(List terms) { + this.terms = terms; + } + + public void addTerm(ColumnValue term) { + if (this.terms == null) { + this.terms = new ArrayList(); + } + this.terms.add(term); + } + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_TermsQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildTermsQuery(this).toByteString(); + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/query/WildcardQuery.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/WildcardQuery.java new file mode 100644 index 0000000..b9fe852 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/query/WildcardQuery.java @@ -0,0 +1,40 @@ +package com.alicloud.openservices.tablestore.model.search.query; + +import com.alicloud.openservices.tablestore.core.protocol.SearchQueryBuilder; +import com.google.protobuf.ByteString; + +/** + * 通配符查询。支持 *( 任意0或多个)和 ?(任意1个字符)。 + *

举例:名字字段是“name”,想查询名字中包含“龙”的人,就可以“*龙*” ,但是效率可能不高。

+ */ +public class WildcardQuery implements Query { + + private String fieldName; + private String value; + + @Override + public QueryType getQueryType() { + return QueryType.QueryType_WildcardQuery; + } + + @Override + public ByteString serialize() { + return SearchQueryBuilder.buildWildcardQuery(this).toByteString(); + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/FieldSort.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/FieldSort.java new file mode 100644 index 0000000..1243727 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/FieldSort.java @@ -0,0 +1,50 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +public class FieldSort implements Sort.Sorter { + + private String fieldName; + private SortOrder order = SortOrder.ASC; + private SortMode mode; + private NestedFilter nestedFilter; + + public FieldSort(String fieldName) { + this.fieldName = fieldName; + } + + public FieldSort(String fieldName, SortOrder order) { + this.fieldName = fieldName; + this.order = order; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public SortOrder getOrder() { + return order; + } + + public void setOrder(SortOrder order) { + this.order = order; + } + + public SortMode getMode() { + return mode; + } + + public void setMode(SortMode mode) { + this.mode = mode; + } + + public NestedFilter getNestedFilter() { + return nestedFilter; + } + + public void setNestedFilter(NestedFilter nestedFilter) { + this.nestedFilter = nestedFilter; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceSort.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceSort.java new file mode 100644 index 0000000..190e163 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceSort.java @@ -0,0 +1,87 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +import java.util.List; + +/** + * 地理空间模型中对距离的排序 + */ +public class GeoDistanceSort implements Sort.Sorter { + + /** + * 排序的字段 + */ + private String fieldName; + /** + * 排序的地理位置点 + */ + private List points; + /** + * 升序或降序 + */ + private SortOrder order; + /** + * 多值字段的排序依据 + */ + private SortMode mode; + /** + * 计算两点距离的算法 + */ + private GeoDistanceType distanceType; + /** + * 嵌套的过滤器 + */ + private NestedFilter nestedFilter; + + public GeoDistanceSort(String fieldName, List points) { + this.fieldName = fieldName; + this.points = points; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public List getPoints() { + return points; + } + + public void setPoints(List points) { + this.points = points; + } + + public SortOrder getOrder() { + return order; + } + + public void setOrder(SortOrder order) { + this.order = order; + } + + public SortMode getMode() { + return mode; + } + + public void setMode(SortMode mode) { + this.mode = mode; + } + + public GeoDistanceType getDistanceType() { + return distanceType; + } + + public void setDistanceType(GeoDistanceType distanceType) { + this.distanceType = distanceType; + } + + public NestedFilter getNestedFilter() { + return nestedFilter; + } + + public void setNestedFilter(NestedFilter nestedFilter) { + this.nestedFilter = nestedFilter; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceType.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceType.java new file mode 100644 index 0000000..724c882 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/GeoDistanceType.java @@ -0,0 +1,15 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +/** + * 地理空间类型的Field在计算距离的时候采用的模型(默认为ARC) + */ +public enum GeoDistanceType { + /** + * 弧形(因为地球是弧形的,采用该设置可精确距离,但计算量较大) + */ + ARC, + /** + * 把地球看成平面,计算两点距离(精确值不够,但是计算量小) + */ + PLANE +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/NestedFilter.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/NestedFilter.java new file mode 100644 index 0000000..1a8c56c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/NestedFilter.java @@ -0,0 +1,33 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +import com.alicloud.openservices.tablestore.model.search.query.Query; + +/** + * 一个嵌套的过滤器 + */ +public class NestedFilter { + + private String path; + private Query query; + + public NestedFilter(String path, Query query) { + this.path = path; + this.query = query; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public Query getQuery() { + return query; + } + + public void setQuery(Query query) { + this.query = query; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/PrimaryKeySort.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/PrimaryKeySort.java new file mode 100644 index 0000000..541533a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/PrimaryKeySort.java @@ -0,0 +1,21 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +public class PrimaryKeySort implements Sort.Sorter { + + private SortOrder order = SortOrder.ASC; + + public PrimaryKeySort() { + } + + public PrimaryKeySort(SortOrder order) { + this.order = order; + } + + public SortOrder getOrder() { + return order; + } + + public void setOrder(SortOrder order) { + this.order = order; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/ScoreSort.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/ScoreSort.java new file mode 100644 index 0000000..bd22ced --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/ScoreSort.java @@ -0,0 +1,14 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +public class ScoreSort implements Sort.Sorter { + + private SortOrder order = SortOrder.DESC; + + public SortOrder getOrder() { + return order; + } + + public void setOrder(SortOrder order) { + this.order = order; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/Sort.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/Sort.java new file mode 100644 index 0000000..6c8899b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/Sort.java @@ -0,0 +1,26 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +import java.util.List; + +/** + * 排序。可以在SearchQuery中进行设置该项 + */ +public class Sort { + + public interface Sorter { + } + + private List sorters; + + public Sort(List sorters) { + this.sorters = sorters; + } + + public List getSorters() { + return sorters; + } + + public void setSorters(List sorters) { + this.sorters = sorters; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortMode.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortMode.java new file mode 100644 index 0000000..ee5ff3c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortMode.java @@ -0,0 +1,12 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +/** + * 选取一个Field的哪个值进行排序 + *

大多数情况下,一个字段只有一个值,所以这项无意义,默认为 MIN

+ *

当一个字段是一个集合(Array)时候,可以设置用该集合中的某一个值作为排序的依据

+ */ +public enum SortMode { + MIN, + MAX, + AVG +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortOrder.java b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortOrder.java new file mode 100644 index 0000000..4a0c94e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/search/sort/SortOrder.java @@ -0,0 +1,9 @@ +package com.alicloud.openservices.tablestore.model.search.sort; + +/** + * 排序的顺序(升序或降序) + */ +public enum SortOrder { + ASC, + DESC +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelInfo.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelInfo.java new file mode 100644 index 0000000..cf4d3f0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelInfo.java @@ -0,0 +1,145 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import java.util.Date; + +public class ChannelInfo { + /** + * Channel的ID。 + */ + private String channelId; + /** + * Channel的类型, 目前支持BaseData(全量)和增量(Stream)两类。 + */ + private ChannelType channelType; + /** + * Channel的状态,有等待(WAIT), 打开(OPEN), 关闭中(CLOSING), 关闭(CLOSE)和结束(TERMINATED)五种。 + */ + private ChannelStatus channelStatus; + /** + * Tunnel客户端的ID标识, 默认由客户端主机名和随机串拼接而成。 + */ + private String clientId; + /** + * Channel消费增量数据的最新时间点,默认值为1970年1月1日(UTC), 全量类型无此概念。 + */ + private Date channelConsumePoint; + + /** + * Channel增量消费的RPO(Recovery Point Objective)时间, 单位为毫秒, 全量类型无此概念。 + */ + private long channelRpo; + + /** + * Channel同步的数据条数。 + */ + private long channelCount; + + /** + * 获取Channel ID。 + * @return Channel的ID。 + */ + public String getChannelId() { + return channelId; + } + + /** + * 设置ChannelID。 + * @param channelId Channel ID。 + */ + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + /** + * 获取Channel类型。 + * @return Channel类型。 + */ + public ChannelType getChannelType() { + return channelType; + } + + /** + * 设置Channel类型。 + * @param channelType Channel类型。 + */ + public void setChannelType(ChannelType channelType) { + this.channelType = channelType; + } + + /** + * 获取Channel的状态。 + * @return Channel的状态。 + */ + public ChannelStatus getChannelStatus() { + return channelStatus; + } + + /** + * 设置Channel的状态。 + * @param channelStatus Channel的状态。 + */ + public void setChannelStatus(ChannelStatus channelStatus) { + this.channelStatus = channelStatus; + } + + /** + * 获取Tunnel Client的 ID。 + * @return Tunnel Client ID。 + */ + public String getClientId() { + return clientId; + } + + /** + * 设置Tunnel Client的ID。 + * @param clientId Tunnel Client ID。 + */ + public void setClientId(String clientId) { + this.clientId = clientId; + } + + /** + * 获取当前Channel的RPO(Recovery Point Objective)时间, 单位为毫秒。 + * @return + */ + public long getChannelRpo() { + return channelRpo; + } + + public void setChannelRpo(long channelRpo) { + this.channelRpo = channelRpo; + } + + /** + * 获取当前Channel消费数据的最新时间点。 + * @return Channel消费数据的最新时间点。 + */ + public Date getChannelConsumePoint() { + return channelConsumePoint; + } + + /** + * 内部接口,请勿使用。 + */ + public void setChannelConsumePoint(Date channelConsumePoint) { + this.channelConsumePoint = channelConsumePoint; + } + + public long getChannelCount() { + return channelCount; + } + + public void setChannelCount(long channelCount) { + this.channelCount = channelCount; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{").append("ChannelId: ").append(channelId).append(", ChannelType: ").append(channelType) + .append(", ChannelStatus: ").append(channelStatus).append(", ClientId: ").append(clientId) + .append(", ChannelConsumePoint: ").append(channelConsumePoint).append(", ChannelRpo: ") + .append(channelRpo).append(", ChannelCount: ").append(channelCount).append("}"); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelStatus.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelStatus.java new file mode 100644 index 0000000..d1fe68d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelStatus.java @@ -0,0 +1,24 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +public enum ChannelStatus { + /** + * 等待。 + */ + WAIT, + /** + * 打开。 + */ + OPEN, + /** + * 关闭中。 + */ + CLOSING, + /** + * 关闭。 + */ + CLOSE, + /** + * 结束。 + */ + TERMINATED, +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelType.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelType.java new file mode 100644 index 0000000..977c47f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ChannelType.java @@ -0,0 +1,12 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +public enum ChannelType { + /** + * 全量类型。 + */ + BaseData, + /** + * 增量类型。 + */ + Stream, +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelRequest.java new file mode 100644 index 0000000..3b48004 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelRequest.java @@ -0,0 +1,104 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +/** + * CreateTunnelRequest包含创建一个新Tunnel所必须的一些参数,包括表名、Tunnel名和Tunnel的类型。 + */ +public class CreateTunnelRequest implements Request { + /** + * 表名。 + */ + private String tableName; + + /** + * Tunnel名。 + */ + private String tunnelName; + + /** + * Tunnel类型, 目前支持全量、增量和全量加增量三类。 + */ + private TunnelType tunnelType; + + /** + * 初始化CreateTunnelRequest实例。 + * + * @param tableName 表名。 + * @param tunnelName Tunnel名。 + * @param tunnelType Tunnel类型。 + */ + public CreateTunnelRequest(String tableName, String tunnelName, + TunnelType tunnelType) { + setTableName(tableName); + setTunnelName(tunnelName); + setTunnelType(tunnelType); + } + + /** + * 获取表名。 + * + * @return 表名。 + */ + public String getTableName() { + return tableName; + } + + /** + * 设置表名。 + * + * @param tableName 表名。 + */ + public void setTableName(String tableName) { + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), + "The table name should not be empty."); + this.tableName = tableName; + } + + /** + * 获取Tunnel名。 + * + * @return Tunnel名。 + */ + public String getTunnelName() { + return tunnelName; + } + + /** + * 设置Tunnel名。 + * + * @param tunnelName Tunnel名。 + */ + public void setTunnelName(String tunnelName) { + Preconditions.checkArgument(tunnelName != null && !tunnelName.isEmpty(), + "The tunnel name should not be empty."); + this.tunnelName = tunnelName; + } + + /** + * 获取Tunnel类型。 + * + * @return Tunnel类型。 + */ + public TunnelType getTunnelType() { + return tunnelType; + } + + /** + * 设置Tunnel类型。 + * + * @param tunnelType Tunnel类型。 + */ + public void setTunnelType(TunnelType tunnelType) { + Preconditions.checkArgument(tunnelType != null, + "The tunnel type should not be null."); + this.tunnelType = tunnelType; + } + + @Override + public String getOperationName() { + return OperationNames.OP_CREATE_TUNNEL; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelResponse.java new file mode 100644 index 0000000..f95feb6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/CreateTunnelResponse.java @@ -0,0 +1,33 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import com.alicloud.openservices.tablestore.model.Response; + +/** + * CreateTunnel操作的返回结果。 + */ +public class CreateTunnelResponse extends Response { + /** + * 创建出的Tunnel的ID。 + */ + private String tunnelId; + + public CreateTunnelResponse(Response meta) { + super(meta); + } + + /** + * 获取创建出的Tunnel ID。 + * + * @return 创建出的Tunnel ID。 + */ + public String getTunnelId() { + return tunnelId; + } + + /** + * 内部接口,请勿使用。 + */ + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelRequest.java new file mode 100644 index 0000000..6f017e9 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelRequest.java @@ -0,0 +1,76 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +/** + * DeleteTunnelRequest包含删除一个Tunnel所必须的一些参数,包括表名、Tunnel名。 + */ +public class DeleteTunnelRequest implements Request { + /** + * 表名。 + */ + private String tableName; + + /** + * Tunnel名。 + */ + private String tunnelName; + + /** + * 初始化DeleteTunnelRequest实例。 + * + * @param tableName 表名。 + * @param tunnelName Tunnel名。 + */ + public DeleteTunnelRequest(String tableName, String tunnelName) { + setTableName(tableName); + setTunnelName(tunnelName); + } + + /** + * 获取表名。 + * + * @return 表名。 + */ + public String getTableName() { + return tableName; + } + + /** + * 设置表名。 + * + * @param tableName 表名。 + */ + public void setTableName(String tableName) { + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), + "The table name should not be empty."); + this.tableName = tableName; + } + + /** + * 获取Tunnel名。 + * + * @return Tunnel名。 + */ + public String getTunnelName() { + return tunnelName; + } + + /** + * 设置Tunnel名。 + * + * @param tunnelName Tunnel名。 + */ + public void setTunnelName(String tunnelName) { + Preconditions.checkArgument(tunnelName != null && !tunnelName.isEmpty(), + "The tunnel name should not be empty."); + this.tunnelName = tunnelName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_DELETE_TUNNEL; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelResponse.java new file mode 100644 index 0000000..c34a310 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DeleteTunnelResponse.java @@ -0,0 +1,12 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import com.alicloud.openservices.tablestore.model.Response; + +/** + * DeleteTunnel操作的返回结果。 + */ +public class DeleteTunnelResponse extends Response { + public DeleteTunnelResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelRequest.java new file mode 100644 index 0000000..30b5be8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelRequest.java @@ -0,0 +1,71 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +/** + * DescribeTunnelRequest包含描述一个Tunnel所必须的一些参数,包括表名、Tunnel名。 + */ +public class DescribeTunnelRequest implements Request { + /** + * 表名。 + */ + private String tableName; + + /** + * Tunnel名。 + */ + private String tunnelName; + + /** + * 初始化DescribeTunnelRequest实例。 + * @param tableName 表名。 + * @param tunnelName Tunnel名。 + */ + public DescribeTunnelRequest(String tableName, String tunnelName) { + setTableName(tableName); + setTunnelName(tunnelName); + } + + /** + * 获取表名。 + * @return 表名。 + */ + public String getTableName() { + return tableName; + } + + /** + * 设置表名。 + * @param tableName 表名。 + */ + public void setTableName(String tableName) { + Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), + "The table name should not be empty."); + this.tableName = tableName; + } + + /** + * 获取Tunnel名。 + * @return Tunnel名。 + */ + public String getTunnelName() { + return tunnelName; + } + + /** + * 设置Tunnel名。 + * @param tunnelName Tunnel名。 + */ + public void setTunnelName(String tunnelName) { + Preconditions.checkArgument(tunnelName != null && !tunnelName.isEmpty(), + "The tunnel name should not be empty."); + this.tunnelName = tunnelName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_DESCRIBE_TUNNEL; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelResponse.java new file mode 100644 index 0000000..bc35806 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/DescribeTunnelResponse.java @@ -0,0 +1,96 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import java.util.Date; +import java.util.List; + +import com.alicloud.openservices.tablestore.model.Response; + +/** + * DescribeTunnel操作的返回结果。 + */ +public class DescribeTunnelResponse extends Response { + /** + * Tunnel消费增量数据的最新时间点,其值等于Tunnel中消费最慢的Channel的时间点,默认为1970年1月1日(UTC)。 + */ + private Date tunnelConsumePoint; + + /** + * Tunnel的增量消费RPO(Recovery Point Objective)时间, 单位为毫秒。 + */ + private long tunnelRpo; + + /** + * Tunnel信息。 + */ + private TunnelInfo tunnelInfo; + /** + * 该Tunnel下的Channel信息列表。 + */ + private List channelInfos; + + public DescribeTunnelResponse(Response meta) { + super(meta); + } + + /** + * 当前Tunnel的RPO(Recovery Point Objective)时间, 单位为毫秒。 + * + * @return 当前Tunnel的RPO。 + */ + public long getTunnelRpo() { + return tunnelRpo; + } + + /** + * 内部接口,请勿使用。 + */ + public void setTunnelRpo(long tunnelRpo) { + this.tunnelRpo = tunnelRpo; + } + + /** + * 获取当前Tunnel消费数据的时间点。 + * @return Tunnel消费数据的时间点。 + */ + public Date getTunnelConsumePoint() { + return tunnelConsumePoint; + } + + /** + * 内部接口,请勿使用。 + */ + public void setTunnelConsumePoint(Date tunnelConsumePoint) { + this.tunnelConsumePoint = tunnelConsumePoint; + } + + /** + * 内部接口,请勿使用。 + */ + + public TunnelInfo getTunnelInfo() { + return tunnelInfo; + } + + /** + * 内部接口,请勿使用。 + */ + public void setTunnelInfo(TunnelInfo tunnelInfo) { + this.tunnelInfo = tunnelInfo; + } + + /** + * 获取该Tunnel下的Channel信息列表。 + * @return + */ + public List getChannelInfos() { + return channelInfos; + } + + /** + * 内部接口,请勿使用。 + */ + public void setChannelInfos(List channelInfos) { + this.channelInfos = channelInfos; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelRequest.java new file mode 100644 index 0000000..bbd6b2f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelRequest.java @@ -0,0 +1,46 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +/** + * ListTunnelRequest包含列举某张表下的Tunnel所必须的一些参数,包括表名。 + */ +public class ListTunnelRequest implements Request { + /** + * 表名。 + */ + private String tableName; + + /** + * 初始化ListTunnelRequest实例。 + * @param tableName 表名。 + */ + public ListTunnelRequest(String tableName) { + setTableName(tableName); + } + + /** + * 获取表名。 + * @return 表名。 + */ + public String getTableName() { + return tableName; + } + + /** + * 设置表名。 + * @param tableName 表名。 + */ + public void setTableName(String tableName) { + //Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), + // "The table name should not be empty."); + this.tableName = tableName; + } + + @Override + public String getOperationName() { + return OperationNames.OP_LIST_TUNNEL; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelResponse.java new file mode 100644 index 0000000..eca8334 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/ListTunnelResponse.java @@ -0,0 +1,28 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +import java.util.List; + +import com.alicloud.openservices.tablestore.model.Response; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelInfo; + +/** + * ListTunnel操作的返回结果。 + */ +public class ListTunnelResponse extends Response { + /** + * Tunnel信息的列表。 + */ + private List tunnelInfos; + + public ListTunnelResponse(Response meta) { + super(meta); + } + + public List getTunnelInfos() { + return tunnelInfos; + } + + public void setTunnelInfos(List tunnelInfos) { + this.tunnelInfos = tunnelInfos; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelInfo.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelInfo.java new file mode 100644 index 0000000..e184d37 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelInfo.java @@ -0,0 +1,154 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +public class TunnelInfo { + /** + * Tunnel的名称。 + */ + private String tunnelName; + /** + * Tunnel的ID。 + */ + private String tunnelId; + /** + * Tunnel的类型,有全量(BaseData), 增量(Stream)和全量加增量(BaseAndStream)三类。 + */ + private TunnelType tunnelType; + /** + * 表的名称。 + */ + private String tableName; + /** + * 实例名称。 + */ + private String instanceName; + /** + * Tunnel所处的阶段,有初始化(InitBaseDataAndStreamShard), 全量处理(ProcessBaseData)和增量处理(ProcessStream)三类。 + */ + private TunnelStage stage; + /** + * 数据是否超期, 若该值返回true, 请及时在钉钉上联系 表格存储技术支持。 + */ + private boolean expired; + + /** + * 获取Tunnel名称。 + * @return Tunnel名称。 + */ + public String getTunnelName() { + return tunnelName; + } + + /** + * 设置Tunnel名称。 + * @param tunnelName Tunnel名称。 + */ + public void setTunnelName(String tunnelName) { + this.tunnelName = tunnelName; + } + + /** + * 获取Tunnel ID。 + * @return Tunnel ID。 + */ + public String getTunnelId() { + return tunnelId; + } + + /** + * 设置Tunnel ID。 + * @param tunnelId Tunnel ID。 + */ + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + /** + * 获取Tunnel类型。 + * @return Tunnel类型。 + */ + public TunnelType getTunnelType() { + return tunnelType; + } + + /** + * 设置Tunnel类型。 + * @param tunnelType Tunnel类型。 + */ + public void setTunnelType(TunnelType tunnelType) { + this.tunnelType = tunnelType; + } + + /** + * 获取表名。 + * @return 表名。 + */ + public String getTableName() { + return tableName; + } + + /** + * 设置表名。 + * @param tableName 表名。 + */ + public void setTableName(String tableName) { + this.tableName = tableName; + } + + /** + * 获取实例名。 + * @return 实例名。 + */ + public String getInstanceName() { + return instanceName; + } + + /** + * 设置实例名。 + * @param instanceName 实例名。 + */ + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + + /** + * 获取Tunnel所处的阶段。 + * @return Tunnel所处的阶段。 + */ + public TunnelStage getStage() { + return stage; + } + + /** + * 设置Tunnel所处的阶段。 + * @param stage Tunnel所处的阶段。 + */ + public void setStage(TunnelStage stage) { + this.stage = stage; + } + + /** + * 获取数据是否超期。 + * @return 数据是否超期。 + */ + public boolean isExpired() { + return expired; + } + + /** + * 设置数据是否过期。 + * @param expired 数据是否超期 + */ + public void setExpired(boolean expired) { + this.expired = expired; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{").append("TunnelName: ").append(tunnelName).append(", TunnelId: ") + .append(tunnelId).append(", TunnelType: ").append(tunnelType).append(", TableName: ").append(tableName) + .append(", InstanceName: ").append(instanceName).append(", Stage: ").append(stage.name()) + .append(", Expired: ").append(expired).append("}"); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelStage.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelStage.java new file mode 100644 index 0000000..6610395 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelStage.java @@ -0,0 +1,16 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +public enum TunnelStage { + /** + * 初始化。 + */ + InitBaseDataAndStreamShard, + /** + * 全量处理。 + */ + ProcessBaseData, + /** + * 增量处理。 + */ + ProcessStream +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelType.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelType.java new file mode 100644 index 0000000..c4c1963 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/TunnelType.java @@ -0,0 +1,21 @@ +package com.alicloud.openservices.tablestore.model.tunnel; + +/** + * 表示Tunnel的类型,目前支持{@link #BaseData}、{@link #Stream}、{@link #BaseAndStream} 这三种类型。 + */ +public enum TunnelType { + /** + * 全量类型。 + */ + BaseData, + + /** + * 增量类型。 + */ + Stream, + + /** + * 全量加增量类型。 + */ + BaseAndStream +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/Channel.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/Channel.java new file mode 100644 index 0000000..af86ad7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/Channel.java @@ -0,0 +1,66 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; + +/** + * Channel的元信息,每一个Channel在某一个版本的状态都是唯一的(服务端角度)。 + */ +public class Channel { + /** + * Channel的ID。 + */ + private String channelId; + /** + * Channel的版本。 + */ + private long version; + /** + * Channel的状态。 + */ + private ChannelStatus status; + + public Channel() { + } + + public Channel(Channel channel) { + this(channel.getChannelId(), channel.getVersion(), channel.getStatus()); + } + + public Channel(String channelId, long version, ChannelStatus status) { + this.channelId = channelId; + this.version = version; + this.status = status; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public long getVersion() { + return version; + } + + public void setVersion(long version) { + this.version = version; + } + + public ChannelStatus getStatus() { + return status; + } + + public void setStatus(ChannelStatus status) { + this.status = status; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[ChannelId: ").append(channelId).append(", Version: ").append(version) + .append(", ChannelStatus: ").append(status.name()).append("]"); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointRequest.java new file mode 100644 index 0000000..5a6d9bc --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointRequest.java @@ -0,0 +1,81 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class CheckpointRequest implements Request { + /** + * Tunnel的ID。 + */ + private String tunnelId; + /** + * 客户端标识,可以从ListTunnel或者DescribeTunnel等接口获取。 + */ + private String clientId; + /** + * Channel的ID。 + */ + private String channelId; + /** + * 数据消费位点。 + */ + private String checkpoint; + /** + * Checkpoint对应的序列号,用于分布式环境下Checkpoint的保序。 + */ + private long sequenceNumber; + + public CheckpointRequest(String tunnelId, String clientId, String channelId, String checkpoint, + long sequenceNumber) { + this.tunnelId = tunnelId; + this.clientId = clientId; + this.channelId = channelId; + this.checkpoint = checkpoint; + this.sequenceNumber = sequenceNumber; + } + + public String getTunnelId() { + return tunnelId; + } + + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getCheckpoint() { + return checkpoint; + } + + public void setCheckpoint(String checkpoint) { + this.checkpoint = checkpoint; + } + + public long getSequenceNumber() { + return sequenceNumber; + } + + public void setSequenceNumber(long sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } + + @Override + public String getOperationName() { + return OperationNames.OP_CHECKPOINT; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointResponse.java new file mode 100644 index 0000000..4cee242 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/CheckpointResponse.java @@ -0,0 +1,9 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.Response; + +public class CheckpointResponse extends Response { + public CheckpointResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelRequest.java new file mode 100644 index 0000000..198ba7d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelRequest.java @@ -0,0 +1,36 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelClientConfig; + +public class ConnectTunnelRequest implements Request { + private String tunnelId; + private TunnelClientConfig config; + + public ConnectTunnelRequest(String tunnelId, TunnelClientConfig config) { + this.tunnelId = tunnelId; + this.config = config; + } + + public String getTunnelId() { + return tunnelId; + } + + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + public TunnelClientConfig getConfig() { + return config; + } + + public void setConfig(TunnelClientConfig config) { + this.config = config; + } + + @Override + public String getOperationName() { + return OperationNames.OP_CONNECT_TUNNEL; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelResponse.java new file mode 100644 index 0000000..1f32af7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ConnectTunnelResponse.java @@ -0,0 +1,19 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.Response; + +public class ConnectTunnelResponse extends Response { + private String clientId; + + public ConnectTunnelResponse(Response meta) { + super(meta); + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointRequest.java new file mode 100644 index 0000000..287eb88 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointRequest.java @@ -0,0 +1,54 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class GetCheckpointRequest implements Request { + /** + * Tunnel的ID。 + */ + private String tunnelId; + /** + * 客户端标识,可以从ListTunnel或者DescribeTunnel等接口获取。 + */ + private String clientId; + /** + * Channel的ID。 + */ + private String channelId; + + public GetCheckpointRequest(String tunnelId, String clientId, String channelId) { + this.tunnelId = tunnelId; + this.clientId = clientId; + this.channelId = channelId; + } + + public String getTunnelId() { + return tunnelId; + } + + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + @Override + public String getOperationName() { + return OperationNames.OP_GETCHECKPOINT; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointResponse.java new file mode 100644 index 0000000..c64bbd5 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/GetCheckpointResponse.java @@ -0,0 +1,37 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.Response; + +public class GetCheckpointResponse extends Response { + /** + * 数据消费位点,Tunnel服务端封装,包含消费总数,消费时间,表主键等信息。 + */ + private String checkpoint; + /** + * Checkpoint对应的序列号,用于分布式环境下Checkpoint的保序。 + */ + private long sequenceNumber; + + public GetCheckpointResponse() { + } + + public GetCheckpointResponse(Response meta) { + super(meta); + } + + public String getCheckpoint() { + return checkpoint; + } + + public void setCheckpoint(String checkpoint) { + this.checkpoint = checkpoint; + } + + public long getSequenceNumber() { + return sequenceNumber; + } + + public void setSequenceNumber(long sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatRequest.java new file mode 100644 index 0000000..c9199fb --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatRequest.java @@ -0,0 +1,48 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import java.util.List; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class HeartbeatRequest implements Request { + private String tunnelId; + private String clientId; + private List channels; + + public HeartbeatRequest(String tunnelId, String clientId, + List channels) { + this.tunnelId = tunnelId; + this.clientId = clientId; + this.channels = channels; + } + + public String getTunnelId() { + return tunnelId; + } + + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public List getChannels() { + return channels; + } + + public void setChannels(List channels) { + this.channels = channels; + } + + @Override + public String getOperationName() { + return OperationNames.OP_HEARTBEAT; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatResponse.java new file mode 100644 index 0000000..6a00c36 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/HeartbeatResponse.java @@ -0,0 +1,21 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import java.util.List; + +import com.alicloud.openservices.tablestore.model.Response; + +public class HeartbeatResponse extends Response { + private List channels; + + public HeartbeatResponse(Response meta) { + super(meta); + } + + public List getChannels() { + return channels; + } + + public void setChannels(List channels) { + this.channels = channels; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsRequest.java new file mode 100644 index 0000000..a3ca134 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsRequest.java @@ -0,0 +1,55 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class ReadRecordsRequest implements Request { + private String tunneId; + private String clientId; + private String channelId; + private String token; + + public ReadRecordsRequest(String tunneId, String clientId, String channelId, String token) { + this.tunneId = tunneId; + this.clientId = clientId; + this.channelId = channelId; + this.token = token; + } + + public String getTunneId() { + return tunneId; + } + + public void setTunneId(String tunneId) { + this.tunneId = tunneId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + @Override + public String getOperationName() { + return OperationNames.OP_READRECORDS; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsResponse.java new file mode 100644 index 0000000..3d25c8e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ReadRecordsResponse.java @@ -0,0 +1,60 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import java.util.List; + +import com.alicloud.openservices.tablestore.model.Response; +import com.alicloud.openservices.tablestore.model.StreamRecord; + +public class ReadRecordsResponse extends Response { + /** + * 请求返回的记录列表 + */ + private List records; + + /** + * 下次读取当前Channel的起始Token。 + */ + private String nextToken; + + /** + * ReadRecordsResponse的字节大小,用于数据读取时的休眠策略。(内部参数) + */ + private int memoizedSerializedSize; + + public ReadRecordsResponse() { + + } + + public ReadRecordsResponse(Response meta) { + super(meta); + } + + /** + * 获取记录列表 + * + * @return 记录列表 + */ + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } + + public int getMemoizedSerializedSize() { + return memoizedSerializedSize; + } + + public void setMemoizedSerializedSize(int memoizedSerializedSize) { + this.memoizedSerializedSize = memoizedSerializedSize; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelRequest.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelRequest.java new file mode 100644 index 0000000..0896f55 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelRequest.java @@ -0,0 +1,35 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.OperationNames; +import com.alicloud.openservices.tablestore.model.Request; + +public class ShutdownTunnelRequest implements Request { + private String tunnelId; + private String clientId; + + public ShutdownTunnelRequest(String tunnelId, String clientId) { + this.tunnelId = tunnelId; + this.clientId = clientId; + } + + public String getTunnelId() { + return tunnelId; + } + + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + @Override + public String getOperationName() { + return OperationNames.OP_SHUTDOWN_TUNNEL; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelResponse.java b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelResponse.java new file mode 100644 index 0000000..fd47d95 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/model/tunnel/internal/ShutdownTunnelResponse.java @@ -0,0 +1,9 @@ +package com.alicloud.openservices.tablestore.model.tunnel.internal; + +import com.alicloud.openservices.tablestore.model.Response; + +public class ShutdownTunnelResponse extends Response { + public ShutdownTunnelResponse(Response meta) { + super(meta); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/AbstractStage.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/AbstractStage.java new file mode 100644 index 0000000..92d8e80 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/AbstractStage.java @@ -0,0 +1,45 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +public abstract class AbstractStage implements Stage { + /** + * 当前阶段的下一个处理阶段。 + */ + private volatile Stage nextStage; + /** + * 当前阶段的上下文。 + */ + private volatile PipelineContext context; + + @Override + @SuppressWarnings("unchecked") + public void setNextStage(Stage stage) { + this.nextStage = (Stage)stage; + } + + @Override + public void init(PipelineContext context) { + this.context = context; + } + + public abstract OUTPUT doProcess(INPUT input) throws StageException; + + @Override + public void process(INPUT input) { + try { + OUTPUT output = doProcess(input); + if (nextStage != null && output != null) { + nextStage.process(output); + } + } catch (StageException se) { + context.handleError(se); + } catch (Exception e) { + context.handleError(new StageException(this, input, "", e)); + } + } + + @Override + public void shutdown() { + + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/IBackoff.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/IBackoff.java new file mode 100644 index 0000000..9e0d513 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/IBackoff.java @@ -0,0 +1,14 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +public interface IBackoff { + /** + * 将BackOfff重设为初始状态。 + */ + void reset(); + + /** + * 获取休眠时间。 + * @return 休眠时间 + */ + long nextBackOffMillis(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Pipeline.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Pipeline.java new file mode 100644 index 0000000..ed6492d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Pipeline.java @@ -0,0 +1,100 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Pipeline extends AbstractStage { + private static final Logger LOG = LoggerFactory.getLogger(Pipeline.class); + + private final List> stages = new LinkedList>(); + /** + * helperExecutor用于初始化,运行中的错误处理等。 + */ + private final ExecutorService helperExecutor; + + public Pipeline(final ExecutorService helperExecutor) { + super(); + this.helperExecutor = helperExecutor; + } + + /** + * 初始化各个Stage的关联关系(前后关系)。 + * + * @param context + */ + @Override + public void init(PipelineContext context) { + Stage preStage = this; + for (Stage stage : stages) { + preStage.setNextStage(stage); + preStage = stage; + } + helperExecutor.submit(new PipelineInitTask(context, stages)); + } + + static class PipelineInitTask implements Runnable { + final List> stages; + final PipelineContext context; + + public PipelineInitTask(PipelineContext context, List> stages) { + this.context = context; + this.stages = stages; + } + + @Override + public void run() { + try { + for (Stage stage : stages) { + stage.init(context); + } + } catch (Exception e) { + LOG.error("Pipeline Init Error", e); + } + } + } + + + public void addExecutorForStage(Stage stage, ExecutorService executorService) { + stages.add(new ThreadPoolStageDecorator(stage, executorService)); + } + + + @Override + @SuppressWarnings("unchecked") + public void process(INPUT input) { + if (!stages.isEmpty()) { + Stage firstStage = (Stage)stages.get(0); + firstStage.process(input); + } + } + + @Override + public OUTPUT doProcess(INPUT input) throws StageException { + return null; + } + + @Override + public void shutdown() { + shutdown(false); + } + + /** + * 关闭当前Pipeline. + * @param isHalt: true代表需要关闭线程池资源,false代表不关闭。 + */ + public void shutdown(boolean isHalt) { + for (Stage stage : stages) { + stage.shutdown(); + } + if (isHalt) { + LOG.info("shutdown pipeline helper executor."); + helperExecutor.shutdownNow(); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/PipelineContext.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/PipelineContext.java new file mode 100644 index 0000000..1ab8cf8 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/PipelineContext.java @@ -0,0 +1,8 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +/** + * 对Pipeline的计算环境进行抽象, 进行错误处理等工作。 + */ +public interface PipelineContext { + void handleError(final StageException ex); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataBackoff.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataBackoff.java new file mode 100644 index 0000000..19d5a2e --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataBackoff.java @@ -0,0 +1,52 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +public class ProcessDataBackoff implements IBackoff { + private static final long STOP = -1L; + // 当前Backoff的间隔。 + private int currentIntervalMillis; + private int initialIntervalMillis = 10; + // randomizationFactor的合理取值范围为[0, 1) + private double randomizationFactor = 0.25; + private double multiplier = 5; + private int maxIntervalMillis = 5000; + // BackOff初始时间,在新构建时或者Reset时更新。 + private long startTimeMillis; + private int maxElapsedTimeMillis = 0; + + public ProcessDataBackoff() { + reset(); + } + + @Override + public void reset() { + currentIntervalMillis = initialIntervalMillis; + startTimeMillis = System.currentTimeMillis(); + } + + @Override + public long nextBackOffMillis() { + if (maxElapsedTimeMillis != 0 && (System.currentTimeMillis() - startTimeMillis) > maxElapsedTimeMillis) { + return STOP; + } + long randomizedInterval = getRandomValueFromInterval(randomizationFactor, Math.random(), currentIntervalMillis); + + if (currentIntervalMillis >= maxIntervalMillis / multiplier) { + currentIntervalMillis = maxIntervalMillis; + } else { + currentIntervalMillis *= multiplier; + } + return randomizedInterval; + } + + private long getRandomValueFromInterval( + double randomizationFactor, double random, int currentIntervalMillis) { + double delta = randomizationFactor * currentIntervalMillis; + double minInterval = currentIntervalMillis - delta; + double maxInterval = currentIntervalMillis + delta; + + long randomValue = (long) (minInterval + (random * (maxInterval - minInterval + 1))); + return randomValue; + } + + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipeline.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipeline.java new file mode 100644 index 0000000..2bbbb9f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipeline.java @@ -0,0 +1,163 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.atomic.AtomicInteger; + +import com.alicloud.openservices.tablestore.model.StreamRecord; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelConnect; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelConnectStatus; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.ProcessRecordsInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static com.alicloud.openservices.tablestore.core.protocol.ResponseFactory.FINISH_TAG; + +/** + * ProcessDataPipeline是ChannelConnect上执行数据读取、数据处理的循环流水线处理任务。 + * 每个阶段都可以指定其特定的执行资源(线程池),任务的每个阶段只会占据相应阶段的处理资源,相互之间不会直接影响,相关的线程池配置在 + * TunnelWorkerConfig里(readRecordsExecutor && processRecordsExecutor)。 + * 当每一轮的数据读取和数据处理完成后,若未发生任何错误,则会马上进行新一轮的处理周期。 + */ +public class ProcessDataPipeline implements Runnable { + private static final Logger LOG = LoggerFactory.getLogger(ProcessDataPipeline.class); + + private final ChannelConnect connect; + private volatile boolean started = false; + private final ThreadPoolExecutor readRecordsExecutor; + private final ThreadPoolExecutor processRecordsExecutor; + /** + * pipelineHelperExecutor用于pipeline初始化,运行中的错误处理等。 + */ + private final ExecutorService pipelineHelperExecutor; + + private ProcessDataBackoff backoff; + private Pipeline pipeline; + + private static final int COUNT_BAR = 500; + private static final int SIZE_BAR = 900 * 1024; // 900K bytes + + public ProcessDataPipeline(ChannelConnect connect, ExecutorService helperExecutor, + ThreadPoolExecutor readRecordsExecutor, ThreadPoolExecutor processRecordsExecutor) { + this.connect = connect; + this.pipelineHelperExecutor = helperExecutor; + this.readRecordsExecutor = readRecordsExecutor; + this.processRecordsExecutor = processRecordsExecutor; + } + + @Override + public void run() { + // 第一次运行Pipeline的时候,进行初始化操作,单个Pipeline实例的运行是串行的,不会存在竞态。 + if (!started) { + LOG.info("Initial process data pipeline."); + this.pipeline = buildPipeline(); + pipeline.init(new ProcessDataPipelineContext(connect)); + started = true; + } + this.pipeline.process(new ReadRecordsRequest(connect.getTunnelId(), connect.getClientId(), + connect.getChannelId(), connect.getToken())); + } + + private Pipeline buildPipeline() { + final Pipeline pipeline = + new Pipeline(pipelineHelperExecutor); + + // 依次插入任务的两个Stage + Stage readRecordsStage = createReadRecordsStage(); + pipeline.addExecutorForStage(readRecordsStage, readRecordsExecutor); + + Stage processRecordStage = createProcessRecordsStage(); + pipeline.addExecutorForStage(processRecordStage, processRecordsExecutor); + + return pipeline; + } + + private Stage createReadRecordsStage() { + return new AbstractStage() { + @Override + public ProcessRecordsInput doProcess(ReadRecordsRequest readRecordsRequest) throws StageException { + if (connect.getStatus() == ChannelConnectStatus.RUNNING) { + if (connect.getToken() != null && !(FINISH_TAG).equals(connect.getToken())) { + try { + LOG.debug("Begin read records, connect: {}", connect); + long beginTs = System.currentTimeMillis(); + ReadRecordsResponse resp = connect.getClient().readRecords(readRecordsRequest); + List records = resp.getRecords(); + LOG.info("GetRecords, Num: {}, Channel connect: {}, Latency: {} ms, Next Token: {}", + records.size(), connect, System.currentTimeMillis() - beginTs, resp.getNextToken()); + if (backoff != null) { + if (checkDataEnough(resp.getRecords().size(), resp.getMemoizedSerializedSize())) { + LOG.debug("Backoff is reset"); + backoff.reset(); + } else { + long sleepMills = backoff.nextBackOffMillis(); + LOG.debug("Data is not full, sleep {} msec.", sleepMills); + Thread.sleep(backoff.nextBackOffMillis()); + } + } + return new ProcessRecordsInput(resp.getRecords(), resp.getNextToken(), resp.getRequestId()); + } catch (Exception e) { + throw new StageException(this, readRecordsRequest, e.getMessage(), e); + } + } else { + LOG.info("Channel is finished, channel will be closed."); + connect.close(true); + throw new StageException(this, readRecordsRequest, "Channel connect is finished."); + } + } else { + throw new StageException(this, readRecordsRequest, "Channel is not running."); + } + } + }; + } + + private Stage createProcessRecordsStage() { + return new AbstractStage() { + @Override + public Boolean doProcess(ProcessRecordsInput processRecordsInput) throws StageException { + if (connect.getStatus() == ChannelConnectStatus.RUNNING) { + try { + IChannelProcessor processor = connect.getProcessor(); + processor.process(processRecordsInput); + + // everything is ok, set channel connect new token, and loop pipeline. + connect.setToken(processRecordsInput.getNextToken()); + LOG.info("Continue run pipeline, connect: {}", connect); + connect.getChannelExecutorService().submit(connect.getProcessPipeline()); + return true; + } catch (Exception e) { + throw new StageException(this, processRecordsInput, e.getMessage(), e); + } + } else { + throw new StageException(this, processRecordsInput, "Channel is not running."); + } + } + }; + } + + /** + * 判断当次的数据是否拉取的足够多,用于数据拉取的休眠策略。 + * + * @param numRec: 数据的条数 + * @param size: 条数的总字节数 + * @return true代表当次拉取的数据足够多,否则,返回false表示当次拉取的数据不够多。 + */ + private boolean checkDataEnough(int numRec, int size) { + return numRec > COUNT_BAR || size > SIZE_BAR; + } + + public ProcessDataBackoff getBackoff() { + return backoff; + } + + public void setBackoff(ProcessDataBackoff backoff) { + this.backoff = backoff; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipelineContext.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipelineContext.java new file mode 100644 index 0000000..637569f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ProcessDataPipelineContext.java @@ -0,0 +1,28 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelConnect; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelConnectStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ProcessDataPipleline计算环境的抽象,主要进行错误处理等操作。 + */ +public class ProcessDataPipelineContext implements PipelineContext { + private static final Logger LOG = LoggerFactory.getLogger(ProcessDataPipelineContext.class); + private ChannelConnect connect; + + public ProcessDataPipelineContext(ChannelConnect connect) { + this.connect = connect; + } + + @Override + public void handleError(StageException ex) { + // CLOSED状态的ChannelConnect代表已经被关闭了, 其它状态的ChannelConnect发生异常需要将ChannelConnect关闭。 + if (connect.getStatus() != ChannelConnectStatus.CLOSED) { + LOG.warn("Channel connect will be closed, channelId: {}, error detail: [{},{}]", + connect.getChannelId(), ex.getCause(), ex.getMessage()); + connect.close(false); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Stage.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Stage.java new file mode 100644 index 0000000..7ea190f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Stage.java @@ -0,0 +1,11 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +public interface Stage { + void init(PipelineContext context); + + void setNextStage(Stage stage); + + void process(INPUT input); + + void shutdown(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/StageException.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/StageException.java new file mode 100644 index 0000000..12f12ff --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/StageException.java @@ -0,0 +1,23 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +public class StageException extends Exception { + private Stage stage; + private Object input; + + public StageException(Stage stage, Object input, String message) { + super(message); + this.stage = stage; + this.input = input; + } + + public StageException(Stage stage, Object input, String message, Throwable cause) { + super(message, cause); + this.stage = stage; + this.input = input; + } + + @Override + public String toString() { + return input.toString() + super.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ThreadPoolStageDecorator.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ThreadPoolStageDecorator.java new file mode 100644 index 0000000..3e2f10c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/ThreadPoolStageDecorator.java @@ -0,0 +1,39 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +import java.util.concurrent.ExecutorService; + +public class ThreadPoolStageDecorator implements Stage { + final Stage stage; + final ExecutorService executorService; + + public ThreadPoolStageDecorator(Stage stage, ExecutorService executorService) { + this.stage = stage; + this.executorService = executorService; + } + + @Override + public void setNextStage(Stage nextPipe) { + stage.setNextStage(nextPipe); + } + + @Override + public void init(PipelineContext context) { + stage.init(context); + } + + @Override + public void process(final INPUT input) { + Runnable task = new Runnable() { + @Override + public void run() { + stage.process(input); + } + }; + + executorService.submit(task); + } + + public void shutdown() { + executorService.shutdown(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Utils.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Utils.java new file mode 100644 index 0000000..d2578ca --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/pipeline/Utils.java @@ -0,0 +1,45 @@ +package com.alicloud.openservices.tablestore.tunnel.pipeline; + +import com.alicloud.openservices.tablestore.core.protocol.TunnelServiceApi; +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Utils { + private static final Logger LOG = LoggerFactory.getLogger(Utils.class); + + private static TunnelServiceApi.TokenContentV2 parseRequestToken(String token) throws Exception { + TunnelServiceApi.Token tokenPb = TunnelServiceApi.Token.parseFrom(Base64.decodeBase64(token)); + if (!tokenPb.hasVersion()) { + throw new Exception("token miss must field: version."); + } + + switch ((int)tokenPb.getVersion()) { + case 1: + TunnelServiceApi.TokenContent tokenContent = TunnelServiceApi.TokenContent.parseFrom(tokenPb.getContent()); + TunnelServiceApi.TokenContentV2.Builder tokenBuilder = TunnelServiceApi.TokenContentV2.newBuilder(); + tokenBuilder.setPrimaryKey(tokenContent.getPrimaryKey()); + tokenBuilder.setTimestamp(tokenContent.getTimestamp()); + tokenBuilder.setIterator(tokenContent.getIterator()); + tokenBuilder.setTotalCount(0); + return tokenBuilder.build(); + case 2: + return TunnelServiceApi.TokenContentV2.parseFrom(tokenPb.getContent()); + default: + throw new Exception(String.format("token version %d not support", tokenPb.getVersion())); + } + } + + /** + * TODO: Get channel type directly from tunnel server. + */ + public static boolean isStreamToken(String token) { + try { + TunnelServiceApi.TokenContentV2 tokenContentV2 = parseRequestToken(token); + return !tokenContentV2.getIterator().isEmpty(); + } catch (Exception e) { + LOG.error("parse token error, detail: {}", e.toString()); + return false; + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnect.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnect.java new file mode 100644 index 0000000..300c6d1 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnect.java @@ -0,0 +1,253 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +import com.alicloud.openservices.tablestore.TunnelClientInterface; +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.tunnel.pipeline.ProcessDataPipeline; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ChannelConnect维护数据消费的状态和所需的相关资源。 + * ChannelConnect的状态和其对应的Channel息息相关,对应的细节可参见: {@link TunnelStateMachine}的说明。 + */ +public class ChannelConnect implements IChannelConnect { + private static final Logger LOG = LoggerFactory.getLogger(ChannelConnect.class); + + private String tunnelId; + private String clientId; + private String channelId; + private String token; + + private TunnelClientInterface client; + private IChannelProcessor processor; + private Channel currentChannel; + private TunnelStateMachine stateMachine; + private AtomicReference status = new AtomicReference(ChannelConnectStatus.WAIT); + /** + * Channel的数据是否已经拉完了,拉到finished token值了(全量类型的Channel最终会拉完) + */ + private AtomicBoolean finished = new AtomicBoolean(false); + /** + * 是否为增量类型的Channel, 增量类型的Channel单次数据拉取不足时需要加退避。 + */ + private boolean streamChannel; + private ICheckpointer checkpointer; + private ProcessDataPipeline processPipeline; + /** + * 用于Channel提交Pipeline任务(读数据,处理数据等) + */ + private ExecutorService channelExecutorService; + private ThreadPoolExecutor readRecordsExecutor; + private ThreadPoolExecutor processRecordsExecutor; + + @Override + public synchronized void notifyStatus(Channel channel) { + LOG.debug("Begin notify status, channel: {}", channel); + if (currentChannel != null && currentChannel.getVersion() > channel.getVersion()) { + return; + } + currentChannel = new Channel(channel); + switch (currentChannel.getStatus()) { + case CLOSE: + LOG.info("Closed channel status {}", this); + close(false); + break; + case CLOSING: + //draw closing action and check closed/finish status + if (status.get() == ChannelConnectStatus.WAIT) { + status.set(ChannelConnectStatus.CLOSED); + } else { + status.compareAndSet(ChannelConnectStatus.RUNNING, ChannelConnectStatus.CLOSING); + } + checkAndUpdateChannelStatus(); + break; + case OPEN: + if (status.compareAndSet(ChannelConnectStatus.WAIT, ChannelConnectStatus.RUNNING)) { + // 提交pipeline任务,pipeline会循环的进行数据处理 + LOG.info("Submit pipeline task, channel connect :{}", this); + if (channelExecutorService != null) { + channelExecutorService.submit(processPipeline); + } + } else { + checkAndUpdateChannelStatus(); + } + break; + case TERMINATED: + LOG.info("Terminated channel status {}", this); + close(true); + break; + default: + LOG.warn("Unexpected channel status {}", this); + } + } + + public void checkAndUpdateChannelStatus() { + LOG.debug("Check update status, ChannelConnectStatus: {}", status.get().name()); + if (status.get() == ChannelConnectStatus.CLOSED) { + currentChannel.setVersion(currentChannel.getVersion() + 1); + if (finished.get()) { + currentChannel.setStatus(ChannelStatus.TERMINATED); + } else { + currentChannel.setStatus(ChannelStatus.CLOSE); + } + + LOG.info("Update channel status, current channel: {}", currentChannel); + stateMachine.updateStatus(currentChannel); + } + } + + @Override + public boolean closed() { + return status.get() == ChannelConnectStatus.CLOSED; + } + + @Override + public void close() { + close(false); + } + + public void close(boolean finish) { + if (status.get() != ChannelConnectStatus.CLOSED) { + LOG.info("Shutdown Channel connect."); + if (processor != null) { + processor.shutdown(); + } + if (finish) { + finished.set(true); + } + status.set(ChannelConnectStatus.CLOSED); + LOG.info("After close, ChannelConnectStatus: {}", status.get()); + } + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[").append("TunnelId: ").append(tunnelId).append(", ClientId: ").append(clientId) + .append(", ChannelId: ").append(channelId).append(", CurrentChannel: ") + .append(currentChannel).append("]"); + return sb.toString(); + } + + public String getTunnelId() { + return tunnelId; + } + + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public TunnelClientInterface getClient() { + return client; + } + + public void setClient(TunnelClientInterface client) { + this.client = client; + } + + public IChannelProcessor getProcessor() { + return processor; + } + + public void setProcessor(IChannelProcessor processor) { + this.processor = processor; + } + + public Channel getCurrentChannel() { + return currentChannel; + } + + public void setCurrentChannel(Channel currentChannel) { + this.currentChannel = currentChannel; + } + + public TunnelStateMachine getStateMachine() { + return stateMachine; + } + + public void setStateMachine(TunnelStateMachine stateMachine) { + this.stateMachine = stateMachine; + } + + public ChannelConnectStatus getStatus() { + return status.get(); + } + + public void setStatus(ChannelConnectStatus status) { + this.status.set(status); + } + + public AtomicBoolean getFinished() { + return finished; + } + + public void setFinished(AtomicBoolean finished) { + this.finished = finished; + } + + public boolean isStreamChannel() { + return streamChannel; + } + + public void setStreamChannel(boolean streamChannel) { + this.streamChannel = streamChannel; + } + + public ICheckpointer getCheckpointer() { + return checkpointer; + } + + public void setCheckpointer(ICheckpointer checkpointer) { + this.checkpointer = checkpointer; + } + + public ProcessDataPipeline getProcessPipeline() { + return processPipeline; + } + + public void setProcessPipeline( + ProcessDataPipeline processPipeline) { + this.processPipeline = processPipeline; + } + + public ExecutorService getChannelExecutorService() { + return channelExecutorService; + } + + public void setChannelExecutorService(ExecutorService channelExecutorService) { + this.channelExecutorService = channelExecutorService; + } +} + + + diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnectStatus.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnectStatus.java new file mode 100644 index 0000000..b9696e0 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelConnectStatus.java @@ -0,0 +1,20 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public enum ChannelConnectStatus { + /** + * 等待状态,ChannelConnect的初始状态。 + */ + WAIT, + /** + * 运行状态。 + */ + RUNNING, + /** + * 关闭中。 + */ + CLOSING, + /** + * 已关闭。 + */ + CLOSED +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelDialer.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelDialer.java new file mode 100644 index 0000000..656a81a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelDialer.java @@ -0,0 +1,69 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import com.alicloud.openservices.tablestore.TunnelClientInterface; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.tunnel.pipeline.ProcessDataBackoff; +import com.alicloud.openservices.tablestore.tunnel.pipeline.ProcessDataPipeline; +import com.alicloud.openservices.tablestore.tunnel.pipeline.Utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ChannelDialer implements IChannelDialer { + private static final Logger LOG = LoggerFactory.getLogger(ChannelDialer.class); + + private final TunnelClientInterface client; + private final TunnelWorkerConfig config; + private final ExecutorService channelHelperExecutor; + + public ChannelDialer(TunnelClientInterface client, TunnelWorkerConfig config) { + Preconditions.checkNotNull(client, "Tunnel client cannot be null."); + Preconditions.checkNotNull(config, "Tunnel worker config cannot be null."); + + this.client = client; + this.config = config; + this.channelHelperExecutor = Executors.newCachedThreadPool(new ThreadFactory() { + private final AtomicInteger counter = new AtomicInteger(0); + + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "channel-helper-executor-" + counter.getAndIncrement()); + } + }); + } + + @Override + public IChannelConnect channelDial(String tunnelId, String clientId, String channelId, String token, + IChannelProcessor processor, TunnelStateMachine stateMachine) { + LOG.info("Channel dialer create new channel connect, tunnelId: {}, clientId: {}, channelId: {}, token: {}", + tunnelId, clientId, channelId, token); + ChannelConnect channelConnect = new ChannelConnect(); + channelConnect.setTunnelId(tunnelId); + channelConnect.setClientId(clientId); + channelConnect.setChannelId(channelId); + channelConnect.setToken(token); + channelConnect.setClient(client); + channelConnect.setProcessor(processor); + channelConnect.setStateMachine(stateMachine); + channelConnect.setFinished(new AtomicBoolean(false)); + channelConnect.setStreamChannel(Utils.isStreamToken(token)); + channelConnect.setProcessPipeline(new ProcessDataPipeline(channelConnect, channelHelperExecutor, + config.getReadRecordsExecutor(), config.getProcessRecordsExecutor())); + if (channelConnect.isStreamChannel()) { + channelConnect.getProcessPipeline().setBackoff(new ProcessDataBackoff()); + } + channelConnect.setChannelExecutorService(channelHelperExecutor); + return channelConnect; + } + + @Override + public void shutdown() { + LOG.info("Shutdown pipeline helper executor."); + channelHelperExecutor.shutdownNow(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelProcessFactory.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelProcessFactory.java new file mode 100644 index 0000000..353b626 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ChannelProcessFactory.java @@ -0,0 +1,21 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +/** + * 带记录数据消费位点功能的Channel数据处理器的工厂类。 + */ +public class ChannelProcessFactory implements IChannelProcessorFactory { + private TunnelWorkerConfig config; + + public ChannelProcessFactory(TunnelWorkerConfig config) { + this.config = config; + } + + @Override + public IChannelProcessor createProcessor(String tunnelId, String clientId, String channelId, + ICheckpointer checkpointer) { + DefaultChannelProcessor processor = new DefaultChannelProcessor(config.getChannelProcessor(), checkpointer, + config.getCheckpointIntervalInMillis()); + return processor; + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/Checkpointer.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/Checkpointer.java new file mode 100644 index 0000000..f34a5e6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/Checkpointer.java @@ -0,0 +1,111 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.TunnelClientInterface; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static com.alicloud.openservices.tablestore.core.ErrorCode.CLIENT_ERROR; +import static com.alicloud.openservices.tablestore.core.ErrorCode.SEQUENCE_NUMBER_NOT_MATCH; +import static com.alicloud.openservices.tablestore.core.protocol.ResponseFactory.FINISH_TAG; + +/** + * Checkpoint记录器,用于Channel(向服务器)记录数据消费位点。 + */ +public class Checkpointer implements ICheckpointer { + private static final Logger LOG = LoggerFactory.getLogger(Checkpointer.class); + + private TunnelClientInterface client; + private String tunnelId; + private String clientId; + private String channelId; + private long sequenceNumber; + + public Checkpointer(TunnelClientInterface client, String tunnelId, String clientId, + String channelId, long sequenceNumber) { + this.client = client; + this.tunnelId = tunnelId; + this.clientId = clientId; + this.channelId = channelId; + this.sequenceNumber = sequenceNumber; + } + + @Override + public void checkpoint(String token) { + try { + if (token == null) { + token = FINISH_TAG; + } + client.checkpoint(new CheckpointRequest(tunnelId, clientId, channelId, token, sequenceNumber)); + this.sequenceNumber += 1; + LOG.info("Finish do checkpoint,token:{}, checkpointer: {}", token, this); + } catch (TableStoreException te) { + // 当发生序列号冲突时,从服务端读取sequenceNumber进行本机内存的更新。 + if (te.getErrorCode().equals(SEQUENCE_NUMBER_NOT_MATCH)) { + try { + GetCheckpointResponse getResp = client.getCheckpoint( + new GetCheckpointRequest(tunnelId, clientId, channelId)); + this.sequenceNumber = getResp.getSequenceNumber() + 1; + } catch (Exception ge) { + String errorMsg = String.format("Checkpoint failed %s and check sequence failed %s", te, ge); + LOG.warn(errorMsg); + throw new TableStoreException(errorMsg, CLIENT_ERROR); + } + } + } catch (Exception e) { + LOG.warn("Checkpoint occurs error, detail: {}", e); + } + } + + public TunnelClientInterface getClient() { + return client; + } + + public void setClient(TunnelClientInterface client) { + this.client = client; + } + + public String getTunnelId() { + return tunnelId; + } + + public void setTunnelId(String tunnelId) { + this.tunnelId = tunnelId; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public long getSequenceNumber() { + return sequenceNumber; + } + + public void setSequenceNumber(long sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[TunnelId: ").append(tunnelId).append(", ClientId: ").append(clientId) + .append(", ChannelId: ").append(channelId).append(", SequenceNumber: ").append(sequenceNumber).append("]"); + return sb.toString(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/DefaultChannelProcessor.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/DefaultChannelProcessor.java new file mode 100644 index 0000000..fcdb27d --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/DefaultChannelProcessor.java @@ -0,0 +1,54 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static com.alicloud.openservices.tablestore.core.protocol.ResponseFactory.FINISH_TAG; + +public class DefaultChannelProcessor implements IChannelProcessor { + private static final Logger LOG = LoggerFactory.getLogger(DefaultChannelProcessor.class); + + private final IChannelProcessor recordProcessor; + private long latestCheckpoint = System.currentTimeMillis(); + private final long checkpointIntervalInMillis; + private final ICheckpointer checkpointer; + + public DefaultChannelProcessor(IChannelProcessor recordProcessor, ICheckpointer checkpointer, + long checkpointIntervalInMillis) { + Preconditions.checkNotNull(recordProcessor, "Channel record processor cannot be null."); + Preconditions.checkNotNull(checkpointer, "Checkpointer cannot be null."); + + this.recordProcessor = recordProcessor; + this.checkpointer = checkpointer; + this.checkpointIntervalInMillis = checkpointIntervalInMillis; + } + + @Override + public void process(ProcessRecordsInput input) { + recordProcessor.process(input); + + // 当数据已经处理到FinishedTag时,需要向服务端记录checkpoint. + if (input.getNextToken() == null || FINISH_TAG.equals(input.getNextToken())) { + LOG.info("begin do checkpoint, token = {}", input.getNextToken()); + try { + checkpointer.checkpoint(FINISH_TAG); + } catch (Exception e) { + LOG.error("checkpoint error, detail: {}", e); + } + } else if (System.currentTimeMillis() - latestCheckpoint > checkpointIntervalInMillis) { + LOG.info("begin do checkpoint, token = {}", input.getNextToken()); + try { + checkpointer.checkpoint(input.getNextToken()); + } catch (Exception e) { + LOG.error("checkpoint error, detail: {}", e); + } + latestCheckpoint = System.currentTimeMillis(); + } + } + + @Override + public void shutdown() { + recordProcessor.shutdown(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/FailedChannelConnect.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/FailedChannelConnect.java new file mode 100644 index 0000000..71dc966 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/FailedChannelConnect.java @@ -0,0 +1,63 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class FailedChannelConnect implements IChannelConnect { + private static final Logger LOG = LoggerFactory.getLogger(FailedChannelConnect.class); + + private TunnelStateMachine stateMachine; + private Channel currentChannel; + + public FailedChannelConnect(TunnelStateMachine stateMachine) { + this.stateMachine = stateMachine; + } + + public Channel getCurrentChannel() { + return currentChannel; + } + + public void setCurrentChannel(Channel currentChannel) { + this.currentChannel = currentChannel; + } + + @Override + public synchronized void notifyStatus(Channel channel) { + if (currentChannel != null && currentChannel.getVersion() > channel.getVersion()) { + return; + } + currentChannel = new Channel(channel); + switch (currentChannel.getStatus()) { + case CLOSE: + break; + case CLOSING: + case OPEN: + currentChannel.setVersion(currentChannel.getVersion() + 1); + currentChannel.setStatus(ChannelStatus.CLOSE); + stateMachine.updateStatus(currentChannel); + break; + case TERMINATED: + break; + default: + LOG.error("unexpected channel status {}, channelId: {}", currentChannel.getStatus().name(), + currentChannel.getChannelId()); + } + } + + @Override + public synchronized boolean closed() { + if (currentChannel == null) { + return false; + } + return currentChannel.getStatus().equals(ChannelStatus.CLOSE) || + currentChannel.getStatus().equals(ChannelStatus.TERMINATED); + } + + @Override + public void close() { + + } + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelConnect.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelConnect.java new file mode 100644 index 0000000..eaf52a6 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelConnect.java @@ -0,0 +1,22 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; + +public interface IChannelConnect { + /** + * 根据Channel的元信息来更新该Channel(内存中)对应的ChannelConnect。 + * @param channel + */ + void notifyStatus(Channel channel); + + /** + * ChannelConnect是否被关闭。 + * @return + */ + boolean closed(); + + /** + * 关闭ChannelConnect。 + */ + void close(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelDialer.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelDialer.java new file mode 100644 index 0000000..1bce05b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelDialer.java @@ -0,0 +1,7 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public interface IChannelDialer { + IChannelConnect channelDial(String tunnelId, String clientId, String channelId, String token, + IChannelProcessor processor, TunnelStateMachine state); + void shutdown(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessor.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessor.java new file mode 100644 index 0000000..fad0dcc --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessor.java @@ -0,0 +1,14 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public interface IChannelProcessor { + /** + * 增量数据的消费Callback. + * @param input: 本次的增量数据,包括Stream Records和Next Token等信息。 + */ + void process(ProcessRecordsInput input); + + /** + * 用户注册的Shutdown函数,用于注册资源(例如线程池,数据库连接)的回收等。 + */ + void shutdown(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessorFactory.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessorFactory.java new file mode 100644 index 0000000..0dd89f3 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/IChannelProcessorFactory.java @@ -0,0 +1,5 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public interface IChannelProcessorFactory { + IChannelProcessor createProcessor(String tunnelId, String clientId, String channelId, ICheckpointer checkpointer); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ICheckpointer.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ICheckpointer.java new file mode 100644 index 0000000..5b2b41b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ICheckpointer.java @@ -0,0 +1,5 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public interface ICheckpointer { + void checkpoint(String token); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ITunnelWorker.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ITunnelWorker.java new file mode 100644 index 0000000..ce1b01f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ITunnelWorker.java @@ -0,0 +1,6 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public interface ITunnelWorker { + void connectAndWorking() throws Exception; + void shutdown(); +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ProcessRecordsInput.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ProcessRecordsInput.java new file mode 100644 index 0000000..3d5ff75 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ProcessRecordsInput.java @@ -0,0 +1,47 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import java.util.List; + +import com.alicloud.openservices.tablestore.model.StreamRecord; + +public class ProcessRecordsInput { + private List records; + private String nextToken; + private String traceId; + + public ProcessRecordsInput(List records, String nextToken, String traceId) { + this.records = records; + this.nextToken = nextToken; + this.traceId = traceId; + } + + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } + + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + @Override + public String toString() { + //TODO + return ""; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ReadRecordsPipeResult.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ReadRecordsPipeResult.java new file mode 100644 index 0000000..ce11287 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/ReadRecordsPipeResult.java @@ -0,0 +1,68 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import java.util.List; + +import com.alicloud.openservices.tablestore.model.StreamRecord; + +public class ReadRecordsPipeResult { + private boolean finished; + private List records; + private String requestId; + private String nextToken; + private long sleepMillis; + + /** + * Task执行过程中抛出的异常,会catch保存在这里。 + */ + private Exception exception; + + public boolean isFinished() { + return finished; + } + + public void setFinished(boolean finished) { + this.finished = finished; + } + + public List getRecords() { + return records; + } + + public void setRecords(List records) { + this.records = records; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getNextToken() { + return nextToken; + } + + public void setNextToken(String nextToken) { + this.nextToken = nextToken; + } + + public Exception getException() { + return exception; + } + + public void setException(Exception exception) { + this.exception = exception; + } + + public long getSleepMillis() { + return sleepMillis; + } + + public void setSleepMillis(long sleepMillis) { + this.sleepMillis = sleepMillis; + } + + +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelClientConfig.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelClientConfig.java new file mode 100644 index 0000000..7c76a0a --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelClientConfig.java @@ -0,0 +1,37 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public class TunnelClientConfig { + /** + * 超时时间,单位为秒,默认为300s。 + */ + private long timeout = 300; + + /** + * 客户端的标识,默认为主机名。 + */ + private String clientTag = System.getProperty("os.name"); + + public TunnelClientConfig() { + } + + public TunnelClientConfig(long timeout, String clientTag) { + this.timeout = timeout; + this.clientTag = clientTag; + } + + public long getTimeout() { + return timeout; + } + + public void setTimeout(long timeout) { + this.timeout = timeout; + } + + public String getClientTag() { + return clientTag; + } + + public void setClientTag(String clientTag) { + this.clientTag = clientTag; + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelStateMachine.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelStateMachine.java new file mode 100644 index 0000000..c6b5fc2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelStateMachine.java @@ -0,0 +1,181 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import com.alicloud.openservices.tablestore.TunnelClientInterface; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TunnelStateMachine用于Channel和ChannelConnect状态的维护和更新(包括本机内存以及和Tunnel服务端的交互)。 + * Channel的状态有五类: WAIT, OPEN, CLOSING, CLOSE, TERMINATED。Channel状态的说明如下: + * 1. WAIT: 等待状态,当Tunnel创建时,Tunnel服务端会预先创建一批待分配(WAIT)的Channel, 以供Tunnel客户端来连接。 + * 2. OPEN: 启动状态,当TunnelClient调用heartbeat接口时,Tunnel服务器会给TunnelClient分配Channel,并将这些Channel的状态置为OPEN. + * 3. CLOSING: 关闭中状态,当有新的TunnelClient加入或者退出时,Tunnel服务端会把Channel置为Closing,Closing状态的Channel是一种暂态, + * 表示Tunnel服务端正在进行Channel的重新调度,在此状态下,客户端必须先将本机内存中的Channel状态转为CLOSED, 再通过heartbeat上报给Tunnel服务端 + * 进行统一的状态处理,Channel调度和重新分配。 + * 4. CLOSE: 关闭状态,当TunnelClient出现错误或者正常的shutdown时,Channel的状态会被置为CLOSE,CLOSE状态的Channel只是暂时的关闭,和WAIT + * 状态的Channel类似,当有TunnelClient重新调用heartbeat接口时,CLOSE状态的Channel会被重新分配到新的TunnelClient, 状态也会变成OPEN. + * 5. TERMINATED: 结束状态,当Channel上的数据消费完成后,会进入此状态。全量类型的Channel最终都会被消费完成,转入此状态,而增量状态的Channel则 + * 不会进入此状态(流式数据无尽头)。 + * + * ChannelConnect和Channel对应,有WAIT, RUNNING, CLOSING, CLOSE四种状态, 相关说明如下: + * 1. WAIT: 等待状态,ChannelConnect被创建出来的初始状态。 + * 2. RUNNING: 运行中,此状态代表ChannelConnect工作良好,正在不断的拉取数据,处理数据和记录消费位点。 + * 3. CLOSING: 关闭中,对应到Channel的CLOSING状态,处于此状态的ChannelConnect在数据处理过程中,会中断数据处理,并转为CLOSED状态。 + * 4. CLOSED: 已关闭,ChannelConnect处于此状态已经无法再进行数据消费了,需要从活跃连接中移除,同时需要将其对应的Channel更新为CLOSE或TERMINATED状态。 + */ +public class TunnelStateMachine { + private static final Logger LOG = LoggerFactory.getLogger(TunnelStateMachine.class); + + private String tunnelId; + private String clientId; + + private TunnelClientInterface client; + /** + * 创建ChannelConnect的拨号器。 + */ + private IChannelDialer dialer; + /** + * 带定期Checkpoint功能的Channel数据处理器。 + */ + private IChannelProcessorFactory processorFactory; + + private volatile ConcurrentHashMap channelConnects; + private volatile ConcurrentHashMap currentChannels; + + public TunnelStateMachine(String tunnelId, String clientId, IChannelDialer dialer, + IChannelProcessorFactory processorFactory, TunnelClientInterface client) { + Preconditions.checkArgument(tunnelId != null && !tunnelId.isEmpty(), + "The tunnel id should not be null or empty."); + Preconditions.checkArgument(clientId != null && !clientId.isEmpty(), + "The client id should not be null or empty."); + Preconditions.checkNotNull(dialer, "Channel dialer cannot be null."); + Preconditions.checkNotNull(processorFactory, "Channel process factory cannot be null."); + Preconditions.checkNotNull(client, "Tunnel client cannot be null."); + + this.tunnelId = tunnelId; + this.clientId = clientId; + this.dialer = dialer; + this.processorFactory = processorFactory; + this.client = client; + this.channelConnects = new ConcurrentHashMap(); + this.currentChannels = new ConcurrentHashMap(); + } + + /** + * 更新StateMachine中的活跃Channel信息,同时移除(ChannelId相同的)处于Closed状态的ChannelConnect. + * + * @param channel + */ + public void updateStatus(Channel channel) { + LOG.debug("Begin update channel status, channel: {}", channel); + String channelId = channel.getChannelId(); + Channel currentChannel = currentChannels.get(channelId); + if (currentChannel == null) { + LOG.info("Redundant channel, channelId: {}, status: {}", channelId, channel.getStatus().name()); + return; + } + LOG.debug("CurrentChannel: {}, UpdateChannel: {}", currentChannel, channel); + if (currentChannel.getVersion() >= channel.getVersion()) { + LOG.info("Expired channel version, channelId: {}, current version: {}, old version: {}", + channelId, currentChannel.getVersion(), channel.getVersion()); + return; + } + currentChannels.put(channelId, channel); + + IChannelConnect channelConnect = channelConnects.get(channelId); + if (channelConnect != null) { + if (channelConnect.closed()) { + channelConnects.remove(channelId); + } + } + } + + public List batchGetChannelConnects() { + return new ArrayList(channelConnects.values()); + } + + public List batchGetChannels() { + return new ArrayList(currentChannels.values()); + } + + public void batchUpdateChannels(List batchChannels) { + LOG.info("Begin batch update channels"); + // 根据Channel中的版本号先做Merge, 保证CurrentChannels里都是版本号较大的Channel。 + this.currentChannels = mergeChannels(batchChannels); + // 根据Channel信息更新ChannelConnect的状态。 + for (Map.Entry entry : currentChannels.entrySet()) { + String channelId = entry.getKey(); + IChannelConnect channelConnect = channelConnects.get(channelId); + if (channelConnect == null) { + try { + GetCheckpointResponse resp = client.getCheckpoint( + new GetCheckpointRequest(tunnelId, clientId, channelId)); + LOG.info("Get checkpoint response, channelId: {}, checkpoint: {}, sequenceNumber: {}", + channelId, resp.getCheckpoint(), resp.getSequenceNumber()); + // 根据用户传入的处理数据的Callback和TunnelWorkerConfig中CheckpointInterval(向服务端记数据位点的间隔) + // 包装出一个带自动记Checkpoint功能的数据处理器 + IChannelProcessor channelProcessor = processorFactory.createProcessor(tunnelId, clientId, channelId, + new Checkpointer(client, tunnelId, clientId, channelId, resp.getSequenceNumber() + 1)); + channelConnect = dialer.channelDial(tunnelId, clientId, channelId, resp.getCheckpoint(), + channelProcessor, this); + channelConnects.put(channelId, channelConnect); + } catch (Exception e) { + LOG.warn("Failed to update channel, error detail: {}", e.toString()); + channelConnect = new FailedChannelConnect(this); + } + } + channelConnect.notifyStatus(entry.getValue()); + } + + // 根据当前活跃的Channel连接来清除无效的Channel信息。 + for (Map.Entry entry : channelConnects.entrySet()) { + String channelId = entry.getKey(); + Channel channel = currentChannels.get(channelId); + if (channel == null) { + LOG.info("Clear redundant channel connect, channelId: {}", channelId); + IChannelConnect channelConnect = entry.getValue(); + if (!channelConnect.closed()) { + channelConnect.close(); + } + channelConnects.remove(channelId); + } + } + + } + + private ConcurrentHashMap mergeChannels(List batchChannels) { + ConcurrentHashMap updatedChannels = new ConcurrentHashMap( + batchChannels.size()); + for (Channel channel : batchChannels) { + String channelId = channel.getChannelId(); + Channel oldChannel = currentChannels.get(channelId); + if (oldChannel != null) { + if (channel.getVersion() >= oldChannel.getVersion()) { + updatedChannels.put(channelId, channel); + } else { + updatedChannels.put(channelId, oldChannel); + } + } else { + updatedChannels.put(channelId, channel); + } + } + return updatedChannels; + } + + public void close() { + LOG.info("Begin close tunnel state machine."); + for (IChannelConnect connect : channelConnects.values()) { + connect.close(); + } + LOG.info("Tunnel state machine is closed"); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorker.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorker.java new file mode 100644 index 0000000..bcb2608 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorker.java @@ -0,0 +1,261 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import java.util.Date; +import java.util.List; +import java.util.Random; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.TunnelClientInterface; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static com.alicloud.openservices.tablestore.core.ErrorCode.RESOURCE_GONE; + +/** + * TunnelWorker是基于TableStore数据接口之上的全增量一体化服务,用户可以简单地实现对表中历史存量和新增数据的消费处理。 + * TunnelWorker的设计哲学是通过每一轮的定时心跳探测(Heartbeat)来进行活跃Channel的探测,Channel和ChannelConnect状态的更新,数据处理任务的初始化、运行和结束等。 + * TunnelWorker实现自动化数据处理的流程如下: + * 1. TunnelWorker资源的初始化 + * 1.1 将TunnelWorker状态原子的由Ready置为Started(CAS操作)。 + * 1.2 根据TunnelWorkerConfig里的HeartbeatTimeout和ClientTag(客户端标识)等配置进行ConnectTunnel操作,和Tunnel服务端进行联通, + * 并获取当前TunnelWorker对应的ClientId。 + * 1.3 初始化ChannelDialer(用于新建ChannelConnect), 每一个ChannelConnect都会和一个Channel一一对应,ChannelConnect上会记录 + * 有数据消费的位点。 + * 1.4 根据用户传入的处理数据的Callback和TunnelWorkerConfig中CheckpointInterval(向服务端记数据位点的间隔) + * 包装出一个带自动记Checkpoint功能的数据处理器, 详细参见: ChannelProcessFactory。 + * 1.5 初始化TunnelStateMachine(会进行Channel状态机的自动化处理)。 + * + * 2. 固定间隔进行Heartbeat,间隔由TunnelWorkerConfig里的heartbeatIntervalInSec参数决定。 + * 2.1 进行heartbeat请求,从Tunnel服务端获取最新可用的Channel列表,Channel中会包含有ChannelId, Channel的版本和Channel的状态信息。 + * 2.2 将服务端获取到的Channel列表和本地内存中的Channel列表进行Merge,然后进行ChannelConnect的新建和update,规则大致如下 + * 1) Merge: 相同ChannelId,认定版本号更大的为最新状态,直接进行覆盖,若未出现的Channel,则直接插入。 + * 2) 新建ChannelConnect: 若此Channel未新建有其对应的ChannelConnect,则会新建一个WAIT状态的ChannelConnect,若对应的Channel + * 状态为OPEN状态,则同时会启动该ChannelConnect上的处理数据的循环流水线任务(ReadRecords&&ProcessRecords), + * 处理详细的细节可以参见ProcessDataPipeline。 + * 3) Update已有ChannelConnect: Merge完成后,若Channel对应的ChannelConnect存在,则根据相同ChannelId的Channel状态来更新 + * ChannelConnect的状态,比如Channel为Close状态也需要将ChannelConnect的状态置为Closed,进而终止处理任务的流水线任务, + * 详细的细节可以参见ChannelConnect.notifyStatus方法。 + * + * 3. 自动化的负载均衡和良好的水平扩展性 + * 运行多个TunnelWorker对同一个Tunnel进行消费时(TunnelId相同), 在TunnelWorker执行Heartbeat时,Tunnel服务端会自动的对Channel资源进行重分配, + * 让活跃的Channel尽可能的均摊到每一个TunnelWorker上,达到资源负载均衡的目的。同时,在水平扩展性方面,用户可以很容易的通过增加TunnelWorker的 + * 数量来完成,TunnelWorker可以在同一个机器或者不同机器上。 + * + * 4. 自动化的资源清理和容错处理 + * 4.1 资源清理: 当客户端(TunnelWorker)没有被正常shutdown时(比如异常退出或者手动结束),我们会自动帮用户进行资源的回收,包括释放线程池, + * 自动调用用户在Channel上注册的shutdown方法,关闭Tunnel连接等。 + * 4.2 容错处理: 当客户端出现Heartbeat超时等非参数类错误时,我们会自动帮用户Renew Connect,以保证数据消费可以稳定的进行持续同步。 + */ +public class TunnelWorker implements ITunnelWorker { + private static final Logger LOG = LoggerFactory.getLogger(TunnelWorker.class); + private static final int CORE_POOL_SIZE = 2; + private static final int WORKER_RANDOM_RETRY_MILLIS = 10000; + + private String tunnelId; + private String clientId; + private TunnelWorkerConfig workerConfig; + private TunnelClientInterface client; + private TunnelStateMachine stateMachine; + private IChannelDialer channelDialer; + private AtomicReference workerStatus = new AtomicReference(); + private Date lastHeartbeatTime; + private ScheduledExecutorService heartbeatExecutor; + + public TunnelWorker(String tunnelId, TunnelClientInterface client, TunnelWorkerConfig workerConfig) { + Preconditions.checkArgument(tunnelId != null && !tunnelId.isEmpty(), + "The tunnel id should not be null or empty."); + Preconditions.checkNotNull(client, "Tunnel client cannot be null."); + Preconditions.checkNotNull(workerConfig, "Tunnel worker workerConfig cannot be null."); + Preconditions.checkNotNull(workerConfig.getChannelProcessor(), "Channel Processor cannot be null."); + + init(tunnelId, client, workerConfig); + } + + private void init(String tunnelId, TunnelClientInterface client, TunnelWorkerConfig config) { + LOG.info("Initial tunnel worker, tunnelId: {}", tunnelId); + this.tunnelId = tunnelId; + this.client = client; + this.workerConfig = config; + this.workerStatus.set(TunnelWorkerStatus.WORKER_READY); + this.lastHeartbeatTime = new Date(); + + this.heartbeatExecutor = Executors.newScheduledThreadPool(CORE_POOL_SIZE, new ThreadFactory() { + private final AtomicInteger counter = new AtomicInteger(0); + + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "tunnel-heartbeat-scheduled-" + counter.getAndIncrement()); + } + }); + } + + private void connect() { + if (!workerStatus.compareAndSet(TunnelWorkerStatus.WORKER_READY, TunnelWorkerStatus.WORKER_STARTED)) { + throw new ClientException(String.format("Tunnel worker has already been %s status", workerStatus)); + } + while (true) { + try { + TunnelClientConfig conf = new TunnelClientConfig(workerConfig.getHeartbeatTimeoutInSec(), + workerConfig.getClientTag()); + ConnectTunnelRequest request = new ConnectTunnelRequest(tunnelId, conf); + ConnectTunnelResponse resp = client.connectTunnel(request); + this.clientId = resp.getClientId(); + // ConnectTunnel成功后,初始化TunnelWorker的其它依赖组件。 + this.channelDialer = new ChannelDialer(client, workerConfig); + // 根据用户传入的处理数据的Callback和CheckpointInterval(向服务端记数据位点的间隔) + // 包装出一个带自动记Checkpoint功能的数据处理器。 + IChannelProcessorFactory channelProcessorFactory = new ChannelProcessFactory(workerConfig); + stateMachine = new TunnelStateMachine(tunnelId, clientId, channelDialer, channelProcessorFactory, + client); + LOG.info("Connect tunnel success, clientId: {}, tunnelId: {}", clientId, tunnelId); + break; + } catch (TableStoreException te) { + LOG.warn("Connect tunnel failed, tunnel id {}, error detail {}", tunnelId, te.toString()); + if (isTunnelInvalid(te.getErrorCode())) { + LOG.error("Tunnel is expired or invalid, tunnel worker will be halted."); + workerStatus.set(TunnelWorkerStatus.WORKER_HALT); + throw te; + } + } catch (Exception e) { + LOG.warn("Connect tunnel failed, tunnel id {}, error detail {}", tunnelId, e.toString()); + } + + try { + Thread.sleep(new Random(System.currentTimeMillis()).nextInt(WORKER_RANDOM_RETRY_MILLIS) + 1); + } catch (Exception e) { + LOG.warn("Reconnect worker error, error detail: {}", e.toString()); + } + } + } + + private class Heartbeat implements Runnable { + @Override + public void run() { + // 若Worker处于ENDED状态,则需要重新进行资源初始化。 + if (workerStatus.get().equals(TunnelWorkerStatus.WORKER_ENDED)) { + workerStatus.set(TunnelWorkerStatus.WORKER_READY); + connect(); + } + try { + Date now = new Date(); + if (lastHeartbeatTime.compareTo(now) != 0) { + if (now.getTime() - lastHeartbeatTime.getTime() > TimeUnit.SECONDS.toMillis( + workerConfig.getHeartbeatTimeoutInSec())) { + LOG.error("Tunnel client heartbeat timeout, lastHeartbeatTime: {}.", lastHeartbeatTime); + throw new TableStoreException("tunnel client heartbeat timeout", RESOURCE_GONE); + } + } + LOG.info("Begin batch get channels."); + List currChannels = stateMachine.batchGetChannels(); + HeartbeatRequest request = new HeartbeatRequest(tunnelId, clientId, currChannels); + HeartbeatResponse resp = client.heartbeat(request); + lastHeartbeatTime = new Date(); + List targetChannels = resp.getChannels(); + LOG.info("Begin batch update channels, num: {}, detail: {}.", targetChannels.size(), + channelsToString(targetChannels)); + stateMachine.batchUpdateChannels(targetChannels); + } catch (TableStoreException te) { + LOG.warn("Heartbeat error, TableStore Exception: {}.", te.toString()); + if (isTunnelInvalid(te.getErrorCode())) { + LOG.error("Tunnel is expired or invalid, tunnel worker will be halted."); + shutdown(true); + } else { + shutdown(false); + } + } catch (Throwable e) { + LOG.warn("Heartbeat error, Throwable: {}", e.toString()); + shutdown(false); + } + } + } + + private boolean isTunnelInvalid(String errorCode) { + return errorCode.equals(ErrorCode.TUNNEL_EXPIRED) || errorCode.equals(ErrorCode.INVALID_PARAMETER); + } + + private String channelsToString(List channels) { + StringBuilder sb = new StringBuilder(); + sb.append("["); + for (Channel channel : channels) { + sb.append(channel); + } + sb.append("]"); + return sb.toString(); + } + + @Override + public void connectAndWorking() throws Exception { + // 资源的一些初始化 + connect(); + // 定期进行Heartbeat, 进行活跃Channel的探测,Channel和ChannelConnect状态的更新,数据处理任务的初始化、运行和结束等。 + heartbeatExecutor.scheduleAtFixedRate(new Heartbeat(), 0, workerConfig.getHeartbeatIntervalInSec(), + TimeUnit.SECONDS); + + // Add Shutdown hook for resource clear. + Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { + @Override + public void run() { + LOG.warn("Unexpected shutdown, do resources clear."); + shutdown(); + } + } + )); + } + + @Override + public void shutdown() { + shutdown(true); + } + + /** + * 关闭TunnelWorker。 + * + * @param isHalt: TunnelWorker是否停止, true代表TunnelWorker所有相关资源(包括线程池)需要被关闭,false代表只是暂时的停止(可以通过重连恢复)。 + */ + private void shutdown(boolean isHalt) { + if (workerStatus.get().equals(TunnelWorkerStatus.WORKER_ENDED) || + workerStatus.get().equals(TunnelWorkerStatus.WORKER_HALT)) { + LOG.info("Tunnel worker has already been {} status, skip shutdown logic.", workerStatus); + return; + } + if (channelDialer != null) { + LOG.info("Shutdown channel dialer"); + channelDialer.shutdown(); + } + if (stateMachine != null) { + LOG.info("Shutdown tunnel state machine."); + stateMachine.close(); + } + if (isHalt && heartbeatExecutor != null) { + LOG.info("Shutdown heartbeat executor."); + heartbeatExecutor.shutdown(); + } + try { + LOG.info("Shutdown tunnel, tunnelId: {}, clientId: {}", tunnelId, clientId); + client.shutdownTunnel(new ShutdownTunnelRequest(tunnelId, clientId)); + } catch (Exception e) { + LOG.warn("Shutdown tunnel failed, tunnelId: {}, clientId: {}", tunnelId, clientId); + } + LOG.info("Tunnel worker is ended."); + if (isHalt) { + workerStatus.set(TunnelWorkerStatus.WORKER_HALT); + } else { + workerStatus.set(TunnelWorkerStatus.WORKER_ENDED); + } + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerConfig.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerConfig.java new file mode 100644 index 0000000..1fa9bd2 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerConfig.java @@ -0,0 +1,155 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import com.alicloud.openservices.tablestore.core.utils.Preconditions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TunnelWorker的自定义配置。 + */ +public class TunnelWorkerConfig { + private static final Logger LOG = LoggerFactory.getLogger(TunnelWorker.class); + private static final int CORE_POOL_SIZE = 32; + private static final int KEEP_ALIVE_SECONDS = 60; + private static final int MAX_CORE_POOL_SIZE = 1000; + private static final int BLOCKING_QUEUE_SIZE = 16; + + private static final int HEARTBEAT_MIN_INTERVAL_SEC = 5; + + /** + * Heartbeat的超时间隔,当Heartbeat发生超时,Tunnel服务端会认为当前TunnelClient不可用(失活),客户端需要重新的进行ConnectTunnel。 + */ + private long heartbeatTimeoutInSec = 300; + /** + * 进行Heartbeat的间隔,Heartbeat用于活跃Channel的探测,Channel状态的更新, (自动化)数据拉取任务的初始化等。 + */ + private long heartbeatIntervalInSec = 30; + /** + * 用户消费完数据后,向Tunnel服务端进行 记录消费位点操作(Checkpoint)的时间间隔,单位为ms。 + */ + private long checkpointIntervalInMillis = 5000; + /** + * 客户端的自定义标识,用于生成Tunnel Client ID, 用户可以自定义此参数来区分TunnelClient。 + */ + private String clientTag = System.getProperty("os.name"); + + /** + * 用户注册的处理数据的Callback,包括process和shutdown方法。 + */ + private IChannelProcessor channelProcessor; + + /** + * 用于读数据的线程池,可支持用户自定义。在自定义时,线程池中的线程数要和Tunnel中的Channel数尽可能一致, + * 这样可以保障每个Channel都能很快的分配到计算资源(CPU). + * 在我们的默认线程池配置中,我们做了以下几件事,以保障吞吐量: + * 1. 默认预发分配32个的核心线程,以保障数据较小时(Channel数较少时)的实时吞吐。 + * 2. 工作队列的大小适当调小,这样在用户数据量比较大(Channel数较多)时,可以更快的触发线程池新建线程的策略,及时的弹起更多的计算资源。 + * 3. 设置了默认的线程保活时间(默认60s),当数据量下去后,可以及时回收线程资源。 + */ + private ThreadPoolExecutor readRecordsExecutor = newDefaultThreadPool("read-records-executor-"); + /** + * 用于处理数据的线程池,可支持用户自定义,说明和上面的线程池一致。 + */ + private ThreadPoolExecutor processRecordsExecutor = newDefaultThreadPool("process-records-executor-"); + + public TunnelWorkerConfig(IChannelProcessor processor) { + this.channelProcessor = processor; + } + + public long getHeartbeatTimeoutInSec() { + return heartbeatTimeoutInSec; + } + + public void setHeartbeatTimeoutInSec(long heartbeatTimeoutInSec) { + Preconditions.checkArgument(heartbeatTimeoutInSec > heartbeatIntervalInSec, + "heartbeat timeout should larger than heartbeat interval."); + this.heartbeatTimeoutInSec = heartbeatTimeoutInSec; + } + + public long getHeartbeatIntervalInSec() { + return heartbeatIntervalInSec; + } + + public void setHeartbeatIntervalInSec(long heartbeatIntervalInSec) { + Preconditions.checkArgument(heartbeatIntervalInSec > HEARTBEAT_MIN_INTERVAL_SEC, + "heartbeat interval must greater than or equal to %d seconds.", HEARTBEAT_MIN_INTERVAL_SEC); + this.heartbeatIntervalInSec = heartbeatIntervalInSec; + } + + public String getClientTag() { + return clientTag; + } + + public void setClientTag(String clientTag) { + this.clientTag = clientTag; + } + + public IChannelProcessor getChannelProcessor() { + return channelProcessor; + } + + public void setChannelProcessor(IChannelProcessor channelProcessor) { + this.channelProcessor = channelProcessor; + } + + public long getCheckpointIntervalInMillis() { + return checkpointIntervalInMillis; + } + + public void setCheckpointIntervalInMillis(long checkpointIntervalInMillis) { + this.checkpointIntervalInMillis = checkpointIntervalInMillis; + } + + public ThreadPoolExecutor getReadRecordsExecutor() { + return readRecordsExecutor; + } + + public void setReadRecordsExecutor(ThreadPoolExecutor readRecordsExecutor) { + this.readRecordsExecutor = readRecordsExecutor; + } + + public ThreadPoolExecutor getProcessRecordsExecutor() { + return processRecordsExecutor; + } + + public void setProcessRecordsExecutor(ThreadPoolExecutor processRecordsExecutor) { + this.processRecordsExecutor = processRecordsExecutor; + } + + /** + * 初始化默认的线程池。 + * @param threadPrefix: 线程名称的前缀标识 + * @return + */ + private ThreadPoolExecutor newDefaultThreadPool(final String threadPrefix) { + return new ThreadPoolExecutor(CORE_POOL_SIZE, MAX_CORE_POOL_SIZE, KEEP_ALIVE_SECONDS, TimeUnit.SECONDS, + new ArrayBlockingQueue(BLOCKING_QUEUE_SIZE), + new ThreadFactory() { + private final AtomicInteger counter = new AtomicInteger(); + @Override + public Thread newThread(Runnable r) { + String threadName = threadPrefix + counter.getAndIncrement(); + LOG.info("TunnelWorkerConfig new thread: " + threadName); + return new Thread(r, threadName); + } + }, + new CallerRunsPolicy()); + } + + /** + * 回收线程池资源。 + */ + public void shutdown() { + LOG.info("shutdown read records executor"); + readRecordsExecutor.shutdownNow(); + LOG.info("shutdown process records executor"); + processRecordsExecutor.shutdownNow(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerException.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerException.java new file mode 100644 index 0000000..859780b --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerException.java @@ -0,0 +1,19 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public class TunnelWorkerException extends Exception { + private String code; + private String message; + private String requestId; + private String tunnelId; + + public TunnelWorkerException(String code, String message) { + super(message); + this.code = code; + this.message = message; + } + + @Override + public String toString() { + return String.format("RequestId: %s, Code: %s, Message: %s", requestId, code, message); + } +} \ No newline at end of file diff --git a/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerStatus.java b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerStatus.java new file mode 100644 index 0000000..b963931 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/tunnel/worker/TunnelWorkerStatus.java @@ -0,0 +1,23 @@ +package com.alicloud.openservices.tablestore.tunnel.worker; + +public enum TunnelWorkerStatus { + /** + * TunnelWorker的初始状态 + */ + WORKER_READY, + /** + * TunnelWorker已启动 + */ + WORKER_STARTED, + /** + * TunnelWorker已结束, 比如TunnelWorker被shutdown。 + * 此状态下的TunnelWorker可以通过重新的connectAndWorking恢复正常状态。 + */ + WORKER_ENDED, + + /** + * TunnelWorker已停止, 比如TunnelWorker中对应的Tunnel被删除。 + * 此状态下的TunnelWorker不能通过重新的connectAndWorking恢复正常状态,需要进行参数的订正等手工修复。 + */ + WORKER_HALT +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/writer/DefaultWriterStatistics.java b/src/main/java/com/alicloud/openservices/tablestore/writer/DefaultWriterStatistics.java new file mode 100644 index 0000000..c98c1a7 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/DefaultWriterStatistics.java @@ -0,0 +1,40 @@ +package com.alicloud.openservices.tablestore.writer; + +import java.util.concurrent.atomic.AtomicLong; + +public class DefaultWriterStatistics implements WriterStatistics { + AtomicLong totalRequestCount = new AtomicLong(0); + AtomicLong totalRowsCount = new AtomicLong(0); + AtomicLong totalSucceedRowsCount = new AtomicLong(0); + AtomicLong totalFailedRowsCount = new AtomicLong(0); + AtomicLong totalSingleRowRequestCount = new AtomicLong(0); + + public DefaultWriterStatistics() { + + } + + @Override + public long getTotalRequestCount() { + return totalRequestCount.longValue(); + } + + @Override + public long getTotalRowsCount() { + return totalRowsCount.longValue(); + } + + @Override + public long getTotalSucceedRowsCount() { + return totalSucceedRowsCount.longValue(); + } + + @Override + public long getTotalFailedRowsCount() { + return totalFailedRowsCount.longValue(); + } + + @Override + public long getTotalSingleRowRequestCount() { + return totalSingleRowRequestCount.longValue(); + } +} diff --git a/src/main/java/com/alicloud/openservices/tablestore/writer/FlushCallback.java b/src/main/java/com/alicloud/openservices/tablestore/writer/FlushCallback.java new file mode 100644 index 0000000..1405095 --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/FlushCallback.java @@ -0,0 +1,223 @@ +package com.alicloud.openservices.tablestore.writer; + +import com.alicloud.openservices.tablestore.AsyncClientInterface; +import com.alicloud.openservices.tablestore.TableStoreCallback; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.Error; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Executor; +import java.util.concurrent.Semaphore; +import java.util.concurrent.atomic.AtomicInteger; + +class FlushCallback implements TableStoreCallback { + private Logger logger = LoggerFactory.getLogger(FlushCallback.class); + + private AsyncClientInterface ots; + private AtomicInteger count; + private Semaphore semaphore; + private long startTime; + private TableStoreCallback callback; + private Executor executor; + private DefaultWriterStatistics writerStatistics; + + public FlushCallback(AsyncClientInterface ots, AtomicInteger count, Semaphore semaphore, + TableStoreCallback callback, Executor executor, DefaultWriterStatistics writerStatistics) { + this.ots = ots; + this.count = count; + this.semaphore = semaphore; + this.startTime = System.currentTimeMillis(); + this.callback = callback; + this.executor = executor; + this.writerStatistics = writerStatistics; + } + + private void triggerSucceedCallback(final RowChange rowChange, final ConsumedCapacity consumedCapacity, final Row row) { + if (callback == null) { + return; + } + + executor.execute(new Runnable() { + @Override + public void run() { + writerStatistics.totalSucceedRowsCount.incrementAndGet(); + callback.onCompleted(rowChange, new RowWriteResult(consumedCapacity, row)); + } + }); + } + + private void triggerFailedCallback(final RowChange rowChange, final Exception exp) { + if (callback == null) { + return; + } + + executor.execute(new Runnable() { + @Override + public void run() { + writerStatistics.totalFailedRowsCount.incrementAndGet(); + callback.onFailed(rowChange, exp); + } + }); + } + + private void triggerFailedCallback(final List rowChanges, final Exception exp) { + if (callback == null) { + return; + } + + executor.execute(new Runnable() { + @Override + public void run() { + for (RowChange rowChange : rowChanges) { + writerStatistics.totalFailedRowsCount.incrementAndGet(); + callback.onFailed(rowChange, exp); + } + } + }); + } + + /** + * 当请求结束后,需要主动释放信号量。
+ * 但是注意:这里不是每个请求完成都能去释放信号量。
+ * 例如一次BatchWriteRow请求申请了一个信号量,但是由于其包含脏数据,所以需要对每一行数据单独发送一次请求来重试,此时一个并发会分裂为 + * N个并发,这N个并发请求会有自己独立的callback。而其申请的那一个信号量需要由这N个并发中的其中一个来释放,如何选择哪个来释放? + * 这里采取的策略是用一个原子计数器,哪个请求最后一个完成,则由其来释放这个信号量。 + */ + private void requestComplete() { + int remain = this.count.decrementAndGet(); + if (remain == 0) { + semaphore.release(); + logger.debug("Release semaphore."); + } + long endTime = System.currentTimeMillis(); + logger.debug("BatchWriteRow latency: {}", endTime - startTime); + } + + public void onCompleted(BatchWriteRowRequest originRequest, BatchWriteRowResponse result) { + List succeed = new ArrayList(); + List failed = new ArrayList(); + + result.getResult(succeed, failed); + for (BatchWriteRowResponse.RowResult status : succeed) { + triggerSucceedCallback(originRequest.getRowChange(status.getTableName(), status.getIndex()), status.getConsumedCapacity(), status.getRow()); + } + + for (BatchWriteRowResponse.RowResult status : failed) { + Error error = status.getError(); + triggerFailedCallback(originRequest.getRowChange(status.getTableName(), status.getIndex()), new TableStoreException(error.getMessage(), null, error.getCode(), result.getRequestId(), 0)); + } + } + + @Override + public void onCompleted(Req request, Res response) { + logger.debug("OnComplete: {}", request.getClass().getName()); + if (request instanceof BatchWriteRowRequest) { + onCompleted((BatchWriteRowRequest) request, (BatchWriteRowResponse) response); + } else if (request instanceof PutRowRequest) { + PutRowRequest pr = (PutRowRequest) request; + triggerSucceedCallback(pr.getRowChange(), ((PutRowResponse) response).getConsumedCapacity(), ((PutRowResponse) response).getRow()); + } else if (request instanceof UpdateRowRequest) { + UpdateRowRequest ur = (UpdateRowRequest) request; + triggerSucceedCallback(ur.getRowChange(), ((UpdateRowResponse) response).getConsumedCapacity(), ((UpdateRowResponse) response).getRow()); + } else if (request instanceof DeleteRowRequest) { + DeleteRowRequest dr = (DeleteRowRequest) request; + triggerSucceedCallback(dr.getRowChange(), ((DeleteRowResponse) response).getConsumedCapacity(), ((DeleteRowResponse) response).getRow()); + } + + requestComplete(); + } + + @Override + public void onFailed(Req request, Exception ex) { + if (ex instanceof TableStoreException) { + failedOnException(request, (TableStoreException) ex); + } else { + failedOnUnknownException(request, ex); + } + } + + public void failedOnException(Req request, TableStoreException ex) { + logger.debug("OnFailed on TableStoreException: {}, {}", request.getClass().getName(), ex); + if (request instanceof BatchWriteRowRequest) { + retryBatchWrite((BatchWriteRowRequest) request); + } else if (request instanceof PutRowRequest) { + PutRowRequest pr = (PutRowRequest) request; + triggerFailedCallback(pr.getRowChange(), ex); + } else if (request instanceof UpdateRowRequest) { + UpdateRowRequest ur = (UpdateRowRequest) request; + triggerFailedCallback(ur.getRowChange(), ex); + } else if (request instanceof DeleteRowRequest) { + DeleteRowRequest dr = (DeleteRowRequest) request; + triggerFailedCallback(dr.getRowChange(), ex); + } + + requestComplete(); + } + + public void failedOnUnknownException(Req request, Exception ex) { + logger.debug("OnFailed on ClientException: {}, {}", request.getClass().getName(), ex); + List failedRows = new ArrayList(); + if (request instanceof BatchWriteRowRequest) { + BatchWriteRowRequest bwr = (BatchWriteRowRequest) request; + for (Map.Entry> entry : bwr.getRowChange().entrySet()) { + failedRows.addAll(entry.getValue()); + } + } else if (request instanceof PutRowRequest) { + PutRowRequest pr = (PutRowRequest) request; + failedRows.add(pr.getRowChange()); + } else if (request instanceof UpdateRowRequest) { + UpdateRowRequest ur = (UpdateRowRequest) request; + failedRows.add(ur.getRowChange()); + } else if (request instanceof DeleteRowRequest) { + DeleteRowRequest dr = (DeleteRowRequest) request; + failedRows.add(dr.getRowChange()); + } + + triggerFailedCallback(failedRows, ex); + + requestComplete(); + } + + /** + * 在一般情况下,BatchWriteRow是不会发生整体异常的,若发生,则代表其中包含有脏数据,例如有一行的属性列的大小超过大小限制等。 + * 在这种情况下,我们不希望因为这一行脏数据,导致其他的行导入失败。但是由于我们无法找出这是哪一行,所以采取的做法是将这一次Batch内 + * 包含的所有行通过PutRow等单行写操作写过去。 + * 由于我们在writer外层是有一层参数检查了,所以这种情况是极少发生的。 + * + * @param request + */ + private void retryBatchWrite(BatchWriteRowRequest request) { + for (Map.Entry> entry : request.getRowChange().entrySet()) { + count.addAndGet(entry.getValue().size()); + for (RowChange rowChange : entry.getValue()) { + if (rowChange instanceof RowPutChange) { + RowPutChange rowPutChange = (RowPutChange) rowChange; + PutRowRequest pr = new PutRowRequest(); + pr.setRowChange(rowPutChange); + writerStatistics.totalSingleRowRequestCount.incrementAndGet(); + writerStatistics.totalRequestCount.incrementAndGet(); + ots.putRow(pr, new FlushCallback(ots, count, semaphore, callback, executor, writerStatistics)); + } else if (rowChange instanceof RowUpdateChange) { + UpdateRowRequest ur = new UpdateRowRequest(); + RowUpdateChange rowUpdateChange = (RowUpdateChange) rowChange; + ur.setRowChange(rowUpdateChange); + writerStatistics.totalSingleRowRequestCount.incrementAndGet(); + writerStatistics.totalRequestCount.incrementAndGet(); + ots.updateRow(ur, new FlushCallback(ots, count, semaphore, callback, executor, writerStatistics)); + } else if (rowChange instanceof RowDeleteChange) { + DeleteRowRequest dr = new DeleteRowRequest(); + RowDeleteChange rowDeleteChange = (RowDeleteChange) rowChange; + dr.setRowChange(rowDeleteChange); + writerStatistics.totalSingleRowRequestCount.incrementAndGet(); + writerStatistics.totalRequestCount.incrementAndGet(); + ots.deleteRow(dr, new FlushCallback(ots, count, semaphore, callback, executor, writerStatistics)); + } + } + } + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/writer/RowChangeEvent.java b/src/main/java/com/alicloud/openservices/tablestore/writer/RowChangeEvent.java similarity index 66% rename from src/main/java/com/aliyun/openservices/ots/internal/writer/RowChangeEvent.java rename to src/main/java/com/alicloud/openservices/tablestore/writer/RowChangeEvent.java index e9067ba..080104b 100644 --- a/src/main/java/com/aliyun/openservices/ots/internal/writer/RowChangeEvent.java +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/RowChangeEvent.java @@ -1,20 +1,20 @@ -package com.aliyun.openservices.ots.internal.writer; +package com.alicloud.openservices.tablestore.writer; -import com.aliyun.openservices.ots.model.RowChange; +import com.alicloud.openservices.tablestore.model.RowChange; import com.lmax.disruptor.EventFactory; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; public class RowChangeEvent { - public static enum EventType { + public enum EventType { DATA, FLUSH } public EventType type; public RowChange rowChange; - public ReentrantLock lock; - public Condition condition; + public CountDownLatch latch; private RowChangeEvent() { @@ -25,10 +25,9 @@ public void setValue(RowChange rowChange) { this.rowChange = rowChange; } - public void setValue(ReentrantLock lock, Condition condition) { + public void setValue(CountDownLatch latch) { this.type = EventType.FLUSH; - this.lock = lock; - this.condition = condition; + this.latch = latch; } public static class RowChangeEventFactory implements EventFactory { diff --git a/src/main/java/com/aliyun/openservices/ots/internal/writer/RowChangeEventHandler.java b/src/main/java/com/alicloud/openservices/tablestore/writer/RowChangeEventHandler.java similarity index 64% rename from src/main/java/com/aliyun/openservices/ots/internal/writer/RowChangeEventHandler.java rename to src/main/java/com/alicloud/openservices/tablestore/writer/RowChangeEventHandler.java index 25d7d64..bdc32b8 100644 --- a/src/main/java/com/aliyun/openservices/ots/internal/writer/RowChangeEventHandler.java +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/RowChangeEventHandler.java @@ -1,40 +1,47 @@ -package com.aliyun.openservices.ots.internal.writer; +package com.alicloud.openservices.tablestore.writer; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSAsync; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.model.*; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.AsyncClientInterface; +import com.alicloud.openservices.tablestore.TableStoreCallback; +import com.alicloud.openservices.tablestore.model.*; import com.lmax.disruptor.EventHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; public class RowChangeEventHandler implements EventHandler { private Logger logger = LoggerFactory.getLogger(RowChangeEventHandler.class); - private OTSAsync ots; + private AsyncClientInterface ots; private WriteRPCBuffer buffer; private int concurrency; private Semaphore semaphore; - private OTSCallback callback; + private TableStoreCallback callback; private Executor executor; - private AtomicLong totalRequestCount; + private DefaultWriterStatistics writerStatistics; - public RowChangeEventHandler(OTSAsync ots, WriterConfig writerConfig, OTSCallback callback, Executor executor) { + public RowChangeEventHandler( + AsyncClientInterface ots, WriterConfig writerConfig, + TableStoreCallback callback, + Executor executor, + DefaultWriterStatistics writerStatistics) { this.ots = ots; this.buffer = new WriteRPCBuffer(writerConfig); this.concurrency = writerConfig.getConcurrency(); this.semaphore = new Semaphore(concurrency); this.callback = callback; this.executor = executor; - this.totalRequestCount = new AtomicLong(); + this.writerStatistics = writerStatistics; + } + + public void setCallback(TableStoreCallback callback) { + this.callback = callback; } @Override @@ -42,8 +49,7 @@ public void onEvent(RowChangeEvent rowChangeEvent, long sequence, boolean endOfB BatchWriteRowRequest request = null; boolean shouldWaitFlush = false; - ReentrantLock lock = null; - Condition flushCond = null; + CountDownLatch latch = null; if (rowChangeEvent.type == RowChangeEvent.EventType.FLUSH) { logger.debug("FlushSignal with QueueSize: {}", buffer.getTotalRowsCount()); @@ -53,9 +59,9 @@ public void onEvent(RowChangeEvent rowChangeEvent, long sequence, boolean endOfB } shouldWaitFlush = true; - lock = rowChangeEvent.lock; - flushCond = rowChangeEvent.condition; + latch = rowChangeEvent.latch; } else { + writerStatistics.totalRowsCount.incrementAndGet(); final RowChange rowChange = rowChangeEvent.rowChange; boolean succeed = buffer.appendRowChange(rowChange); if (!succeed) { @@ -67,8 +73,10 @@ public void onEvent(RowChangeEvent rowChangeEvent, long sequence, boolean endOfB executor.execute(new Runnable() { @Override public void run() { - callback.onFailed(new OTSContext(rowChange, null), - new ClientException("Can not even append only one row into buffer.")); + writerStatistics.totalFailedRowsCount.incrementAndGet(); + if (callback != null) { + callback.onFailed(rowChange, new ClientException("Can not even append only one row into buffer.")); + } } }); } @@ -83,21 +91,15 @@ public void run() { executor.execute(new Runnable() { @Override public void run() { - totalRequestCount.incrementAndGet(); - ots.batchWriteRow(finalRequest, new FlushCallback(ots, new AtomicInteger(1), semaphore, callback, executor)); + writerStatistics.totalRequestCount.incrementAndGet(); + ots.batchWriteRow(finalRequest, new FlushCallback(ots, new AtomicInteger(1), semaphore, callback, executor, writerStatistics)); } }); - //ots.batchWriteRow(finalRequest, new FlushCallback(ots, new AtomicInteger(1), semaphore, callback, executor)); } if (shouldWaitFlush) { waitFlush(); - lock.lock(); - try { - flushCond.signal(); - } finally { - lock.unlock(); - } + latch.countDown(); } } @@ -110,8 +112,4 @@ private void waitFlush() throws InterruptedException { semaphore.release(concurrency); logger.debug("Wait flush finished."); } - - public long getTotalRPCCount() { - return totalRequestCount.get(); - } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/writer/RowWriteResult.java b/src/main/java/com/alicloud/openservices/tablestore/writer/RowWriteResult.java new file mode 100644 index 0000000..97f629f --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/RowWriteResult.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.writer; + +import com.alicloud.openservices.tablestore.model.ConsumedCapacity; +import com.alicloud.openservices.tablestore.model.Row; + +public class RowWriteResult { + private ConsumedCapacity consumedCapacity; + + private Row row; + + public RowWriteResult(ConsumedCapacity consumedCapacity, Row row) { + this.consumedCapacity = consumedCapacity; + this.row = row; + } + + public ConsumedCapacity getConsumedCapacity() { + return consumedCapacity; + } + + public void setConsumedCapacity(ConsumedCapacity consumedCapacity) { + this.consumedCapacity = consumedCapacity; + } + + public Row getRow() { + return row; + } + + public void setRow(Row row) { + this.row = row; + } +} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/writer/WriteRPCBuffer.java b/src/main/java/com/alicloud/openservices/tablestore/writer/WriteRPCBuffer.java similarity index 60% rename from src/main/java/com/aliyun/openservices/ots/internal/writer/WriteRPCBuffer.java rename to src/main/java/com/alicloud/openservices/tablestore/writer/WriteRPCBuffer.java index f2382b2..3f417fb 100644 --- a/src/main/java/com/aliyun/openservices/ots/internal/writer/WriteRPCBuffer.java +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/WriteRPCBuffer.java @@ -1,22 +1,15 @@ -package com.aliyun.openservices.ots.internal.writer; +package com.alicloud.openservices.tablestore.writer; -import com.aliyun.openservices.ots.model.BatchWriteRowRequest; -import com.aliyun.openservices.ots.model.RowChange; -import com.aliyun.openservices.ots.model.RowPrimaryKey; - -import java.util.HashSet; -import java.util.Set; +import com.alicloud.openservices.tablestore.model.*; public class WriteRPCBuffer { public WriterConfig config; - public Set primaryKeySet; public BatchWriteRowRequest batchWriteRowRequest; public int totalSize; public int totalRowsCount; public WriteRPCBuffer(WriterConfig config) { this.config = config; - this.primaryKeySet = new HashSet(); this.batchWriteRowRequest = new BatchWriteRowRequest(); this.totalSize = 0; this.totalRowsCount = 0; @@ -25,19 +18,13 @@ public WriteRPCBuffer(WriterConfig config) { /** * 向RPC缓冲中添加一个RowChange,若添加成功,返回true,否则返回false。 * 在以下情况下会添加失败: - * 1. RPCBuffer中已经包含相同主键的行 - * 2. 如果新增这一行会导致缓冲区溢出 - * 3. 如果新增这一行会总行数会超过{@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxBatchRowsCount}限制 + * 1. 如果新增这一行会导致缓冲区溢出 + * 2. 如果新增这一行会总行数会超过{@link com.alicloud.openservices.tablestore.writer.WriterConfig#maxBatchRowsCount}限制 * * @param rowChange 行数据 * @return 是否添加成功 */ public boolean appendRowChange(RowChange rowChange) { - RowPrimaryKey primaryKey = rowChange.getRowPrimaryKey(); - if (primaryKeySet.contains(primaryKey)) { - return false; - } - if (totalSize + rowChange.getDataSize() > config.getMaxBatchSize()) { return false; } @@ -46,19 +33,18 @@ public boolean appendRowChange(RowChange rowChange) { return false; } - primaryKeySet.add(primaryKey); - batchWriteRowRequest.addRowChange(rowChange); + addRowChange(rowChange); this.totalSize += rowChange.getDataSize(); this.totalRowsCount += 1; return true; } - public BatchWriteRowRequest makeRequest() { - return batchWriteRowRequest; + private void addRowChange(RowChange rowChange) { + batchWriteRowRequest.addRowChange(rowChange); } - public int getTotalSize() { - return totalSize; + public BatchWriteRowRequest makeRequest() { + return batchWriteRowRequest; } public int getTotalRowsCount() { @@ -66,7 +52,6 @@ public int getTotalRowsCount() { } public void clear() { - primaryKeySet.clear(); batchWriteRowRequest = new BatchWriteRowRequest(); totalSize = 0; totalRowsCount = 0; diff --git a/src/main/java/com/aliyun/openservices/ots/internal/writer/WriterConfig.java b/src/main/java/com/alicloud/openservices/tablestore/writer/WriterConfig.java similarity index 71% rename from src/main/java/com/aliyun/openservices/ots/internal/writer/WriterConfig.java rename to src/main/java/com/alicloud/openservices/tablestore/writer/WriterConfig.java index 3729d50..f46447c 100644 --- a/src/main/java/com/aliyun/openservices/ots/internal/writer/WriterConfig.java +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/WriterConfig.java @@ -1,6 +1,6 @@ -package com.aliyun.openservices.ots.internal.writer; +package com.alicloud.openservices.tablestore.writer; -import com.aliyun.openservices.ots.utils.Preconditions; +import com.alicloud.openservices.tablestore.core.utils.Preconditions; public class WriterConfig { /** @@ -11,7 +11,7 @@ public class WriterConfig { /** * 属性列的值的最大大小,单位Byte。 */ - private int maxAttrColumnSize = 64 * 1024; // 64KB + private int maxAttrColumnSize = 2 * 1024 * 1024; // 2MB /** * 一行最大的列数限制。 @@ -21,25 +21,30 @@ public class WriterConfig { /** * 一次批量RPC请求导入的最大行数 */ - private int maxBatchRowsCount = 100; + private int maxBatchRowsCount = 200; /** * 一次批量RPC请求导入的最大数据量 */ - private int maxBatchSize = 1024 * 1024; // 1MB + private int maxBatchSize = 4 * 1024 * 1024; // 4MB /** - * 一个OTSWriter的最大请求并发数 + * 一个TableStoreWriter的最大请求并发数 */ private int concurrency = 10; /** - * 一个OTSWriter在内存中缓冲队列的大小,必须是2的指数。 + * 一个TableStoreWriter在内存中缓冲队列的大小,必须是2的指数。 */ private int bufferSize = 1024; // 1024 rows private int flushInterval = 10000; // milliseconds + /** + * 是否开启SDK层的schema检查 + */ + private boolean enableSchemaCheck = true; + public WriterConfig() { } @@ -135,36 +140,36 @@ public void setMaxBatchSize(int maxBatchSize) { } /** - * 获取一个OTSWriter的最大请求并发数。 + * 获取一个TableStoreWriter的最大请求并发数。 * - * @return 一个OTSWriter的最大请求并发数。 + * @return 一个TableStoreWriter的最大请求并发数。 */ public int getConcurrency() { return concurrency; } /** - * 设置一个OTSWriter的最大请求并发数。 + * 设置一个TableStoreWriter的最大请求并发数。 * - * @param concurrency 一个OTSWriter的最大请求并发数。 + * @param concurrency 一个TableStoreWriter的最大请求并发数。 */ public void setConcurrency(int concurrency){ this.concurrency = concurrency; } /** - * 获取一个OTSWriter在内存中缓冲队列的大小,必须是2的指数。 + * 获取一个TableStoreWriter在内存中缓冲队列的大小,必须是2的指数。 * - * @return 一个OTSWriter在内存中缓冲队列的大小。 + * @return 一个TableStoreWriter在内存中缓冲队列的大小。 */ public int getBufferSize() { return bufferSize; } /** - * 设置一个OTSWriter在内存中缓冲队列的大小。 + * 设置一个TableStoreWriter在内存中缓冲队列的大小。 * - * @param bufferSize 一个OTSWriter在内存中缓冲队列的大小。 + * @param bufferSize 一个TableStoreWriter在内存中缓冲队列的大小。 */ public void setBufferSize(int bufferSize) { this.bufferSize = bufferSize; @@ -188,4 +193,22 @@ public void setFlushInterval(int flushInterval) { Preconditions.checkArgument(flushInterval > 0, "The flush interval should be greater than 0."); this.flushInterval = flushInterval; } + + /** + * 获取是否开启在SDK层开启写入数据时的schema检查 + * + * @return 是否开启在SDK层写入数据时的schema检查 + */ + public boolean isEnableSchemaCheck() { + return enableSchemaCheck; + } + + /** + * 设置是否开启在SDK层写入数据时的schema检查 + * + * @param enableSchemaCheck 是否开启在SDK层写入数据时的schema检查 + */ + public void setEnableSchemaCheck(boolean enableSchemaCheck) { + this.enableSchemaCheck = enableSchemaCheck; + } } diff --git a/src/main/java/com/alicloud/openservices/tablestore/writer/WriterStatistics.java b/src/main/java/com/alicloud/openservices/tablestore/writer/WriterStatistics.java new file mode 100644 index 0000000..e654c9c --- /dev/null +++ b/src/main/java/com/alicloud/openservices/tablestore/writer/WriterStatistics.java @@ -0,0 +1,9 @@ +package com.alicloud.openservices.tablestore.writer; + +public interface WriterStatistics { + long getTotalRequestCount(); + long getTotalRowsCount(); + long getTotalSucceedRowsCount(); + long getTotalFailedRowsCount(); + long getTotalSingleRowRequestCount(); +} diff --git a/src/main/java/com/aliyun/openservices/ots/ClientConfiguration.java b/src/main/java/com/aliyun/openservices/ots/ClientConfiguration.java deleted file mode 100755 index 36c0ac1..0000000 --- a/src/main/java/com/aliyun/openservices/ots/ClientConfiguration.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.utils.VersionInfoUtils; - -/** - * 访问阿里云服务的客户端配置。 - * - * - */ -public class ClientConfiguration { - private static final int AVAILABLE_PROCESSORS = Runtime.getRuntime() - .availableProcessors(); - private static final String DEFAULT_USER_AGENT = VersionInfoUtils - .getDefaultUserAgent(); - - private String userAgent = DEFAULT_USER_AGENT; - private String proxyHost; - private int proxyPort; - private String proxyUsername; - private String proxyPassword; - private String proxyDomain; - private String proxyWorkstation; - private int ioThreadCount = AVAILABLE_PROCESSORS; - private int maxConnections = 300; - private int socketTimeoutInMillisecond = 15 * 1000; - private int connectionTimeoutInMillisecond = 15 * 1000; - private int retryThreadCount = 1; - - - /** - * 构造新实例。 - */ - public ClientConfiguration() { - } - - /** - * 构造用户代理。 - * - * @return 用户代理。 - */ - public String getUserAgent() { - return userAgent; - } - - /** - * 设置用户代理。 - * - * @param userAgent - * 用户代理。 - */ - public void setUserAgent(String userAgent) { - this.userAgent = userAgent; - } - - /** - * 返回代理服务器主机地址。 - * - * @return 代理服务器主机地址。 - */ - public String getProxyHost() { - return proxyHost; - } - - /** - * 设置代理服务器主机地址。 - * - * @param proxyHost - * 代理服务器主机地址。 - */ - public void setProxyHost(String proxyHost) { - this.proxyHost = proxyHost; - } - - /** - * 返回代理服务器端口。 - * - * @return 代理服务器端口。 - */ - public int getProxyPort() { - return proxyPort; - } - - /** - * 设置代理服务器端口。 - * - * @param proxyPort - * 代理服务器端口。 - */ - public void setProxyPort(int proxyPort) { - this.proxyPort = proxyPort; - } - - /** - * 返回代理服务器验证的用户名。 - * - * @return 用户名。 - */ - public String getProxyUsername() { - return proxyUsername; - } - - /** - * 设置代理服务器验证的用户名。 - * - * @param proxyUsername - * 用户名。 - */ - public void setProxyUsername(String proxyUsername) { - this.proxyUsername = proxyUsername; - } - - /** - * 返回代理服务器验证的密码。 - * - * @return 密码。 - */ - public String getProxyPassword() { - return proxyPassword; - } - - /** - * 设置代理服务器验证的密码。 - * - * @param proxyPassword - * 密码。 - */ - public void setProxyPassword(String proxyPassword) { - this.proxyPassword = proxyPassword; - } - - /** - * 返回访问NTLM验证的代理服务器的Windows域名(可选)。 - * - * @return 域名。 - */ - public String getProxyDomain() { - return proxyDomain; - } - - /** - * 设置访问NTLM验证的代理服务器的Windows域名(可选)。 - * - * @param proxyDomain - * 域名。 - */ - public void setProxyDomain(String proxyDomain) { - this.proxyDomain = proxyDomain; - } - - /** - * 返回NTLM代理服务器的Windows工作站名称。 - * - * @return NTLM代理服务器的Windows工作站名称。 - */ - public String getProxyWorkstation() { - return proxyWorkstation; - } - - /** - * 设置NTLM代理服务器的Windows工作站名称。 (可选,如果代理服务器非NTLM,不需要设置该参数)。 - * - * @param proxyWorkstation - * NTLM代理服务器的Windows工作站名称。 - */ - public void setProxyWorkstation(String proxyWorkstation) { - this.proxyWorkstation = proxyWorkstation; - } - - /** - * 返回HttpAsyncClient的IOReactor的线程数。 - * @return IOReactor的线程数 - */ - public int getIoThreadCount() { - return ioThreadCount; - } - - /** - * 设置HttpAsyncClient的IOReactor的线程数(因为采用的是异步IO,所以不需要配置大量线程,每个线程都能提供大量并发)。 - * @param ioThreadCount - * IOReactor的线程数 - */ - public void setIoThreadCount(int ioThreadCount) { - this.ioThreadCount = ioThreadCount; - } - - /** - * 返回允许打开的最大HTTP连接数。 - * - * @return 最大HTTP连接数。 - */ - public int getMaxConnections() { - return maxConnections; - } - - /** - * 设置允许打开的最大HTTP连接数(连接数影响并发度,需要根据QPS、单个请求的时间、机器配置等因素来确定一个合理的值)。 - * - * @param maxConnections - * 最大HTTP连接数。 - */ - public void setMaxConnections(int maxConnections) { - this.maxConnections = maxConnections; - } - - /** - * 返回通过打开的连接传输数据的超时时间(单位:毫秒)。 0表示无限等待(但不推荐使用)。受系统超时时间的限制。 - * - * @return 通过打开的连接传输数据的超时时间(单位:毫秒)。 - */ - public int getSocketTimeoutInMillisecond() { - return socketTimeoutInMillisecond; - } - - /** - * 设置通过打开的连接传输数据的超时时间(单位:毫秒)。 0表示无限等待(但不推荐使用)。受系统超时时间的限制。 - * - * @param socketTimeoutInMillisecond - * 通过打开的连接传输数据的超时时间(单位:毫秒)。 - */ - public void setSocketTimeoutInMillisecond(int socketTimeoutInMillisecond) { - this.socketTimeoutInMillisecond = socketTimeoutInMillisecond; - } - - /** - * 返回建立连接的超时时间(单位:毫秒)。0表示无限等待(但不推荐使用)。受系统超时时间的限制。 - * - * @return 建立连接的超时时间(单位:毫秒)。 - */ - public int getConnectionTimeoutInMillisecond() { - return connectionTimeoutInMillisecond; - } - - /** - * 设置建立连接的超时时间(单位:毫秒)。0表示无限等待(但不推荐使用)。受系统超时时间的限制。 - * - * @param connectionTimeoutInMillisecond - * 建立连接的超时时间(单位:毫秒)。 - */ - public void setConnectionTimeoutInMillisecond(int connectionTimeoutInMillisecond) { - this.connectionTimeoutInMillisecond = connectionTimeoutInMillisecond; - } - - /** - * 返回用于执行错误重试的线程池的线程的个数。该线程池为一个ScheduledExecutorService。 - * - * @return 用于执行错误重试的线程池的线程的个数。 - */ - public int getRetryThreadCount() { - return retryThreadCount; - } - - /** - * 设置用于执行错误重试的线程池的线程的个数。该线程池为一个ScheduledExecutorService。 - * @param retryThreadCount - * 用于执行错误重试的线程池的线程的个数。 - */ - public void setRetryThreadCount(int retryThreadCount) { - this.retryThreadCount = retryThreadCount; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/ClientErrorCode.java b/src/main/java/com/aliyun/openservices/ots/ClientErrorCode.java deleted file mode 100755 index 4ea8419..0000000 --- a/src/main/java/com/aliyun/openservices/ots/ClientErrorCode.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.aliyun.openservices.ots; - -public interface ClientErrorCode { - - /** - * 未知错误 - */ - static final String UNKNOWN = "Unknown"; - - /** - * 远程服务连接超时 - */ - static final String CONNECTION_TIMEOUT = "ConnectionTimeout"; - - /** - * 远程服务socket读写超时 - */ - static final String SOCKET_TIMEOUT = "SocketTimeout"; - - /** - * 返回结果无法解析 - */ - static final String INVALID_RESPONSE = "InvalidResponse"; -} diff --git a/src/main/java/com/aliyun/openservices/ots/ClientException.java b/src/main/java/com/aliyun/openservices/ots/ClientException.java deleted file mode 100755 index 04c8406..0000000 --- a/src/main/java/com/aliyun/openservices/ots/ClientException.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.aliyun.openservices.ots; - -public class ClientException extends RuntimeException { - - private static final long serialVersionUID = 1870835486798448798L; - - private String errorCode = ClientErrorCode.UNKNOWN; - private String traceId; - - /** - * 获取异常的错误码 - * @return 异常错误码 - */ - public String getErrorCode() { - return errorCode; - } - - /** - * 构造新实例。 - */ - public ClientException(){ - super(); - } - - /** - * 用给定的异常信息构造新实例。 - * @param message 异常信息。 - */ - public ClientException(String message){ - super(message); - } - - /** - * 用表示异常原因的对象构造新实例。 - * @param cause 异常原因。 - */ - public ClientException(Throwable cause){ - super(cause); - } - - public ClientException(String message, String traceId) { - super(message); - this.traceId = traceId; - } - - /** - * 用异常消息和表示异常原因的对象构造新实例。 - * @param message 异常信息。 - * @param cause 异常原因。 - */ - public ClientException(String message, Throwable cause){ - super(message, cause); - } - - public ClientException(String message, Throwable cause, String traceId) { - super(message, cause); - this.traceId = traceId; - } - - /** - * 用异常消息和表示异常原因的对象构造新实例。 - * @param errorCode 错误码 - * @param message 异常信息。 - * @param cause 异常原因。 - */ - public ClientException(String errorCode, String message, Throwable cause){ - super(message, cause); - this.errorCode = errorCode; - } - - public String getTraceId() { - return traceId; - } - - public void setTraceId(String traceId) { - this.traceId = traceId; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/DefaultOTSWriter.java b/src/main/java/com/aliyun/openservices/ots/DefaultOTSWriter.java deleted file mode 100644 index 0885e46..0000000 --- a/src/main/java/com/aliyun/openservices/ots/DefaultOTSWriter.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.internal.writer.RowChangeEvent; -import com.aliyun.openservices.ots.internal.writer.RowChangeEventHandler; -import com.aliyun.openservices.ots.internal.writer.WriterConfig; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.utils.ParamChecker; -import com.aliyun.openservices.ots.utils.Preconditions; -import com.lmax.disruptor.InsufficientCapacityException; -import com.lmax.disruptor.RingBuffer; -import com.lmax.disruptor.dsl.Disruptor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; -import java.util.concurrent.*; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.ReentrantLock; - -public class DefaultOTSWriter implements OTSWriter { - private Logger logger = LoggerFactory.getLogger(OTSWriter.class); - - private OTSAsync ots; - - private Executor executor; - - private WriterConfig writerConfig; - - private OTSCallback callback; - - private String tableName; - - private TableMeta tableMeta; - - private Timer flushTimer; - - private ReentrantLock lock; - - private Disruptor disruptor; - - private RingBuffer ringBuffer; - - private RowChangeEventHandler eventHandler; - - private ExecutorService disruptorExecutor; - - public DefaultOTSWriter(OTSAsync ots, String tableName, WriterConfig config, OTSCallback callback, Executor executor) { - Preconditions.checkNotNull(ots, "The ots client can not be null."); - Preconditions.checkArgument(tableName != null && !tableName.isEmpty(), "The table name can not be null or empty."); - Preconditions.checkNotNull(executor, "The executor service can not be null."); - this.ots = ots; - this.tableName = tableName; - this.writerConfig = config; - this.callback = callback; - this.executor = executor; - flushTimer = new Timer(); - lock = new ReentrantLock(); - - initialize(); - } - - private void initialize() { - logger.info("Start initialize ots writer, table name: {}.", tableName); - DescribeTableRequest request = new DescribeTableRequest(); - request.setTableName(tableName); - OTSFuture result = ots.describeTable(request); - DescribeTableResult res = result.get(); - this.tableMeta = res.getTableMeta(); - logger.info("End initialize with table meta: {}.", tableMeta); - - RowChangeEvent.RowChangeEventFactory factory = new RowChangeEvent.RowChangeEventFactory(); - - // start flush thread, we only need one event handler, so we just set a thread pool with fixed size 1. - disruptorExecutor = Executors.newFixedThreadPool(1); - disruptor = new Disruptor(factory, writerConfig.getBufferSize(), disruptorExecutor); - ringBuffer = disruptor.getRingBuffer(); - eventHandler = new RowChangeEventHandler(ots, writerConfig, callback, executor); - disruptor.handleEventsWith(eventHandler); - disruptor.start(); - - // start flush timer - startFlushTimer(writerConfig.getFlushInterval()); - } - - public long getTotalRPCCount() { - return eventHandler.getTotalRPCCount(); - } - - public void startFlushTimer(int flushInterval) { - - this.flushTimer.cancel(); - - this.flushTimer = new Timer(); - this.flushTimer.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - triggerFlush(); - } - }, flushInterval, flushInterval); - } - - @Override - public void addRowChange(RowChange rowChange) { - ParamChecker.checkRowChange(tableMeta, rowChange, writerConfig); - while (true) { - try { - long sequence = ringBuffer.tryNext(); - RowChangeEvent event = ringBuffer.get(sequence); - event.setValue(rowChange); - ringBuffer.publish(sequence); - return; - } catch (InsufficientCapacityException e) { - try { - Thread.sleep(1); - } catch (InterruptedException exp) { - } - } - } - } - - private void addSignal(ReentrantLock lock, Condition condition) { - while (true) { - try { - long sequence = ringBuffer.tryNext(); - RowChangeEvent event = ringBuffer.get(sequence); - event.setValue(lock, condition); - ringBuffer.publish(sequence); - return; - } catch (InsufficientCapacityException e) { - try { - Thread.sleep(1); - } catch (InterruptedException exp) { - } - } - } - } - - @Override - public void addRowChange(List rowChanges, List dirtyRows) throws ClientException { - dirtyRows.clear(); - for (RowChange rowChange : rowChanges) { - try { - addRowChange(rowChange); - } catch (ClientException e) { - dirtyRows.add(rowChange); - } - } - if (!dirtyRows.isEmpty()) { - throw new ClientException("There is dirty rows."); - } - } - - @Override - public void setCallback(OTSCallback callback) { - this.callback = callback; - } - - @Override - public OTSCallback getCallback() { - return this.callback; - } - - - @Override - public WriterConfig getWriterConfig() { - return writerConfig; - } - - private void triggerFlush() { - Condition cond = lock.newCondition(); - addSignal(lock, cond); - } - - @Override - public synchronized void flush() throws ClientException { - logger.debug("trigger flush and waiting."); - Condition cond = lock.newCondition(); - lock.lock(); - try { - addSignal(lock, cond); - cond.await(); - } catch (InterruptedException e) { - throw new ClientException(e); - } finally { - lock.unlock(); - } - logger.debug("user trigger flush finished."); - } - - @Override - public synchronized void close() { - flushTimer.cancel(); - flush(); - disruptor.shutdown(); - disruptorExecutor.shutdown(); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/OTS.java b/src/main/java/com/aliyun/openservices/ots/OTS.java deleted file mode 100755 index b7087ed..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTS.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.aliyun.openservices.ots; - -import java.util.Iterator; - -import com.aliyun.openservices.ots.model.*; - -/** - * 阿里云开放结构化数据服务(Open Table Service, OTS)的访问接口。 - *

- * 开放结构化数据服务(Open Table Service,OTS)是构建在阿里云大规模分布式计算系统之上 的海量数据存储与实时查询的服务。 - *

- */ -public interface OTS { - - /** - * 创建表(Table)。 - * - * @param createTableRequest - * 执行CreateTable操作所需参数的封装。 - * @return CreateTable操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public CreateTableResult createTable(CreateTableRequest createTableRequest) - throws OTSException, ClientException; - - /** - * 返回表(Table)的结构信息。 - * - * @param describeTableRequest - * 执行DescribeTable操作所需参数的封装。 - * @return DescribeTable操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public DescribeTableResult describeTable( - DescribeTableRequest describeTableRequest) throws OTSException, - ClientException; - - /** - * 返回表(Table)名的列表。 - * - * @return ListTable操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public ListTableResult listTable() throws OTSException, ClientException; - - /** - * 删除表(Table)。 - * - * @param deleteTableRequest - * 执行DeleteTable操作所需参数的封装。 - * @return DeleteTable操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) - throws OTSException, ClientException; - - /** - * 更新表的读或写CapacityUnit。 - * - * @param updateTableRequest - * 执行UpdateTable操作所需参数的封装。 - * @return UpdateTable操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest) - throws OTSException, ClientException; - - /** - * 返回表(Table)中的一行数据。 - * - * @param getRowRequest - * 执行GetRow操作所需参数的封装。 - * @return GetRow操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public GetRowResult getRow(GetRowRequest getRowRequest) - throws OTSException, ClientException; - - /** - * 向表(Table)中插入或覆盖一行数据。 - * - * @param putRowRequest - * 执行PutRow操作所需参数的封装。 - * @return PutRow操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public PutRowResult putRow(PutRowRequest putRowRequest) - throws OTSException, ClientException; - - /** - * 更改表(Table)中的一行数据。 - * - * @param updateRowRequest - * 执行UpdateRow操作所需参数的封装。 - * @return UpdateRow操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public UpdateRowResult updateRow(UpdateRowRequest updateRowRequest) - throws OTSException, ClientException; - - /** - * 删除表(Table)中的一行数据。 - * - * @param deleteRowRequest - * 执行DeleteRow操作所需参数的封装。 - * @return DeleteRow操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public DeleteRowResult deleteRow(DeleteRowRequest deleteRowRequest) - throws OTSException, ClientException; - - /** - * 从多张表(Table)中获取多行数据。 - * - * @param batchGetRowRequest - * 执行BatchGetRow操作所需参数的封装。 - * @return BatchGetRow操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public BatchGetRowResult batchGetRow(BatchGetRowRequest batchGetRowRequest) - throws OTSException, ClientException; - - /** - * 对多张表(Table)中的多行数据进行增加、删除或者更改操作。 - * - * @param batchWriteRowRequest - * 执行BatchWriteRow操作所需参数的封装。 - * @return BatchWriteRow操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public BatchWriteRowResult batchWriteRow( - BatchWriteRowRequest batchWriteRowRequest) throws OTSException, - ClientException; - - /** - * 从表(Table)中查询一个范围内的多行数据。 - * - * @param getRangeRequest - * 执行GetRange操作所需参数的封装。 - * @return GetRange操作的响应内容。 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public GetRangeResult getRange(GetRangeRequest getRangeRequest) - throws OTSException, ClientException; - - /** - * 从表(Table)中迭代读取满足条件的数据 - * @param rangeIteratorParameter - * 迭代读时的参数,包括开始,结束位置 - * @return 迭代器 - * @throws OTSException - * OTS访问返回错误消息 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public Iterator createRangeIterator( - RangeIteratorParameter rangeIteratorParameter) - throws OTSException, ClientException; - - /** - * 释放资源。 - * - *

- * 请确保在所有请求执行完毕之后释放资源。释放资源之后将不能再发送请求,正在执行的请求可能无法返回结果。 - *

- */ - public void shutdown(); -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/OTSActionNames.java b/src/main/java/com/aliyun/openservices/ots/OTSActionNames.java deleted file mode 100644 index 4bb283a..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSActionNames.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.aliyun.openservices.ots; - -public class OTSActionNames { - public static final String ACTION_CREATE_TABLE = "CreateTable"; - - public static final String ACTION_LIST_TABLE = "ListTable"; - - public static final String ACTION_DELETE_TABLE = "DeleteTable"; - - public static final String ACTION_DESCRIBE_TABLE = "DescribeTable"; - - public static final String ACTION_UPDATE_TABLE = "UpdateTable"; - - public static final String ACTION_GET_ROW = "GetRow"; - - public static final String ACTION_PUT_ROW = "PutRow"; - - public static final String ACTION_UPDATE_ROW = "UpdateRow"; - - public static final String ACTION_DELETE_ROW = "DeleteRow"; - - public static final String ACTION_BATCH_GET_ROW = "BatchGetRow"; - - public static final String ACTION_BATCH_WRITE_ROW = "BatchWriteRow"; - - public static final String ACTION_GET_RANGE = "GetRange"; -} diff --git a/src/main/java/com/aliyun/openservices/ots/OTSAsync.java b/src/main/java/com/aliyun/openservices/ots/OTSAsync.java deleted file mode 100755 index e51fd56..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSAsync.java +++ /dev/null @@ -1,374 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.model.*; - -/** - * 阿里云开放结构化数据服务(Open Table Service, OTS)的访问接口。 - *

- * 开放结构化数据服务(Open Table Service,OTS)是构建在阿里云大规模分布式计算系统之上 的海量数据存储与实时查询的服务。 - *

- */ -public interface OTSAsync { - - /** - * 创建表(Table)。 - * - * @param createTableRequest - * 执行CreateTable操作所需参数的封装。 - * @return OTSFuture - * createTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture createTable( - CreateTableRequest createTableRequest) throws ClientException; - - /** - * 创建表(Table)。 - * - * @param createTableRequest - * 执行CreateTable操作所需参数的封装。 - * @param callback - * 执行CreataTable操作完成后的回调函数。 - * @return otsFuture - * createTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture createTable( - CreateTableRequest createTableRequest, - OTSCallback callback) - throws ClientException; - - /** - * 返回表(Table)的结构信息。 - * - * @param describeTableRequest - * 执行DescribeTable操作所需参数的封装。 - * @return otsFuture - * describeTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture describeTable( - DescribeTableRequest describeTableRequest) throws ClientException; - - /** - * 返回表(Table)的结构信息。 - * - * @param describeTableRequest - * 执行DescribeTable操作所需参数的封装。 - * @param callback - * 执行DescribeTable操作完成后的回调函数。 - * @return otsFuture - * describeTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture describeTable( - DescribeTableRequest describeTableRequest, - OTSCallback callback) - throws ClientException; - - /** - * 返回表(Table)名的列表。 - * - * @return otsFuture - * listTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture listTable() throws ClientException; - - /** - * 返回表(Table)名的列表。 - * - * @param callback - * 执行ListTable操作完成后的回调函数。 - * @return otsFuture - * listTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture listTable( - OTSCallback callback) - throws ClientException; - - /** - * 删除表(Table)。 - * - * @param deleteTableRequest - * 执行DeleteTable操作所需参数的封装。 - * @return otsFuture - * deleteTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture deleteTable( - DeleteTableRequest deleteTableRequest) throws ClientException; - - /** - * 删除表(Table)。 - * - * @param deleteTableRequest - * 执行DeleteTable操作所需参数的封装。 - * @param callback - * 执行DeleteTable操作完成后的回调函数。 - * @return otsFuture - * deleteTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture deleteTable( - DeleteTableRequest deleteTableRequest, - OTSCallback callback) - throws ClientException; - - /** - * 更新表的读或写CapacityUnit。 - * - * @param updateTableRequest - * 执行UpdateTable操作所需参数的封装。 - * @return otsFuture - * updateTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture updateTable( - UpdateTableRequest updateTableRequest) throws ClientException; - - /** - * 更新表的读或写CapacityUnit。 - * - * @param updateTableRequest - * 执行UpdateTable操作所需参数的封装 - * @param callback - * 执行UpdateTable操作完成后的回调函数。 - * @return otsFuture - * updateTableResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture updateTable( - UpdateTableRequest updateTableRequest, - OTSCallback callback) - throws ClientException; - - /** - * 返回表(Table)中的一行数据。 - * - * @param getRowRequest - * 执行GetRow操作所需参数的封装。 - * @return otsFuture - * getRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture getRow(GetRowRequest getRowRequest) - throws ClientException; - - /** - * 返回表(Table)中的一行数据。 - * - * @param getRowRequest - * 执行GetRow操作所需参数的封装。 - * @param callback - * 执行GetRow操作完成后的回调函数。 - * @return otsFuture - * getRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture getRow(GetRowRequest getRowRequest, - OTSCallback callback) - throws ClientException; - - /** - * 向表(Table)中插入或覆盖一行数据。 - * - * @param putRowRequest - * 执行PutRow操作所需参数的封装。 - * @return otsFuture - * putRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture putRow(PutRowRequest putRowRequest) - throws ClientException; - - /** - * 向表(Table)中插入或覆盖一行数据。 - * - * @param putRowRequest - * 执行PutRow操作所需参数的封装。 - * @param callback - * 执行PutRow操作完成后的回调函数。 - * @return otsFuture - * putRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture putRow(PutRowRequest putRowRequest, - OTSCallback callback) - throws ClientException; - - /** - * 更改表(Table)中的一行数据。 - * - * @param updateRowRequest - * 执行UpdateRow操作所需参数的封装。 - * @return otsFuture - * updateRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture updateRow( - UpdateRowRequest updateRowRequest) throws ClientException; - - /** - * 更改表(Table)中的一行数据。 - * - * @param updateRowRequest - * 执行UpdateRow操作所需参数的封装。 - * @param callback - * 执行UpdateRow操作完成后的回调函数。 - * @return otsFuture - * updateRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture updateRow( - UpdateRowRequest updateRowRequest, - OTSCallback callback) - throws ClientException; - - /** - * 删除表(Table)中的一行数据。 - * - * @param deleteRowRequest - * 执行DeleteRow操作所需参数的封装。 - * @return otsFuture - * updateRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture deleteRow( - DeleteRowRequest deleteRowRequest) throws ClientException; - - /** - * 删除表(Table)中的一行数据。 - * - * @param deleteRowRequest - * 执行DeleteRow操作所需参数的封装。 - * @param callback - * 执行DeleteRow操作完成后的回调函数。 - * @return otsFuture - * updateRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture deleteRow( - DeleteRowRequest deleteRowRequest, - OTSCallback callback) - throws ClientException; - - /** - * 从多张表(Table)中获取多行数据。 - * - * @param batchGetRowRequest - * 执行BatchGetRow操作所需参数的封装。 - * @return otsFuture - * batchGetRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture batchGetRow( - BatchGetRowRequest batchGetRowRequest) throws ClientException; - - /** - * 从多张表(Table)中获取多行数据。 - * - * @param batchGetRowRequest - * 执行BatchGetRow操作所需参数的封装。 - * @param callback - * 执行BatchGetRow操作完成后的回调函数。 - * @return otsFuture - * batchGetRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture batchGetRow( - BatchGetRowRequest batchGetRowRequest, - OTSCallback callback) - throws ClientException; - - /** - * 对多张表(Table)中的多行数据进行增加、删除或者更改操作。 - * - * @param batchWriteRowRequest - * 执行BatchWriteRow操作所需参数的封装。 - * @return otsFuture - * batchWriteRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture batchWriteRow( - BatchWriteRowRequest batchWriteRowRequest) throws ClientException; - - /** - * 对多张表(Table)中的多行数据进行增加、删除或者更改操作。 - * - * @param batchWriteRowRequest - * 执行BatchWriteRow操作所需参数的封装。 - * @param callback - * 执行BatchWriteRow操作完成后的回调函数。 - * @return otsFuture - * batchWriteRowResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture batchWriteRow( - BatchWriteRowRequest batchWriteRowRequest, - OTSCallback callback) - throws ClientException; - - /** - * 从表(Table)中查询一个范围内的多行数据。 - * - * @param getRangeRequest - * 执行GetRange操作所需参数的封装。 - * @return otsFuture - * getRangeResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture getRange(GetRangeRequest getRangeRequest) - throws ClientException; - - /** - * 从表(Table)中查询一个范围内的多行数据。 - * - * @param getRangeRequest - * 执行GetRange操作所需参数的封装。 - * @param callback - * 执行GetRange操作完成后的回调函数。 - * @return otsFuture - * getRangeResult通过otsFuture的get方法返回。 - * @throws ClientException - * 请求的返回结果无效, 或由于网络原因请求失败, 或访问超时。 - */ - public OTSFuture getRange(GetRangeRequest getRangeRequest, - OTSCallback callback) - throws ClientException; - - /** - * 释放资源。 - * - *

- * 请确保在所有请求执行完毕之后释放资源。释放资源之后将不能再发送请求,正在执行的请求可能无法返回结果。 - *

- */ - public void shutdown(); -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/OTSClient.java b/src/main/java/com/aliyun/openservices/ots/OTSClient.java deleted file mode 100755 index 789e3fe..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSClient.java +++ /dev/null @@ -1,487 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.auth.ServiceCredentials; -import com.aliyun.openservices.ots.comm.AsyncClientFutureCallback; -import com.aliyun.openservices.ots.comm.AsyncServiceClient; -import com.aliyun.openservices.ots.comm.ServiceClient; -import com.aliyun.openservices.ots.internal.*; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.utils.Preconditions; - -import java.io.UnsupportedEncodingException; -import java.util.*; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; - -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertStringNotNullOrEmpty; - -/** - * 访问阿里云开放结构化数据服务(Open Table Service, OTS)的入口类。 - */ -public class OTSClient implements OTS { - private String endpoint; // OTS endpoint - private String instanceName; // 实例的名称 - private ServiceCredentials credentials; // 用户身份信息。 - private ServiceClient client; - private ScheduledExecutorService retryExecutor; - private OTSServiceConfiguration serviceConfig; - private OTSAsyncTableOperation asyncTableOp; - private OTSAsyncDataOperation asyncDataOp; - private OTSRetryStrategy retryStrategy; - private Random random = new Random(); - - /** - * 使用指定的OTS Endpoint和默认配置构造一个新的{@link OTSClient}实例。 - * - * 注意: - * 1. 大多数情况下,全局创建一个OTSClient对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClient对象进行性能测试与调优,但数目也不宜过多。 - * 2. 每个OTSClient会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 3. 在使用完毕后,请调用shutdown方法释放OTSClient占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - */ - public OTSClient(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, null, null); - } - - /** - * 使用指定的OTS Endpoint和默认配置构造一个新的{@link OTSClient}实例。 - * - * 注意: - * 1. 大多数情况下,全局创建一个OTSClient对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClient对象进行性能测试与调优,但数目也不宜过多。 - * 2. 每个OTSClient会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 3. 在使用完毕后,请调用shutdown方法释放OTSClient占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param stsToken OTS服务短期访问凭证。详情参考阿里云STS服务文档。 - */ - public OTSClient(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, String stsToken) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, null, null, stsToken); - } - - /** - * 使用指定的OTS Endpoint和配置构造一个新的{@link OTSClient}实例。 - * - * 注意: - * 1. 大多数情况下,全局创建一个OTSClient对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClient对象进行性能测试与调优,但数目也不宜过多。 - * 2. 每个OTSClient会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 3. 在使用完毕后,请调用shutdown方法释放OTSClient占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 - */ - public OTSClient(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, - ClientConfiguration config) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, config, null); - } - - /** - * 使用指定的OTS Endpoint和配置构造一个新的{@link OTSClient}实例。 - * - * 注意: - * 1. 大多数情况下,全局创建一个OTSClient对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClient对象进行性能测试与调优,但数目也不宜过多。 - * 2. 每个OTSClient会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 3. 在使用完毕后,请调用shutdown方法释放OTSClient占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 - * @param otsConfig OTS服务相关配置信息({@link OTSServiceConfiguration})。 如果传入null则使用默认配置。 - */ - public OTSClient(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, - ClientConfiguration config, OTSServiceConfiguration otsConfig) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, config, otsConfig, null); - } - - /** - * 使用指定的OTS Endpoint和配置构造一个新的{@link OTSClient}实例。 - * - * 注意: - * 1. 大多数情况下,全局创建一个OTSClient对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClient对象进行性能测试与调优,但数目也不宜过多。 - * 2. 每个OTSClient会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 3. 在使用完毕后,请调用shutdown方法释放OTSClient占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 - * @param otsConfig OTS服务相关配置信息({@link OTSServiceConfiguration})。 如果传入null则使用默认配置。 - * @param stsToken OTS服务短期访问凭证。详情参考阿里云STS服务文档。 - */ - public OTSClient(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, - ClientConfiguration config, OTSServiceConfiguration otsConfig, String stsToken) { - assertStringNotNullOrEmpty(endpoint, "endpoint"); - assertStringNotNullOrEmpty(accessKeyId, "accessKeyId"); - assertStringNotNullOrEmpty(accessKeySecret, "accessKeySecret"); - assertStringNotNullOrEmpty(instanceName, "instanceName"); - - try { - Preconditions.checkArgument(instanceName.length() == instanceName.getBytes(OTSConsts.DEFAULT_ENCODING).length, - "InstanceName should not have multibyte character."); - } catch (UnsupportedEncodingException ex) { - throw new ClientException("UnsupportedEncoding", ex); - } - - if (!endpoint.startsWith("http://") && !endpoint.startsWith("https://")) { - throw new IllegalArgumentException( - OTS_RESOURCE_MANAGER - .getString("EndpointProtocolInvalid")); - } - - this.endpoint = endpoint; - - this.credentials = new ServiceCredentials(accessKeyId, accessKeySecret, stsToken); - - if (config == null) { - config = new ClientConfiguration(); - } - - this.client = new AsyncServiceClient(config); - - this.retryExecutor = Executors.newScheduledThreadPool(config - .getRetryThreadCount()); - - this.serviceConfig = otsConfig != null ? otsConfig - : new OTSServiceConfiguration(); - - this.retryStrategy = this.serviceConfig.getRetryStrategy(); - - this.instanceName = instanceName; - - asyncTableOp = new OTSAsyncTableOperation(this.endpoint, this.instanceName, this.client, - this.credentials, this.serviceConfig); - - asyncDataOp = new OTSAsyncDataOperation(this.endpoint, this.instanceName, this.client, - this.credentials, this.serviceConfig); - } - - /** - * 返回访问的OTS Endpoint。 - * - * @return OTS Endpoint。 - */ - public String getEndpoint() { - return endpoint; - } - - /** - * 返回访问的实例的名称 - * - * @return instance name - */ - public String getInstanceName() { - return instanceName; - } - - private OTSAsyncTableOperation getAsyncTableOperation() { - return asyncTableOp; - } - - private OTSAsyncDataOperation getAsyncDataOperation() { - return asyncDataOp; - } - - private OTSTraceLogger getOTSTraceLogger() { - String traceId = new UUID(random.nextLong(), new Random().nextLong()).toString(); - OTSTraceLogger traceLogger = new OTSTraceLogger(traceId, - this.serviceConfig.getTimeThresholdOfTraceLogger()); - return traceLogger; - } - - public void setExtraHeaders(Map extraHeaders) { - this.asyncTableOp.setExtraHeaders(extraHeaders); - this.asyncDataOp.setExtraHeaders(extraHeaders); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#createTable(com.aliyun.openservices.ots - * .model.CreateTableRequest) - */ - @Override - public CreateTableResult createTable(CreateTableRequest createTableRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(createTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(createTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_CREATE_TABLE, executionContext)); - executionContext.setCallable(new CreateTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see OTS#listTables() - */ - @Override - public ListTableResult listTable() throws OTSException, ClientException { - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(null, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_LIST_TABLE, executionContext)); - executionContext.setCallable(new ListTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#describeTable(com.aliyun.openservices - * .ots.model.DescribeTableRequest) - */ - @Override - public DescribeTableResult describeTable(DescribeTableRequest describeTableRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(describeTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(describeTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_DESCRIBE_TABLE, executionContext)); - executionContext.setCallable(new DescribeTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#deleteTable(com.aliyun.openservices.ots - * .model.DeleteTableRequest) - */ - @Override - public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(deleteTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(deleteTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_DELETE_TABLE, executionContext)); - executionContext.setCallable(new DeleteTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#updateTableCapacity(com.aliyun.openservices - * .ots.model.UpdateTableCapacityRequest) - */ - @Override - public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(updateTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(updateTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_UPDATE_TABLE, executionContext)); - executionContext.setCallable(new UpdateTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#getRow(com.aliyun.openservices.ots.model - * .GetRowRequest) - */ - @Override - public GetRowResult getRow(GetRowRequest getRowRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(getRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(getRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_GET_ROW, executionContext)); - executionContext.setCallable(new GetRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#putRow(com.aliyun.openservices.ots.model - * .PutRowRequest) - */ - @Override - public PutRowResult putRow(PutRowRequest putRowRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(putRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(putRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_PUT_ROW, executionContext)); - executionContext.setCallable(new PutRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#updateRow(com.aliyun.openservices.ots - * .model.UpdateRowRequest) - */ - @Override - public UpdateRowResult updateRow(UpdateRowRequest updateRowRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(updateRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(updateRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_UPDATE_ROW, executionContext)); - executionContext.setCallable(new UpdateRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#deleteRow(com.aliyun.openservices.ots - * .model.DeleteRowRequest) - */ - @Override - public DeleteRowResult deleteRow(DeleteRowRequest deleteRowRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(deleteRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(deleteRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_DELETE_ROW, executionContext)); - executionContext.setCallable(new DeleteRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#batchGetRow(com.aliyun.openservices.ots - * .model.BatchGetRowRequest) - */ - @Override - public BatchGetRowResult batchGetRow(final BatchGetRowRequest batchGetRowRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(batchGetRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - BatchGetRowExecutionContext executionContext = - new BatchGetRowExecutionContext(batchGetRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_BATCH_GET_ROW, executionContext)); - executionContext.setCallable(new BatchGetRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#batchWriteRow(com.aliyun.openservices - * .ots.model.BatchWriteRowRequest) - */ - @Override - public BatchWriteRowResult batchWriteRow(final BatchWriteRowRequest batchWriteRowRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(batchWriteRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - BatchWriteRowExecutionContext executionContext = - new BatchWriteRowExecutionContext(batchWriteRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_BATCH_WRITE_ROW, executionContext)); - executionContext.setCallable(new BatchWriteRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - /* - * (non-Javadoc) - * - * @see - * OTS#getRange(com.aliyun.openservices.ots. - * model.GetRangeRequest) - */ - @Override - public GetRangeResult getRange(GetRangeRequest getRangeRequest) throws OTSException, ClientException { - Preconditions.checkNotNull(getRangeRequest); - - OTSBasicFuture future = new OTSBasicFuture(null); - - OTSExecutionContext executionContext = - new OTSExecutionContext(getRangeRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_GET_RANGE, executionContext)); - executionContext.setCallable(new GetRangeCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future.get(); - } - - @Override - public Iterator createRangeIterator( - RangeIteratorParameter rangeIteratorParameter) throws OTSException, - ClientException { - return new RowIterator(this, rangeIteratorParameter); - } - - @Override - public void shutdown() { - this.retryExecutor.shutdown(); - this.client.shutdown(); - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/OTSClientAsync.java b/src/main/java/com/aliyun/openservices/ots/OTSClientAsync.java deleted file mode 100755 index cbe90b1..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSClientAsync.java +++ /dev/null @@ -1,661 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.auth.ServiceCredentials; -import com.aliyun.openservices.ots.comm.AsyncClientFutureCallback; -import com.aliyun.openservices.ots.comm.AsyncServiceClient; -import com.aliyun.openservices.ots.comm.ServiceClient; -import com.aliyun.openservices.ots.internal.*; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.utils.Preconditions; - -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Map; -import java.util.Random; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; - -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertStringNotNullOrEmpty; - -/** - * 访问阿里云开放结构化数据服务(Open Table Service, OTS)的入口类。 - */ -public class OTSClientAsync implements OTSAsync { - private static final int AVAILABLE_PROCESSORS = Runtime.getRuntime() - .availableProcessors(); - private String endpoint; // OTS endpoint - private String instanceName; // 实例的名称 - private ServiceCredentials credentials; // 用户身份信息。 - private ServiceClient client; - private ScheduledExecutorService retryExecutor; - private ExecutorService callbackExecutor; // 用于执行Callback - private OTSServiceConfiguration serviceConfig; - private OTSAsyncTableOperation asyncTableOp; - private OTSAsyncDataOperation asyncDataOp; - private OTSRetryStrategy retryStrategy; - private Random random = new Random(); - - /** - * 使用指定的OTS Endpoint和默认配置构造一个新的{@link OTSClientAsync}实例。 - * - * 注意: - * 1. OTSClientAsync提供了访问OTS的异步接口,异步接口支持指定Callback,同时会返回Future。 - * 2. 大多数情况下,全局创建一个OTSClientAsync对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClientAsync对象进行性能测试与调优,但数目也不宜过多。 - * 3. 每个OTSClientAsync会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 4. 在使用完毕后,请调用shutdown方法释放OTSClientAsync占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - */ - public OTSClientAsync(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, null, null, null); - } - - /** - * 使用指定的OTS Endpoint和默认配置构造一个新的{@link OTSClientAsync}实例。 - * - * 注意: - * 1. OTSClientAsync提供了访问OTS的异步接口,异步接口支持指定Callback,同时会返回Future。 - * 2. 大多数情况下,全局创建一个OTSClientAsync对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClientAsync对象进行性能测试与调优,但数目也不宜过多。 - * 3. 每个OTSClientAsync会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 4. 在使用完毕后,请调用shutdown方法释放OTSClientAsync占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param stsToken OTS服务短期访问凭证。详情参考阿里云STS服务文档。 - */ - public OTSClientAsync(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, String stsToken) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, null, null, null, stsToken); - } - - /** - * 使用指定的OTS Endpoint和配置构造一个新的{@link OTSClientAsync}实例。 - * - * 注意: - * 1. OTSClientAsync提供了访问OTS的异步接口,异步接口支持指定Callback,同时会返回Future。 - * 2. 大多数情况下,全局创建一个OTSClientAsync对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClientAsync对象进行性能测试与调优,但数目也不宜过多。 - * 3. 每个OTSClientAsync会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 4. 在使用完毕后,请调用shutdown方法释放OTSClientAsync占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 - * @param otsConfig OTS服务相关配置信息({@link OTSServiceConfiguration})。 如果传入null则使用默认配置。 - */ - public OTSClientAsync(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, - ClientConfiguration config, OTSServiceConfiguration otsConfig) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, config, - otsConfig, null); - } - - public OTSClientAsync(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, - ClientConfiguration config) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, config, - null, null); - } - - /** - * 使用指定的OTS Endpoint和配置构造一个新的{@link OTSClientAsync}实例。 - * - * 注意: - * 1. OTSClientAsync提供了访问OTS的异步接口,异步接口支持指定Callback,同时会返回Future。 - * 2. 大多数情况下,全局创建一个OTSClientAsync对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClientAsync对象进行性能测试与调优,但数目也不宜过多。 - * 3. 每个OTSClientAsync会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 4. 在使用完毕后,请调用shutdown方法释放OTSClientAsync占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 - * @param otsConfig OTS服务相关配置信息({@link OTSServiceConfiguration})。 如果传入null则使用默认配置。 - * @param callbackExecutor 用于执行用户在调用OTSAsync接口时传入的Callback。如果传入null则使用默认配置( - * 线程数与CPU核数相同的线程池)。 - */ - public OTSClientAsync(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, - ClientConfiguration config, OTSServiceConfiguration otsConfig, - ExecutorService callbackExecutor) { - this(endpoint, accessKeyId, accessKeySecret, instanceName, config, otsConfig, callbackExecutor, null); - } - - /** - * 使用指定的OTS Endpoint和配置构造一个新的{@link OTSClientAsync}实例。 - * - * 注意: - * 1. OTSClientAsync提供了访问OTS的异步接口,异步接口支持指定Callback,同时会返回Future。 - * 2. 大多数情况下,全局创建一个OTSClientAsync对象即可(线程安全),不需要每次创建一个。 - * 当并发极高时(数万QPS),可以尝试使用多个OTSClientAsync对象进行性能测试与调优,但数目也不宜过多。 - * 3. 每个OTSClientAsync会占用一定的线程、连接资源,可以通过ClientConfiguration配置线程数、连接数等。 - * 4. 在使用完毕后,请调用shutdown方法释放OTSClientAsync占有的线程和连接资源。 - * - * @param endpoint OTS服务的endpoint。 - * @param accessKeyId 访问OTS服务的Access ID。 - * @param accessKeySecret 访问OTS服务的Access Key。 - * @param config 客户端配置信息({@link ClientConfiguration})。 如果传入null则使用默认配置。 - * @param otsConfig OTS服务相关配置信息({@link OTSServiceConfiguration})。 如果传入null则使用默认配置。 - * @param callbackExecutor 用于执行用户在调用OTSAsync接口时传入的Callback。如果传入null则使用默认配置( - * 线程数与CPU核数相同的线程池)。 - * @param stsToken OTS服务短期访问凭证。详情参考阿里云STS服务文档。 - */ - public OTSClientAsync(String endpoint, String accessKeyId, - String accessKeySecret, String instanceName, - ClientConfiguration config, OTSServiceConfiguration otsConfig, - ExecutorService callbackExecutor, String stsToken) { - assertStringNotNullOrEmpty(endpoint, "endpoint"); - assertStringNotNullOrEmpty(accessKeyId, "accessKeyId"); - assertStringNotNullOrEmpty(accessKeySecret, "accessKeySecret"); - assertStringNotNullOrEmpty(instanceName, "instanceName"); - - try { - Preconditions.checkArgument(instanceName.length() == instanceName.getBytes(OTSConsts.DEFAULT_ENCODING).length, - "InstanceName should not have multibyte character."); - } catch (UnsupportedEncodingException ex) { - throw new ClientException("UnsupportedEncoding", ex); - } - - if (!endpoint.startsWith("http://") && !endpoint.startsWith("https://")) { - throw new IllegalArgumentException( - OTS_RESOURCE_MANAGER - .getString("EndpointProtocolInvalid")); - } - - this.endpoint = endpoint; - - this.credentials = new ServiceCredentials(accessKeyId, accessKeySecret, stsToken); - - if (config == null) { - config = new ClientConfiguration(); - } - this.client = new AsyncServiceClient(config); - - this.retryExecutor = Executors.newScheduledThreadPool(config - .getRetryThreadCount()); - - this.serviceConfig = otsConfig != null ? otsConfig - : new OTSServiceConfiguration(); - - this.retryStrategy = this.serviceConfig.getRetryStrategy(); - - this.instanceName = instanceName; - if (callbackExecutor != null) { - this.callbackExecutor = callbackExecutor; - } else { - this.callbackExecutor = Executors - .newFixedThreadPool(AVAILABLE_PROCESSORS); - } - - asyncTableOp = new OTSAsyncTableOperation(this.endpoint, this.instanceName, this.client, - this.credentials, this.serviceConfig); - - asyncDataOp = new OTSAsyncDataOperation(this.endpoint, this.instanceName, this.client, - this.credentials, this.serviceConfig); - } - - /** - * 返回访问的OTS Endpoint。 - * - * @return OTS Endpoint。 - */ - public String getEndpoint() { - return endpoint; - } - - /** - * 返回访问的实例的名称 - * - * @return instance name - */ - public String getInstanceName() { - return instanceName; - } - - private OTSAsyncTableOperation getAsyncTableOperation() { - return asyncTableOp; - } - - private OTSAsyncDataOperation getAsyncDataOperation() { - return asyncDataOp; - } - - private OTSTraceLogger getOTSTraceLogger() { - String traceId = new UUID(random.nextLong(), new Random().nextLong()).toString(); - OTSTraceLogger traceLogger = new OTSTraceLogger(traceId, - this.serviceConfig.getTimeThresholdOfTraceLogger()); - return traceLogger; - } - - public void setExtraHeaders(Map extraHeaders) { - this.asyncDataOp.setExtraHeaders(extraHeaders); - this.asyncTableOp.setExtraHeaders(extraHeaders); - } - - /** - * 这是OTSBasicFuture的callback, 用来调用用户的回调函数。 - */ - private OTSFutureCallback buildOTSBasicFutureCallback( - final Req request, final OTSCallback otsCallback) { - - // 只有OTSClientAsync有callbackExecutor, otsCallback可能为null. - if (otsCallback == null) { - return null; - } - - return new OTSFutureCallback() { - @Override - public void completed(Res result) { - final OTSContext otsContext = new OTSContext( - request, result); - callbackExecutor.submit(new Runnable() { - public void run() { - otsCallback.onCompleted(otsContext); - } - }); - } - - @Override - public void failed(final Exception ex) { - final OTSContext otsContext = new OTSContext( - request, null); - if (ex instanceof OTSException) { - callbackExecutor.submit(new Runnable() { - public void run() { - otsCallback.onFailed(otsContext, (OTSException) ex); - } - }); - } else if (ex instanceof ClientException) { - callbackExecutor.submit(new Runnable() { - public void run() { - otsCallback.onFailed(otsContext, - (ClientException) ex); - } - }); - } - } - }; - } - - @Override - public OTSFuture listTable() throws ClientException { - return listTable(null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#listTable(com.aliyun.openservices - * .ots.core.OTSCallback) - */ - @Override - public OTSFuture listTable( - OTSCallback callback) - throws ClientException { - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(null, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(null, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_LIST_TABLE, executionContext)); - executionContext.setCallable(new ListTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture createTable(CreateTableRequest createTableRequest) throws ClientException { - return createTable(createTableRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#createTable(com.aliyun.openservices - * .ots.model.CreateTableRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture createTable( - CreateTableRequest createTableRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(createTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(createTableRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(createTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_CREATE_TABLE, executionContext)); - executionContext.setCallable(new CreateTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture describeTable(DescribeTableRequest describeTableRequest) throws ClientException { - return describeTable(describeTableRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#describeTable(com.aliyun.openservices - * .ots.model.DescribeTableRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture describeTable( - DescribeTableRequest describeTableRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(describeTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(describeTableRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(describeTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_DESCRIBE_TABLE, executionContext)); - executionContext.setCallable(new DescribeTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture deleteTable(DeleteTableRequest deleteTableRequest) throws ClientException { - return deleteTable(deleteTableRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#deleteTable(com.aliyun.openservices - * .ots.model.DeleteTableRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture deleteTable( - DeleteTableRequest deleteTableRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(deleteTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(deleteTableRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(deleteTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_DELETE_TABLE, executionContext)); - executionContext.setCallable(new DeleteTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture updateTable(UpdateTableRequest updateTableRequest) throws ClientException { - return updateTable(updateTableRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#updateTable(com.aliyun.openservices - * .ots.model.UpdateTableRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture updateTable( - UpdateTableRequest updateTableRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(updateTableRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(updateTableRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(updateTableRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_UPDATE_TABLE, executionContext)); - executionContext.setCallable(new UpdateTableCallable(this.getAsyncTableOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture getRow(GetRowRequest getRowRequest) throws ClientException { - return getRow(getRowRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#getRow(com.aliyun.openservices.ots - * .model.GetRowRequest, com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture getRow(GetRowRequest getRowRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(getRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(getRowRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(getRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_GET_ROW, executionContext)); - executionContext.setCallable(new GetRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture putRow(PutRowRequest putRowRequest) throws ClientException { - return putRow(putRowRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#putRow(com.aliyun.openservices.ots - * .model.PutRowRequest, com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture putRow(PutRowRequest putRowRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(putRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(putRowRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(putRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_PUT_ROW, executionContext)); - executionContext.setCallable(new PutRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture updateRow(UpdateRowRequest updateRowRequest) throws ClientException { - return updateRow(updateRowRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#updateRow(com.aliyun.openservices - * .ots.model.UpdateRowRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture updateRow( - UpdateRowRequest updateRowRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(updateRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(updateRowRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(updateRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_UPDATE_ROW, executionContext)); - executionContext.setCallable(new UpdateRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture deleteRow(DeleteRowRequest deleteRowRequest) throws ClientException { - return deleteRow(deleteRowRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#deleteRow(com.aliyun.openservices - * .ots.model.DeleteRowRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture deleteRow( - DeleteRowRequest deleteRowRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(deleteRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(deleteRowRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(deleteRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_DELETE_ROW, executionContext)); - executionContext.setCallable(new DeleteRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture batchGetRow(BatchGetRowRequest batchGetRowRequest) throws ClientException { - return batchGetRow(batchGetRowRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#batchGetRow(com.aliyun.openservices - * .ots.model.BatchGetRowRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture batchGetRow( - BatchGetRowRequest batchGetRowRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(batchGetRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(batchGetRowRequest, callback)); - - BatchGetRowExecutionContext executionContext = - new BatchGetRowExecutionContext(batchGetRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_BATCH_GET_ROW, executionContext)); - executionContext.setCallable(new BatchGetRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture batchWriteRow(BatchWriteRowRequest batchWriteRowRequest) throws ClientException { - return batchWriteRow(batchWriteRowRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#batchWriteRow(com.aliyun.openservices - * .ots.model.BatchWriteRowRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture batchWriteRow( - BatchWriteRowRequest batchWriteRowRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(batchWriteRowRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(batchWriteRowRequest, callback)); - - BatchWriteRowExecutionContext executionContext = - new BatchWriteRowExecutionContext(batchWriteRowRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_BATCH_WRITE_ROW, executionContext)); - executionContext.setCallable(new BatchWriteRowCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public OTSFuture getRange(GetRangeRequest getRangeRequest) throws ClientException { - return getRange(getRangeRequest, null); - } - - /* - * (non-Javadoc) - * - * @see - * OTSAsync#getRange(com.aliyun.openservices - * .ots.model.GetRangeRequest, - * com.aliyun.openservices.ots.core.OTSCallback) - */ - @Override - public OTSFuture getRange(GetRangeRequest getRangeRequest, - OTSCallback callback) - throws ClientException { - Preconditions.checkNotNull(getRangeRequest); - - OTSBasicFuture future = new OTSBasicFuture(buildOTSBasicFutureCallback(getRangeRequest, callback)); - - OTSExecutionContext executionContext = - new OTSExecutionContext(getRangeRequest, future, getOTSTraceLogger(), retryStrategy, retryExecutor); - - executionContext.setAsyncClientCallback(new AsyncClientFutureCallback(OTSActionNames.ACTION_GET_RANGE, executionContext)); - executionContext.setCallable(new GetRangeCallable(this.getAsyncDataOperation(), executionContext)); - executionContext.getCallable().call(); - return future; - } - - @Override - public void shutdown() { - this.retryExecutor.shutdown(); - this.callbackExecutor.shutdown(); - this.client.shutdown(); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/OTSErrorCode.java b/src/main/java/com/aliyun/openservices/ots/OTSErrorCode.java deleted file mode 100755 index 56f00a9..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSErrorCode.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.aliyun.openservices.ots; - -/** - * 表示来自开放结构化数据服务(Open Table Service,OTS)的错误代码。 - * - */ -public interface OTSErrorCode { - /** - * 用户身份验证失败。 - */ - static final String AUTHORIZATION_FAILURE = "OTSAuthFailed"; - - /** - * 服务器内部错误。 - */ - static final String INTERNAL_SERVER_ERROR = "OTSInternalServerError"; - - /** - * 参数错误。 - */ - static final String INVALID_PARAMETER = "OTSParameterInvalid"; - - /** - * 整个请求过大。 - */ - static final String REQUEST_TOO_LARGE = "OTSRequestBodyTooLarge"; - - /** - * 客户端请求超时。 - */ - static final String REQUEST_TIMEOUT = "OTSRequestTimeout"; - - /** - * 用户的配额已经用满。 - */ - static final String QUOTA_EXHAUSTED = "OTSQuotaExhausted"; - - /** - * 内部服务器发生failover,导致表的部分分区不可服务。 - */ - static final String PARTITION_UNAVAILABLE = "OTSPartitionUnavailable"; - - /** - * 表刚被创建还无法立马提供服务。 - */ - static final String TABLE_NOT_READY = "OTSTableNotReady"; - - /** - * 请求的表不存在。 - */ - static final String OBJECT_NOT_EXIST = "OTSObjectNotExist"; - - /** - * 请求创建的表已经存在。 - */ - static final String OBJECT_ALREADY_EXIST = "OTSObjectAlreadyExist"; - - /** - * 多个并发的请求写同一行数据,导致冲突。 - */ - static final String ROW_OPERATION_CONFLICT = "OTSRowOperationConflict"; - - /** - * 主键不匹配。 - */ - static final String INVALID_PK = "OTSInvalidPK"; - - /** - * 读写能力调整过于频繁。 - */ - static final String TOO_FREQUENT_RESERVED_THROUGHPUT_ADJUSTMENT = "OTSTooFrequentReservedThroughputAdjustment"; - - /** - * 该行总列数超出限制。 - */ - static final String OUT_OF_COLUMN_COUNT_LIMIT = "OTSOutOfColumnCountLimit"; - - /** - * 该行所有列数据大小总和超出限制。 - */ - static final String OUT_OF_ROW_SIZE_LIMIT = "OTSOutOfRowSizeLimit"; - - /** - * 剩余预留读写能力不足。 - */ - static final String NOT_ENOUGH_CAPACITY_UNIT = "OTSNotEnoughCapacityUnit"; - - /** - * 预查条件检查失败。 - */ - static final String CONDITION_CHECK_FAIL = "OTSConditionCheckFail"; - - /** - * 在OTS内部操作超时。 - */ - static final String STORAGE_TIMEOUT = "OTSTimeout"; - - /** - * 在OTS内部有服务器不可访问。 - */ - static final String SERVER_UNAVAILABLE = "OTSServerUnavailable"; - - /** - * OTS内部服务器繁忙。 - */ - static final String SERVER_BUSY = "OTSServerBusy"; -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/OTSException.java b/src/main/java/com/aliyun/openservices/ots/OTSException.java deleted file mode 100755 index 443a5f2..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSException.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.ServiceException; - - -/** - * 该异常在对开放结构化数据服务(Open Table Service)访问失败时抛出。 - */ -public class OTSException extends ServiceException { - - private static final long serialVersionUID = 781283289032342L; - private int httpStatus = 200; - - /** - * 构造函数。 - */ - public OTSException() { - super(); - } - - /** - * 构造函数。 - * - * @param message 错误消息。 - */ - public OTSException(String message) { - super(message); - } - - /** - * 构造函数。 - * - * @param message 错误消息。 - * @param cause 错误原因。 - */ - public OTSException(String message, Throwable cause) { - super(message, cause); - } - - /** - * 构造函数。 - * - * @param message 错误消息。 - * @param cause 错误原因。 - * @param errorCode 错误代码。 - * @param requestId Request标识。 - * @param httpStatus Http状态码 - */ - public OTSException(String message, Throwable cause, - String errorCode, - String requestId, int httpStatus) { - super(message, cause, errorCode, requestId, ""); - this.httpStatus = httpStatus; - } - - public OTSException(String message, String code, String requestId) { - this(message, null, code, requestId, 0); - } - - /** - * 返回Http状态码 - * - * @return Http状态码 - */ - public int getHttpStatus() { - return httpStatus; - } - -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/OTSServiceConfiguration.java b/src/main/java/com/aliyun/openservices/ots/OTSServiceConfiguration.java deleted file mode 100755 index 2f7f08a..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSServiceConfiguration.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.internal.OTSDefaultRetryStrategy; -import com.aliyun.openservices.ots.internal.OTSRetryStrategy; - -/** - * 一些OTS服务特定相关的配置 - * - */ -public class OTSServiceConfiguration { - - private boolean enableRequestCompression = false; - private boolean enableResponseCompression = false; - private boolean enableResponseContentMD5Checking = false; - private boolean enableResponseValidation = true; - private OTSRetryStrategy retryStrategy = new OTSDefaultRetryStrategy(); - private int timeThresholdOfTraceLogger = 1000; - - public OTSServiceConfiguration() { - - } - - /** - * 设置是否需要对请求数据进行压缩 - * @param enableRequestCompression - * 是否需要压缩(true/false) - */ - public void setEnableRequestCompression(boolean enableRequestCompression) { - this.enableRequestCompression = enableRequestCompression; - } - - /** - * 返回是否需要对请求数据进行压缩 - * @return 是否需要对request进行压缩 - */ - public boolean isEnableRequestCompression() { - return enableRequestCompression; - } - - /** - * 是否需要告知OTS对返回的响应内容进行压缩 - * @param enableResponseCompression - * 是否告知OTS对返回的响应内容进行压缩 - */ - public void setEnableResponseCompression(boolean enableResponseCompression) { - this.enableResponseCompression = enableResponseCompression; - } - - /** - * 返回是否需要告知OTS对返回的响应内容进行压缩 - * @return - * 是否需要告知OTS对返回的响应内容进行压缩 - */ - public boolean isEnableResponseCompression() { - return enableResponseCompression; - } - - /** - * 返回是否需要对响应内容做MD5校验 - * @return - * 是否需要对MD5内容做MD5校验 - */ - public boolean isEnableResponseContentMD5Checking() { - return enableResponseContentMD5Checking; - } - - /** - * 是否需要对响应的内容做MD5校验, 如果需要校验, - * Client会计算响应数据的MD5值并与返回的响应头中的Content-Md5头的值进行比对 - * @param enableResponseContentMD5Checking - * 是否需要校验响应数据MD5 - */ - public void setEnableResponseContentMD5Checking( - boolean enableResponseContentMD5Checking) { - this.enableResponseContentMD5Checking = enableResponseContentMD5Checking; - } - - /** - * 返回是否需要对响应进行验证 - * @return - * 是否需要对响应进行验证 - */ - public boolean isEnableResponseValidation() { - return enableResponseValidation; - } - - /** - * 是否需要对响应进行验证, 如果需要验证, - * Client会验证头信息完整性、结果是否过期、授权信息是否正确 - * @param enableResponseValidation - * 是否需要对响应进行验证 - */ - public void setEnableResponseValidation(boolean enableResponseValidation) { - this.enableResponseValidation = enableResponseValidation; - } - - /** - * 返回OTS的请求重试策略 - * @return 请求重试策略 - */ - public OTSRetryStrategy getRetryStrategy() { - return retryStrategy; - } - - /** - * 设置OTS的请求重试策略 - * @param retryStrategy - * OTS的请求重试策略 - */ - public void setRetryStrategy(OTSRetryStrategy retryStrategy) { - this.retryStrategy = retryStrategy; - } - - /** - * 返回当前设置的时间阈值(单位:毫秒)。 - * 当一个请求的总执行时间(包含重试占用的时间)超过该阈值时,SDK会记录一条WARN级别的日志。 - * 该功能依赖于日志相关的配置。 - * @return - */ - public int getTimeThresholdOfTraceLogger() { - return timeThresholdOfTraceLogger; - } - - /** - * 设置一个时间阈值(单位:毫秒)。 - * 当一个请求的总执行时间(包含重试占用的时间)超过该阈值时,SDK会记录一条WARN级别的日志。 - * 该功能依赖于日志相关的配置。 - * - * @param timeThresholdOfTraceLogger - */ - public void setTimeThresholdOfTraceLogger(int timeThresholdOfTraceLogger) { - this.timeThresholdOfTraceLogger = timeThresholdOfTraceLogger; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/OTSWriter.java b/src/main/java/com/aliyun/openservices/ots/OTSWriter.java deleted file mode 100644 index bbe43d0..0000000 --- a/src/main/java/com/aliyun/openservices/ots/OTSWriter.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.internal.writer.WriterConfig; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.model.ConsumedCapacity; -import com.aliyun.openservices.ots.model.RowChange; - -import java.util.List; - -/** - * OTS提供了BatchWriteRow接口让用户能够向OTS批量导入数据,但是在实际使用过程中,BatchWriteRow接口的使用方式对开发者并不友好。例如用户 - * 需要自己计算并控制一次BatchWriteRow的数据量大小,需要关注行大小或者列大小是否超过OTS的限制,需要对主键去重以及处理单行错误的重试等等。 - * - * OTSWriter旨在针对批量数据导入的场景提供一个更加易用的接口,但是不是所有场景均适用OTSWriter,在使用之前,请详细了解它的行为,否则会造成数据正确性的问题: - * - OTSWriter所有接口保证线程安全。 - * - 调用{@link #addRowChange}接口向OTSWriter写入一行返回后,并不代表该行已经写入OTS,该行会保存在OTSWriter的本地缓冲中,等待flush,flush成功后该行才会被写入OTS。 - * - 向OTSWriter写入的行的顺序与最终写入OTS的行的顺序不保证一致。 - * - 所有通过OTSWriter的写入操作,需要使用者保证是幂等的,因为OTSWriter内部默认会启用重试,某一行可能会多次写入。 - * - OTSWriter对缓冲区的flush时机由两个因素来控制:一个是flushInterval,根据时间定期的进行flush; - * 另一个是{@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxBatchSize},根据缓冲区的数据量来决定是否需要flush。 - * - OTSWriter在写入数据时,会自动对导入失败的行进行重试,但是并不保证所有行重试后最终一定能够被写入成功(例如:某一行在OTS中已经超过了256KB限制,则无法再向该行写入新的列)。 - * 此时经过若干次重试后若还有数据无法被写入成功,则这些行会被认为是脏数据,脏数据会通OTSCallback反馈给使用者。 - * - 再向OTSWriter写入数据之前,请先注册好Callback,否则若在注册CallBack之前已经有数据写入失败,则失败的行会直接被抛弃。 - * - 程序退出前,需要显式调用{@link #flush}或{@link #close},将还存在缓冲区中的数据进行flush,否则会造成这部分数据丢失。 - * - * OTSWriter对批量导入数据的处理流程: - * 1. addRowChange接口是线程安全的,支持用户线程并发的写入 - * 2. 通过addRowChange接口写入的数据会暂存到缓冲区 - * 3. 每个OTSWriter会启动一个后台导入线程,缓冲区的数据会由该后台线程进行flush。为提升导入效率,该线程会异步并发发送多个RPC,并发数可以配置。 - * 4. 发送成功或者失败的行都会通过callback反馈给使用者,callback的调用会在另外一个ExecutorService(用户可定制)内执行。 - * - * 用户如何使用OTSWriter: - * 1. 初始化OTSWriter,可配置RestrictionConfig、缓冲区Queue、Callback ExecutorService等等 - * 2. 调用{@link #addRowChange}并发的向OTSWriter中写入数据 - * 3. 若写入完毕,调用{@link #flush}对缓冲区内的数据进行flush - * 4. 调用{@link #close}关闭OTSWriter,释放资源 - */ -public interface OTSWriter { - /** - * 向本地缓冲区增加一行数据。 - * - * 在写入缓冲区之前,会对该行数据做如下检查: - * - 该行的主键的Schema是否与表定义的相同。 - * - 该行的主键列或属性列的值大小是否超过限制,值的限制配置在{@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxPKColumnSize}和{@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxAttrColumnSize}。 - * - 该行的属性列的个数是否超过{@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxColumnsCount}。 - * - 该行的大小是否超过{@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxBatchSize}。 - * - 属性列中是否有列名与主键列相同。 - * - * 若在写入缓冲区之前被判定为脏数据,该部分数据不会触发CallBack的调用。 - * - * 以上检查会在SDK端带来额外的CPU消耗,但是这些检查是必要的,为了减少不必要的RPC开销,以及避免脏数据污染同一批次Batch写入的行。 - * - * 注意:若缓冲区满,则该操作会被block。 - * - * 若判断该行为脏数据,该接口会抛出{@link com.aliyun.openservices.ots.ClientException}。 - * - * @param rowChange 要写入的行 - * @throws com.aliyun.openservices.ots.ClientException 若该行被判定为脏数据 - */ - public void addRowChange(RowChange rowChange) throws ClientException; - - /** - * 向本地缓冲区批量写入行。 - * - * 批量写入的每一行会做与{@link #addRowChange(RowChange)}一样的检查,若批量写入的行中存在脏数据,则该函数会抛{@link ClientException}, - * 且所有的脏数据会写入dirtyRows。 - - * @param rowChanges 批量写入的行 - * @param dirtyRows 用于传出脏数据的列表 - * @throws ClientException 若存在脏数据 - */ - public void addRowChange(List rowChanges, List dirtyRows) throws ClientException; - - /** - * 设置Callback,数据写入成功或者失败均会通过Callback来反馈。 - * - * 注意:callback会被写入OTSWriter的所有行共享,会被并发的调用。 - * 这与{@link com.aliyun.openservices.ots.OTSAsync}中每个接口的Callback不同,其callback会与每个请求一一对应,且可以是独立的。 - * 但是这里的Callback是与RowChange对应,且所有RowChange都共享该callback。 - * - * @param callback - */ - public void setCallback(OTSCallback callback); - - /** - * 获取设置的Callback。 - * - * @return callback - */ - public OTSCallback getCallback(); - - /** - * 获取限制项配置。 - * - * @return 限制项配置 - */ - public WriterConfig getWriterConfig(); - - /** - * 主动flush缓冲区中的数据,该函数会等待缓冲区中的所有数据被flush完毕。 - * - * 注意:若在调用flush之后继续向缓冲区中写入数据,flush不会等待这部分新数据的写入,新数据的flush需要重新调用一次flush。 - */ - public void flush() throws ClientException; - - /** - * 关闭OTSWriter,在关闭之前,会先flush掉缓冲区内的所有数据。 - * - * 注意:若在close过程中或者close之后仍然调用{@link #addRowChange}向缓冲区写入数据,则该部分数据不保证会写入OTS。 - */ - public void close(); -} diff --git a/src/main/java/com/aliyun/openservices/ots/PartialResultFailedException.java b/src/main/java/com/aliyun/openservices/ots/PartialResultFailedException.java deleted file mode 100644 index c46be9f..0000000 --- a/src/main/java/com/aliyun/openservices/ots/PartialResultFailedException.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.aliyun.openservices.ots; - -import com.aliyun.openservices.ots.model.OTSResult; - -import java.util.ArrayList; -import java.util.List; - -public class PartialResultFailedException extends OTSException { - - private OTSResult otsResult; - private List errors = new ArrayList(); - - /** - * 构造函数。 - * - * @param cause 错误原因 - * @param requestId RequestId - */ - public PartialResultFailedException(Throwable cause, String requestId, OTSResult otsResult) { - super("Partial result failed in batch operations.", cause, "", requestId, 0); - this.otsResult = otsResult; - } - - public void addError(OTSException ex) { - errors.add(ex); - } - - public List getErrors() { - return this.errors; - } - - public OTSResult getResult() { - return this.otsResult; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/ServiceException.java b/src/main/java/com/aliyun/openservices/ots/ServiceException.java deleted file mode 100755 index 25672e1..0000000 --- a/src/main/java/com/aliyun/openservices/ots/ServiceException.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.aliyun.openservices.ots; - -/** - *

- * 表示阿里云服务返回的错误消息。 - *

- * - *

- * {@link ServiceException}用于处理阿里云服务返回的错误消息。比如,用于身份验证的Access ID不存在, - * 则会抛出{@link ServiceException}(严格上讲,会是该类的一个继承类。比如,OTSClient会抛出OTSException)。 - * 异常中包含了错误代码,用于让调用者进行特定的处理。 - *

- * - *

- * {@link ClientException}表示的则是在向阿里云服务发送请求时出现的错误,以及客户端无法处理返回结果。 - * 例如,在发送请求时网络连接不可用,则会抛出{@link ClientException}的异常。 - *

- * - *

- * 通常来讲,调用者只需要处理{@link ServiceException}。因为该异常表明请求被服务处理,但处理的结果表明 - * 存在错误。异常中包含了细节的信息,特别是错误代码,可以帮助调用者进行处理。 - *

- * - */ -public class ServiceException extends RuntimeException { - - private static final long serialVersionUID = 430933593095358673L; - private String errorCode; - private String requestId; - private String hostId; - private String traceId; - - /** - * 构造新实例。 - */ - public ServiceException() { - super(); - } - - /** - * 用给定的异常信息构造新实例。 - * @param message 异常信息。 - */ - public ServiceException(String message) { - super(message); - } - - /** - * 用表示异常原因的对象构造新实例。 - * @param cause 异常原因。 - */ - public ServiceException(Throwable cause) { - super(cause); - } - - /** - * 用异常消息和表示异常原因的对象构造新实例。 - * @param message 异常信息。 - * @param cause 异常原因。 - */ - public ServiceException(String message, Throwable cause) { - super(message, cause); - } - - /** - * 用异常消息和表示异常原因及其他信息的对象构造新实例。 - * @param message 异常信息。 - * @param cause 异常原因。 - * @param errorCode 错误代码。 - * @param requestId Request ID。 - * @param hostId Host ID。 - */ - public ServiceException(String message, Throwable cause, - String errorCode, String requestId, String hostId){ - this(message, cause); - - this.errorCode = errorCode; - this.requestId = requestId; - this.hostId = hostId; - } - - /** - * 返回错误代码的字符串表示。 - * @return 错误代码的字符串表示。 - */ - public String getErrorCode() { - return errorCode; - } - - /** - * 返回Request标识。 - * @return Request标识。 - */ - public String getRequestId() { - return requestId; - } - - /** - * 返回Host标识。 - * @return Host标识。 - */ - public String getHostId() { - return hostId; - } - - public String getTraceId() { - return traceId; - } - - public void setTraceId(String traceId) { - this.traceId = traceId; - } - - @Override - public String toString() { - return "[Error Code]:" + errorCode + ", " - + "[Message]:" + getMessage() + ", [RequestId]:" + getRequestId() + ", [TraceId]:" + getTraceId(); - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/auth/HmacSHA1Signature.java b/src/main/java/com/aliyun/openservices/ots/auth/HmacSHA1Signature.java deleted file mode 100755 index 40b9bfd..0000000 --- a/src/main/java/com/aliyun/openservices/ots/auth/HmacSHA1Signature.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.aliyun.openservices.ots.auth; - -import java.io.UnsupportedEncodingException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; - -import com.aliyun.openservices.ots.utils.BinaryUtil; - -/** - * Hmac-SHA1签名。 - * - */ -public class HmacSHA1Signature extends ServiceSignature{ - private static final String DEFAULT_ENCODING = "UTF-8"; // Default encoding - private static final String ALGORITHM = "HmacSHA1"; // Signature method. - private static final String VERSION = "1"; // Signature version. - private static final Object LOCK = new Object(); - private static Mac macInstance; // Prototype of the Mac instance. - - public String getAlgorithm() { - return ALGORITHM; - } - - public String getVersion() { - return VERSION; - } - - public HmacSHA1Signature(){ - } - - public String computeSignature(String key, String data){ - try{ - byte[] signData = sign( - key.getBytes(DEFAULT_ENCODING), - data.getBytes(DEFAULT_ENCODING)); - - return BinaryUtil.toBase64String(signData); - } - catch(UnsupportedEncodingException ex){ - throw new RuntimeException("Unsupported algorithm: " + DEFAULT_ENCODING); - } - } - - private byte[] sign(byte[] key, byte[] data){ - try{ - // Because Mac.getInstance(String) calls a synchronized method, - // it could block on invoked concurrently. - // SO use prototype pattern to improve perf. - if (macInstance == null) { - synchronized (LOCK) { - if (macInstance == null) { - macInstance = Mac.getInstance(ALGORITHM); - } - } - } - - Mac mac = null; - try { - mac = (Mac)macInstance.clone(); - } catch (CloneNotSupportedException e) { - // If it is not clonable, create a new one. - mac = Mac.getInstance(ALGORITHM); - } - mac.init(new SecretKeySpec(key, ALGORITHM)); - return mac.doFinal(data); - } - catch(NoSuchAlgorithmException ex){ - throw new RuntimeException("Unsupported algorithm: " + ALGORITHM); - } - catch(InvalidKeyException ex){ - throw new RuntimeException(); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/auth/RequestSigner.java b/src/main/java/com/aliyun/openservices/ots/auth/RequestSigner.java deleted file mode 100755 index 471ee0c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/auth/RequestSigner.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.aliyun.openservices.ots.auth; - -import com.aliyun.openservices.ots.comm.RequestMessage; -import com.aliyun.openservices.ots.ClientException; - -public interface RequestSigner { - - public void sign(RequestMessage request) - throws ClientException; -} diff --git a/src/main/java/com/aliyun/openservices/ots/auth/ServiceCredentials.java b/src/main/java/com/aliyun/openservices/ots/auth/ServiceCredentials.java deleted file mode 100755 index 9b3f9c3..0000000 --- a/src/main/java/com/aliyun/openservices/ots/auth/ServiceCredentials.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.aliyun.openservices.ots.auth; - -import static com.aliyun.openservices.ots.utils.CodingUtils.*; - -/** - * 表示用户访问的授权信息。 - * - */ -public class ServiceCredentials { - private String accessKeyId; - private String accessKeySecret; - private String stsToken; - - /** - * 获取访问用户的Access Key ID。 - * @return Access Key ID。 - */ - public String getAccessKeyId() { - return accessKeyId; - } - - /** - * 设置访问用户的Access ID。 - * @param accessKeyId - * Access Key ID。 - */ - public void setAccessKeyId(String accessKeyId) { - assertParameterNotNull(accessKeyId, "accessKeyId"); - this.accessKeyId = accessKeyId; - } - - /** - * 获取访问用户的Access Key Secret。 - * @return Access Key Secret。 - */ - public String getAccessKeySecret() { - return accessKeySecret; - } - - /** - * 设置访问用户的Access Key Secret。 - * @param accessKeySecret - * Access Key Secret。 - */ - public void setAccessKeySecret(String accessKeySecret) { - assertParameterNotNull(accessKeySecret, "accessKeySecret"); - - this.accessKeySecret = accessKeySecret; - } - - /** - * 构造函数。 - */ - public ServiceCredentials(){ - } - - /** - * 构造函数。 - * @param accessKeyId - * Access Key ID。 - * @param accessKeySecret - * Access Key Secret。 - * @exception NullPointerException accessKeyId或accessKeySecret为空指针。 - */ - public ServiceCredentials(String accessKeyId, String accessKeySecret){ - setAccessKeyId(accessKeyId); - setAccessKeySecret(accessKeySecret); - } - - /** - * 构造函数。 - * @param accessKeyId - * Access Key ID。 - * @param accessKeySecret - * Access Key Secret。 - * @param stsToken - * Aliyun STS token value - * @exception NullPointerException accessKeyId或accessKeySecret为空指针。 - */ - public ServiceCredentials(String accessKeyId, String accessKeySecret, String stsToken){ - setAccessKeyId(accessKeyId); - setAccessKeySecret(accessKeySecret); - setStsToken(stsToken); - } - - /** - * 获取短期访问凭证。 - * 详细信息请参考阿里云STS (Security Token Service) 服务文档。 - * @return token value - */ - public String getStsToken() { - return stsToken; - } - - /** - * 设置短期访问凭证。 - * 详细信息请参考阿里云STS (Security Token Service) 服务文档。 - * @param stsToken STS的临时token值 - */ - public void setStsToken(String stsToken) { - this.stsToken = stsToken; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/auth/ServiceSignature.java b/src/main/java/com/aliyun/openservices/ots/auth/ServiceSignature.java deleted file mode 100755 index 427e52d..0000000 --- a/src/main/java/com/aliyun/openservices/ots/auth/ServiceSignature.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.aliyun.openservices.ots.auth; - -/** - * - * 表示用于计算访问签名的接口。 - * - */ -public abstract class ServiceSignature { - public ServiceSignature(){ - } - - /** - * 获取签名的算法。 - * @return 签名算法。 - */ - public abstract String getAlgorithm(); - - /** - * 获取签名算法的版本信息。 - * @return 签名算法的版本。 - */ - public abstract String getVersion(); - - /** - * 计算签名。 - * @param key 签名所需的密钥,对应于访问的Access Key。 - * @param data 用于计算签名的字符串信息。 - * @return 签名字符串。 - */ - public abstract String computeSignature(String key, String data); - - /** - * 创建默认的ServiceSignature实例。 - * @return 默认的ServiceSignature实现。 - */ - public static ServiceSignature create(){ - return new HmacSHA1Signature(); - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/comm/AsyncClientFutureCallback.java b/src/main/java/com/aliyun/openservices/ots/comm/AsyncClientFutureCallback.java deleted file mode 100644 index 0ee227c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/comm/AsyncClientFutureCallback.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.aliyun.openservices.ots.comm; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.PartialResultFailedException; -import com.aliyun.openservices.ots.internal.OTSExecutionContext; -import com.aliyun.openservices.ots.internal.OTSRetryStrategy; -import com.aliyun.openservices.ots.internal.OTSTraceLogger; -import com.aliyun.openservices.ots.log.LogUtil; -import com.aliyun.openservices.ots.model.OTSBasicFuture; -import com.aliyun.openservices.ots.model.OTSResult; -import org.apache.http.concurrent.FutureCallback; - -import java.util.concurrent.TimeUnit; - -public class AsyncClientFutureCallback implements FutureCallback { - - private OTSExecutionContext executionContext; - private String action; - - public AsyncClientFutureCallback(String action, OTSExecutionContext executionContext) { - this.action = action; - this.executionContext = executionContext; - } - - @Override - public void completed(Res result) { - OTSBasicFuture future = executionContext.getFuture(); - OTSTraceLogger traceLogger = executionContext.getTraceLogger(); - - if (result instanceof OTSResult) { - ((OTSResult) result).setTraceId(traceLogger.getTraceId()); - LogUtil.logOnCompleted(executionContext, ((OTSResult) result).getRequestID()); - traceLogger.printLog(); - future.completed(result); - } else { - future.failed(new ClientException( - "Type error: The type of result is not OTSResult.")); - } - } - - @Override - public void failed(Exception ex) { - final OTSBasicFuture future = executionContext.getFuture(); - OTSTraceLogger traceLogger = executionContext.getTraceLogger(); - OTSRetryStrategy retryStrategy = executionContext.getRetryStrategy(); - - final Exception e; - String requestId = null; - if (ex instanceof OTSException) { - e = ex; - requestId = ((OTSException) ex).getRequestId(); - ((OTSException) e).setTraceId(traceLogger.getTraceId()); - } else if (ex instanceof ClientException) { - e = ex; - ((ClientException) e).setTraceId(traceLogger.getTraceId()); - } else { - e = new ClientException("Unexpected error: " + ex, ex, traceLogger.getTraceId()); - } - LogUtil.logOnFailed(executionContext, e, requestId); - if (retryStrategy.shouldRetry(action, e, executionContext.getRetries() + 1)) { - executionContext.getRetryExecutor().schedule(new Runnable() { - @Override - public void run() { - try { - executionContext.retry(e); - executionContext.getCallable().call(); - } catch (Exception ex) { - future.failed(new ClientException("Failed to retry.", ex)); - } - } - }, retryStrategy.getPauseDelay(action, e, executionContext.getRetries() + 1), - TimeUnit.MILLISECONDS); - } else { - if (e instanceof PartialResultFailedException) { - traceLogger.printLog(); - future.completed((Res) ((PartialResultFailedException) e).getResult()); - } else { - traceLogger.printLog(); - future.failed(e); - } - } - } - - /* - * 这个接口不会被调用到,原因是这个FutureCallback对应的是HttpAsyncClient.execute()返回的Future - * , 我们没有使用和保存这个Future,即不会调用这个Future的cancel()方法,所以不会触发cancelled()。 - * 对用户而言,他看到的接口都不包含Cancel相关的逻辑。 - */ - @Override - public void cancelled() { - - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/RequestHandler.java b/src/main/java/com/aliyun/openservices/ots/comm/RequestHandler.java deleted file mode 100755 index 0416f60..0000000 --- a/src/main/java/com/aliyun/openservices/ots/comm/RequestHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.aliyun.openservices.ots.comm; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.ServiceException; - -/** - * 对即将发送的请求数据进行预处理 - * - */ -public interface RequestHandler { - - /** - * 预处理需要发送的请求数据 - * @param message 请求数据 - * @throws ServiceException - * @throws ClientException - */ - public void handle(RequestMessage message) - throws ServiceException, ClientException; -} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/ResponseHandler.java b/src/main/java/com/aliyun/openservices/ots/comm/ResponseHandler.java deleted file mode 100755 index ddc68ef..0000000 --- a/src/main/java/com/aliyun/openservices/ots/comm/ResponseHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.aliyun.openservices.ots.comm; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.ServiceException; - -/** - * 对返回结果进行处理。 - * - */ -public interface ResponseHandler { - - /** - * 处理返回的结果 - * @param responseData 服务器返回的数据 - * @throws ServiceException - * @throws ClientException - */ - public void handle(ResponseMessage responseData) - throws ServiceException, ClientException; -} diff --git a/src/main/java/com/aliyun/openservices/ots/comm/ServiceClient.java b/src/main/java/com/aliyun/openservices/ots/comm/ServiceClient.java deleted file mode 100755 index 0b65886..0000000 --- a/src/main/java/com/aliyun/openservices/ots/comm/ServiceClient.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.aliyun.openservices.ots.comm; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.internal.OTSAsyncResponseConsumer; -import com.aliyun.openservices.ots.internal.OTSTraceLogger; -import com.aliyun.openservices.ots.utils.HttpUtil; -import com.aliyun.openservices.ots.utils.ResourceManager; -import com.aliyun.openservices.ots.utils.ServiceConstants; -import org.apache.http.concurrent.FutureCallback; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.List; - -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - -public abstract class ServiceClient { - - protected static ResourceManager rm = ResourceManager - .getInstance(ServiceConstants.RESOURCE_NAME_COMMON); - - private ClientConfiguration config; - - protected ServiceClient(ClientConfiguration config) { - this.config = config; - } - - public ClientConfiguration getClientConfiguration() { - return this.config; - } - - public void asyncSendRequest(RequestMessage request, - ExecutionContext context, OTSAsyncResponseConsumer consumer, - FutureCallback callback, OTSTraceLogger traceLogger) { - assertParameterNotNull(request, "RequestMessage"); - assertParameterNotNull(context, "ExecutionContext"); - - context.getSigner().sign(request); - handleRequest(request, context.getResquestHandlers()); - consumer.setContext(context); - asyncSendRequestCore(request, context, consumer, callback, traceLogger); - } - - protected abstract void asyncSendRequestCore(RequestMessage request, - ExecutionContext context, OTSAsyncResponseConsumer consumer, - FutureCallback callback, OTSTraceLogger traceLogger); - - protected void handleRequest(RequestMessage message, - List resquestHandlers) throws ClientException { - for (RequestHandler h : resquestHandlers) { - h.handle(message); - } - } - - public abstract void shutdown(); -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowAsyncResponseConsumer.java deleted file mode 100755 index f15904f..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowAsyncResponseConsumer.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.PartialResultFailedException; -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.log.LogUtil; -import com.aliyun.openservices.ots.model.BatchGetRowResult; -import com.aliyun.openservices.ots.model.OTSResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse; - -import java.util.List; -import java.util.Map; - -class BatchGetRowAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - private BatchGetRowExecutionContext executionContext; - - public BatchGetRowAsyncResponseConsumer(ResultParser resultParser, BatchGetRowExecutionContext executionContext) { - super(resultParser, executionContext.getTraceLogger()); - this.executionContext = executionContext; - } - - /** - * 1.不是private方法,方便做ut. - * 2.假设getTableToRowsStatus()返回的结果中index有序 - */ - BatchGetRowResult mergeResult(BatchGetRowResult lastResult, BatchGetRowResult result) { - - OTSResult meta = new OTSResult(result.getRequestID()); - meta.setTraceId(this.traceLogger.getTraceId()); - BatchGetRowResult mergedResult = new BatchGetRowResult(meta); - - Map> lastRowResultMap = lastResult.getTableToRowsStatus(); - Map> rowResultMap = result.getTableToRowsStatus(); - - for (String tableName : lastRowResultMap.keySet()) { - List lastRowResultList = lastRowResultMap.get(tableName); - List rowResultList = rowResultMap.get(tableName); - int idx = 0; - for (BatchGetRowResult.RowStatus lastRowResult : lastRowResultList) { - if (lastRowResult.isSucceed()) { - mergedResult.addResult(lastRowResult); - } else { - BatchGetRowResult.RowStatus rowResult = rowResultList.get(idx++); - if (rowResult.isSucceed()) { - mergedResult.addResult(new BatchGetRowResult.RowStatus(tableName, rowResult.getRow(), - rowResult.getConsumedCapacity(), lastRowResult.getIndex())); - } else { - mergedResult.addResult(new BatchGetRowResult.RowStatus(tableName, rowResult.getError(), - lastRowResult.getIndex())); - } - } - } - } - return mergedResult; - } - - @Override - protected BatchGetRowResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - BatchGetRowResponse batchGetRowResponse = (BatchGetRowResponse) responseContent - .getMessage(); - BatchGetRowResult result = OTSResultFactory.createBatchGetRowResult( - responseContent, batchGetRowResponse); - - BatchGetRowResult lastResult = executionContext.getLastResult(); - if (lastResult != null) { - result = mergeResult(lastResult, result); - } - List failedRows = result.getFailedRows(); - if (failedRows.isEmpty()) { - return result; - } else { - PartialResultFailedException partialEx = new PartialResultFailedException(null, result.getRequestID(), result); - /** - * 部分失败时记录log信息 - */ - for (BatchGetRowResult.RowStatus rowResult : failedRows) { - OTSException ex = new OTSException(rowResult.getError().getMessage(), null, rowResult.getError().getCode(), - result.getRequestID(), 0); - partialEx.addError(ex); - LogUtil.logOnFailed(executionContext, ex, result.getRequestID()); - } - throw partialEx; - } - } - -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowCallable.java deleted file mode 100644 index bfa9ab3..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowCallable.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -public class BatchGetRowCallable implements OTSCallable { - - private OTSAsyncDataOperation dataOperation; - private BatchGetRowExecutionContext executionContext; - - public BatchGetRowCallable(OTSAsyncDataOperation dataOperation, BatchGetRowExecutionContext executionContext) { - this.dataOperation = dataOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.dataOperation.batchGetRow(this.executionContext); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowExecutionContext.java b/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowExecutionContext.java deleted file mode 100644 index fa021f4..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/BatchGetRowExecutionContext.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.PartialResultFailedException; -import com.aliyun.openservices.ots.model.BatchGetRowRequest; -import com.aliyun.openservices.ots.model.BatchGetRowResult; -import com.aliyun.openservices.ots.model.OTSBasicFuture; - -import java.util.concurrent.ScheduledExecutorService; - -public class BatchGetRowExecutionContext extends OTSExecutionContext { - - private BatchGetRowRequest originalRequest; - private BatchGetRowResult lastResult; - - public BatchGetRowExecutionContext(BatchGetRowRequest request, OTSBasicFuture future, OTSTraceLogger traceLogger, OTSRetryStrategy retryStrategy, ScheduledExecutorService retryExecutor) { - super(request, future, traceLogger, retryStrategy, retryExecutor); - this.originalRequest = request; - } - - public BatchGetRowResult getLastResult() { - return lastResult; - } - - @Override - public void retry(Exception ex) { - retries++; - if (ex instanceof PartialResultFailedException) { - lastResult = (BatchGetRowResult) ((PartialResultFailedException) ex).getResult(); - BatchGetRowRequest request = this.originalRequest.createRequestForRetry(lastResult.getFailedRows()); - setRequest(request); - } - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowAsyncResponseConsumer.java deleted file mode 100755 index b58f251..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowAsyncResponseConsumer.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.PartialResultFailedException; -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.log.LogUtil; -import com.aliyun.openservices.ots.model.BatchWriteRowResult; -import com.aliyun.openservices.ots.model.OTSResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2; - -import java.util.List; -import java.util.Map; - -class BatchWriteRowAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - private BatchWriteRowExecutionContext executionContext; - - public BatchWriteRowAsyncResponseConsumer(ResultParser resultParser, BatchWriteRowExecutionContext executionContext) { - super(resultParser, executionContext.getTraceLogger()); - this.executionContext = executionContext; - } - - /** - * 1.不是private方法,方便做ut. - * 2.假设getRowStatus返回的结果中index有序. - */ - BatchWriteRowResult mergeResult(BatchWriteRowResult lastResult, BatchWriteRowResult result) { - OTSResult meta = new OTSResult(result.getRequestID()); - meta.setTraceId(this.traceLogger.getTraceId()); - BatchWriteRowResult mergedResult = new BatchWriteRowResult(meta); - - Map> lastRowResultMap = lastResult.getPutRowStatus(); - Map> rowResultMap = result.getPutRowStatus(); - - for (String tableName : lastRowResultMap.keySet()) { - List lastRowResultList = lastRowResultMap.get(tableName); - List rowResultList = rowResultMap.get(tableName); - int idx = 0; - for (BatchWriteRowResult.RowStatus lastRowResult : lastRowResultList) { - if (lastRowResult.isSucceed()) { - mergedResult.addPutRowResult(lastRowResult); - } else { - BatchWriteRowResult.RowStatus rowResult = rowResultList.get(idx); - idx++; - if (rowResult.isSucceed()) { - mergedResult.addPutRowResult(new BatchWriteRowResult.RowStatus(tableName, - rowResult.getConsumedCapacity(), lastRowResult.getIndex())); - } else { - mergedResult.addPutRowResult(new BatchWriteRowResult.RowStatus(tableName, - rowResult.getError(), lastRowResult.getIndex())); - } - } - } - } - - lastRowResultMap = lastResult.getUpdateRowStatus(); - rowResultMap = result.getUpdateRowStatus(); - - for (String tableName : lastRowResultMap.keySet()) { - List lastRowResultList = lastRowResultMap.get(tableName); - List rowResultList = rowResultMap.get(tableName); - int idx = 0; - for (BatchWriteRowResult.RowStatus lastRowResult : lastRowResultList) { - if (lastRowResult.isSucceed()) { - mergedResult.addUpdateRowResult(lastRowResult); - } else { - BatchWriteRowResult.RowStatus rowResult = rowResultList.get(idx); - idx++; - if (rowResult.isSucceed()) { - mergedResult.addUpdateRowResult(new BatchWriteRowResult.RowStatus(tableName, - rowResult.getConsumedCapacity(), lastRowResult.getIndex())); - } else { - mergedResult.addUpdateRowResult(new BatchWriteRowResult.RowStatus(tableName, - rowResult.getError(), lastRowResult.getIndex())); - } - } - } - } - - lastRowResultMap = lastResult.getDeleteRowStatus(); - rowResultMap = result.getDeleteRowStatus(); - - for (String tableName : lastRowResultMap.keySet()) { - List lastRowResultList = lastRowResultMap.get(tableName); - List rowResultList = rowResultMap.get(tableName); - int idx = 0; - for (BatchWriteRowResult.RowStatus lastRowResult : lastRowResultList) { - if (lastRowResult.isSucceed()) { - mergedResult.addDeleteRowResult(lastRowResult); - } else { - BatchWriteRowResult.RowStatus rowResult = rowResultList.get(idx); - idx++; - if (rowResult.isSucceed()) { - mergedResult.addDeleteRowResult(new BatchWriteRowResult.RowStatus(tableName, - rowResult.getConsumedCapacity(), lastRowResult.getIndex())); - } else { - mergedResult.addDeleteRowResult(new BatchWriteRowResult.RowStatus(tableName, - rowResult.getError(), lastRowResult.getIndex())); - } - } - } - } - - return mergedResult; - } - - @Override - protected BatchWriteRowResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - OtsProtocol2.BatchWriteRowResponse batchWriteRowResponse = (OtsProtocol2.BatchWriteRowResponse) responseContent - .getMessage(); - BatchWriteRowResult result = OTSResultFactory - .createBatchWriteRowResult(responseContent, batchWriteRowResponse); - - BatchWriteRowResult lastResult = executionContext.getLastResult(); - if (lastResult != null) { - result = mergeResult(lastResult, result); - } - List failedRowsOfPut = result.getFailedRowsOfPut(); - List failedRowsOfUpdate = result.getFailedRowsOfUpdate(); - List failedRowsOfDelete = result.getFailedRowsOfDelete(); - if (failedRowsOfPut.isEmpty() && failedRowsOfUpdate.isEmpty() && failedRowsOfDelete.isEmpty()) { - return result; - } else { - PartialResultFailedException partialEx = new PartialResultFailedException(null, result.getRequestID(), result); - /** - * 部分失败时记录log信息 - */ - for (BatchWriteRowResult.RowStatus rowResult : failedRowsOfPut) { - OTSException ex = new OTSException(rowResult.getError().getMessage(), null, rowResult.getError().getCode(), - result.getRequestID(), 0); - partialEx.addError(ex); - LogUtil.logOnFailed(executionContext, ex, result.getRequestID()); - } - for (BatchWriteRowResult.RowStatus rowResult : failedRowsOfUpdate) { - OTSException ex = new OTSException(rowResult.getError().getMessage(), null, rowResult.getError().getCode(), - result.getRequestID(), 0); - partialEx.addError(ex); - LogUtil.logOnFailed(executionContext, ex, result.getRequestID()); - } - for (BatchWriteRowResult.RowStatus rowResult : failedRowsOfDelete) { - OTSException ex = new OTSException(rowResult.getError().getMessage(), null, rowResult.getError().getCode(), - result.getRequestID(), 0); - partialEx.addError(ex); - LogUtil.logOnFailed(executionContext, ex, result.getRequestID()); - } - - throw partialEx; - } - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowCallable.java deleted file mode 100644 index 6ce01d7..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowCallable.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -public class BatchWriteRowCallable implements OTSCallable { - - private OTSAsyncDataOperation dataOperation; - private BatchWriteRowExecutionContext executionContext; - - public BatchWriteRowCallable(OTSAsyncDataOperation dataOperation, BatchWriteRowExecutionContext executionContext) { - this.dataOperation = dataOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.dataOperation.batchWriteRow(this.executionContext); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowExecutionContext.java b/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowExecutionContext.java deleted file mode 100644 index 649e451..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/BatchWriteRowExecutionContext.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.PartialResultFailedException; -import com.aliyun.openservices.ots.model.BatchWriteRowRequest; -import com.aliyun.openservices.ots.model.BatchWriteRowResult; -import com.aliyun.openservices.ots.model.OTSBasicFuture; - -import java.util.concurrent.ScheduledExecutorService; - -public class BatchWriteRowExecutionContext extends OTSExecutionContext { - - private BatchWriteRowRequest originalRequest; - private BatchWriteRowResult lastResult; - - public BatchWriteRowExecutionContext(BatchWriteRowRequest request, OTSBasicFuture future, OTSTraceLogger traceLogger, OTSRetryStrategy retryStrategy, ScheduledExecutorService retryExecutor) { - super(request, future, traceLogger, retryStrategy, retryExecutor); - this.originalRequest = request; - } - - public BatchWriteRowResult getLastResult() { - return this.lastResult; - } - - @Override - public void retry(Exception ex) { - retries++; - if (ex instanceof PartialResultFailedException) { - lastResult = (BatchWriteRowResult) ((PartialResultFailedException) ex).getResult(); - BatchWriteRowRequest request = originalRequest.createRequestForRetry( - ((BatchWriteRowResult) lastResult).getFailedRowsOfPut(), - ((BatchWriteRowResult) lastResult).getFailedRowsOfUpdate(), - ((BatchWriteRowResult) lastResult).getFailedRowsOfDelete()); - setRequest(request); - } - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/CreateTableAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/CreateTableAsyncResponseConsumer.java deleted file mode 100755 index 83858f8..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/CreateTableAsyncResponseConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.CreateTableResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse; - -class CreateTableAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public CreateTableAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected CreateTableResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - CreateTableResponse createTableResponse = (CreateTableResponse) responseContent - .getMessage(); - CreateTableResult result = OTSResultFactory.createCreateTableResult( - responseContent, createTableResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/CreateTableCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/CreateTableCallable.java deleted file mode 100644 index da499ee..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/CreateTableCallable.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.CreateTableRequest; -import com.aliyun.openservices.ots.model.CreateTableResult; - -public class CreateTableCallable implements OTSCallable { - - private OTSAsyncTableOperation tableOperation; - private OTSExecutionContext executionContext; - - public CreateTableCallable(OTSAsyncTableOperation tableOperation, OTSExecutionContext executionContext) { - this.tableOperation = tableOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.tableOperation.createTable(this.executionContext); - } - -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/DeleteRowAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/DeleteRowAsyncResponseConsumer.java deleted file mode 100755 index 020d140..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/DeleteRowAsyncResponseConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.DeleteRowResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse; - -class DeleteRowAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public DeleteRowAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected DeleteRowResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - DeleteRowResponse deleteRowResponse = (DeleteRowResponse) responseContent - .getMessage(); - DeleteRowResult result = OTSResultFactory.createDeleteRowResult( - responseContent, deleteRowResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/DeleteRowCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/DeleteRowCallable.java deleted file mode 100644 index ce31a7e..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/DeleteRowCallable.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.DeleteRowRequest; -import com.aliyun.openservices.ots.model.DeleteRowResult; - -public class DeleteRowCallable implements OTSCallable { - - private OTSAsyncDataOperation dataOperation; - private OTSExecutionContext executionContext; - - public DeleteRowCallable(OTSAsyncDataOperation dataOperation, OTSExecutionContext executionContext) { - this.dataOperation = dataOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.dataOperation.deleteRow(this.executionContext); - } -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/DeleteTableAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/DeleteTableAsyncResponseConsumer.java deleted file mode 100755 index e63154d..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/DeleteTableAsyncResponseConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.DeleteTableResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse; - -class DeleteTableAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public DeleteTableAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected DeleteTableResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - DeleteTableResponse deleteTableResponse = (DeleteTableResponse) responseContent - .getMessage(); - DeleteTableResult result = OTSResultFactory.createDeleteTableResult( - responseContent, deleteTableResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/DeleteTableCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/DeleteTableCallable.java deleted file mode 100644 index 3f7cb29..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/DeleteTableCallable.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.DeleteTableRequest; -import com.aliyun.openservices.ots.model.DeleteTableResult; - -public class DeleteTableCallable implements OTSCallable { - - private OTSAsyncTableOperation tableOperation; - private OTSExecutionContext executionContext; - - public DeleteTableCallable(OTSAsyncTableOperation tableOperation, OTSExecutionContext executionContext) { - this.tableOperation = tableOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.tableOperation.deleteTable(this.executionContext); - } - -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/DescribeTableAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/DescribeTableAsyncResponseConsumer.java deleted file mode 100755 index 5dc4f02..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/DescribeTableAsyncResponseConsumer.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.DescribeTableResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse; - -class DescribeTableAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public DescribeTableAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected DescribeTableResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - DescribeTableResponse describeTableResponse = (DescribeTableResponse) responseContent - .getMessage(); - DescribeTableResult result = OTSResultFactory - .createDescribeTableResult(responseContent, - describeTableResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/DescribeTableCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/DescribeTableCallable.java deleted file mode 100644 index 86ceafd..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/DescribeTableCallable.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.DescribeTableRequest; -import com.aliyun.openservices.ots.model.DescribeTableResult; - -public class DescribeTableCallable implements OTSCallable { - - private OTSAsyncTableOperation tableOperation; - private OTSExecutionContext executionContext; - - public DescribeTableCallable(OTSAsyncTableOperation tableOperation, OTSExecutionContext executionContext) { - this.tableOperation = tableOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.tableOperation.describeTable(this.executionContext); - } - -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/GetRangeAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/GetRangeAsyncResponseConsumer.java deleted file mode 100755 index 832a31c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/GetRangeAsyncResponseConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.GetRangeResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse; - -class GetRangeAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public GetRangeAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected GetRangeResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - GetRangeResponse getRangeResponse = (GetRangeResponse) responseContent - .getMessage(); - GetRangeResult result = OTSResultFactory.createGetRangeResult( - responseContent, getRangeResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/GetRangeCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/GetRangeCallable.java deleted file mode 100644 index deb1ada..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/GetRangeCallable.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.GetRangeRequest; -import com.aliyun.openservices.ots.model.GetRangeResult; - -public class GetRangeCallable implements OTSCallable { - - private OTSAsyncDataOperation dataOperation; - private OTSExecutionContext executionContext; - - public GetRangeCallable(OTSAsyncDataOperation dataOperation, OTSExecutionContext executionContext) { - this.dataOperation = dataOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.dataOperation.getRange(this.executionContext); - } -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/GetRowAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/GetRowAsyncResponseConsumer.java deleted file mode 100755 index 0ce61a0..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/GetRowAsyncResponseConsumer.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.GetRowResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse; - -class GetRowAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public GetRowAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected GetRowResult parseResult() - throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - GetRowResponse getRowResponse = (GetRowResponse) responseContent - .getMessage(); - GetRowResult result = OTSResultFactory.createGetRowResult( - responseContent, getRowResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/GetRowCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/GetRowCallable.java deleted file mode 100644 index 7690bc2..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/GetRowCallable.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.GetRowRequest; -import com.aliyun.openservices.ots.model.GetRowResult; - -public class GetRowCallable implements OTSCallable { - - private OTSAsyncDataOperation dataOperation; - private OTSExecutionContext executionContext; - - public GetRowCallable(OTSAsyncDataOperation dataOperation, OTSExecutionContext executionContext) { - this.dataOperation = dataOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.dataOperation.getRow(this.executionContext); - } -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/ListTableAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/ListTableAsyncResponseConsumer.java deleted file mode 100755 index 1c8b0cd..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/ListTableAsyncResponseConsumer.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.ListTableResult; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse; - -class ListTableAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public ListTableAsyncResponseConsumer(ResultParser resultParser, OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected ListTableResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - ListTableResponse listTableResponse = (ListTableResponse) responseContent - .getMessage(); - ListTableResult result = OTSResultFactory.createListTableResult( - responseContent, listTableResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/ListTableCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/ListTableCallable.java deleted file mode 100644 index 0703eab..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/ListTableCallable.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.ListTableRequest; -import com.aliyun.openservices.ots.model.ListTableResult; - -public class ListTableCallable implements OTSCallable { - - private OTSAsyncTableOperation tableOperation; - private OTSExecutionContext executionContext; - - public ListTableCallable(OTSAsyncTableOperation tableOperation, OTSExecutionContext executionContext) { - this.tableOperation = tableOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.tableOperation.listTable(this.executionContext); - } - -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSAlwaysRetryStrategy.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSAlwaysRetryStrategy.java deleted file mode 100644 index 9db992e..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSAlwaysRetryStrategy.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -public class OTSAlwaysRetryStrategy implements OTSRetryStrategy { - - private int retryPauseInMillis = 50; // milliseconds - private int maxRetryTimes = 3; - private int maxRetryPauseInMillis = 1000; // one second - - public int getRetryPauseInMillis() { - return retryPauseInMillis; - } - - public void setRetryPauseInMillis(int retryPauseInMillis) { - this.retryPauseInMillis = retryPauseInMillis; - } - - public int getMaxRetryTimes() { - return maxRetryTimes; - } - - public void setMaxRetryTimes(int maxRetryTimes) { - this.maxRetryTimes = maxRetryTimes; - } - - public int getMaxRetryPauseInMillis() { - return maxRetryPauseInMillis; - } - - public void setMaxRetryPauseInMillis(int maxRetryPauseInMillis) { - this.maxRetryPauseInMillis = maxRetryPauseInMillis; - } - - /** - * 若重试次数未超过上限,则重试。 - * - * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 - * @param ex 上次访问失败的错误信息、为ClientException或OTSException - * @param retries 表示本次判断的为第retries次重试,retries 大于 0 - * @return - */ - @Override - public boolean shouldRetry(String action, Exception ex, int retries) { - if (retries > maxRetryTimes) { - return false; - } - - return true; - } - - /** - * 获取重试的时间间隔,重试时间间隔的计算公式为:Math.min(Match.pow(2, reties) * {@link #retryPauseInMillis}, {@link #maxRetryPauseInMillis}) - * - * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 - * @param ex 上次访问失败的错误信息、为ClientException或OTSException - * @param retries 表示将要发起第retries次重试, retries 大于 0 - * @return - */ - @Override - public long getPauseDelay(String action, Exception ex, int retries) { - // make the pause time increase exponentially - // based on an assumption that the more times it retries, - // the less probability it succeeds. - int scale = retryPauseInMillis; - long delay = (long) Math.pow(2, retries) * scale; - return Math.min(delay, maxRetryPauseInMillis); - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncDataOperation.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncDataOperation.java deleted file mode 100755 index d51873d..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncDataOperation.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.OTSActionNames; -import com.aliyun.openservices.ots.OTSServiceConfiguration; -import com.aliyun.openservices.ots.auth.ServiceCredentials; -import com.aliyun.openservices.ots.comm.OTSUri; -import com.aliyun.openservices.ots.comm.ServiceClient; -import com.aliyun.openservices.ots.log.LogUtil; -import com.aliyun.openservices.ots.model.DeleteRowRequest; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.GetRangeRequest; -import com.aliyun.openservices.ots.model.GetRowRequest; -import com.aliyun.openservices.ots.model.PutRowRequest; -import com.aliyun.openservices.ots.model.UpdateRowRequest; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.*; - -import java.util.Map; - -public class OTSAsyncDataOperation extends OTSOperation { - private OTSUri URI_GET_ROW; - private OTSUri URI_PUT_ROW; - private OTSUri URI_UPDATE_ROW; - private OTSUri URI_DELETE_ROW; - private OTSUri URI_BATCH_GET_ROW; - private OTSUri URI_BATCH_WRITE_ROW; - private OTSUri URI_GET_RANGE; - - public OTSAsyncDataOperation(String endpoint, - String instanceName, - ServiceClient client, - ServiceCredentials credentials, - OTSServiceConfiguration serviceConfig) { - super(instanceName, client, credentials, serviceConfig); - - URI_GET_ROW = new OTSUri(endpoint, OTSActionNames.ACTION_GET_ROW); - URI_PUT_ROW = new OTSUri(endpoint, OTSActionNames.ACTION_PUT_ROW); - URI_UPDATE_ROW = new OTSUri(endpoint, OTSActionNames.ACTION_UPDATE_ROW); - URI_DELETE_ROW = new OTSUri(endpoint, OTSActionNames.ACTION_DELETE_ROW); - URI_BATCH_GET_ROW = new OTSUri(endpoint, OTSActionNames.ACTION_BATCH_GET_ROW); - URI_BATCH_WRITE_ROW = new OTSUri(endpoint, OTSActionNames.ACTION_BATCH_WRITE_ROW); - URI_GET_RANGE = new OTSUri(endpoint, OTSActionNames.ACTION_GET_RANGE); - } - - public void getRow(final OTSExecutionContext executionContext) { - - SingleRowQueryCriteria criteria = executionContext.getRequest().getRowQueryCriteria(); - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_GET_ROW, - null, - OTSProtocolHelper.buildGetRowRequest(criteria), - executionContext.getTraceLogger(), - new GetRowAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(GetRowResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void putRow(final OTSExecutionContext executionContext) { - - RowPutChange rowChange = executionContext.getRequest().getRowChange(); - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_PUT_ROW, - null, - OTSProtocolHelper.buildPutRowRequest(rowChange), - executionContext.getTraceLogger(), - new PutRowAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(PutRowResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void updateRow(final OTSExecutionContext executionContext) { - - RowUpdateChange rowChange = executionContext.getRequest().getRowChange(); - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_UPDATE_ROW, - null, - OTSProtocolHelper.buildUpdateRowRequest(rowChange), - executionContext.getTraceLogger(), - new UpdateRowAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(UpdateRowResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void deleteRow(final OTSExecutionContext executionContext) { - - RowDeleteChange rowChange = executionContext.getRequest().getRowChange(); - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_DELETE_ROW, - null, - OTSProtocolHelper.buildDeleteRowRequest(rowChange), - executionContext.getTraceLogger(), - new DeleteRowAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(DeleteRowResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void batchGetRow(final BatchGetRowExecutionContext executionContext) { - - Map criteriasGroupByTable = executionContext.getRequest().getCriteriasByTable(); - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_BATCH_GET_ROW, - null, - OTSProtocolHelper.buildBatchGetRowRequest(criteriasGroupByTable), - executionContext.getTraceLogger(), - new BatchGetRowAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(BatchGetRowResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext), - executionContext.getAsyncClientCallback()); - } - - public void batchWriteRow(final BatchWriteRowExecutionContext executionContext) { - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_BATCH_WRITE_ROW, - null, - OTSProtocolHelper.buildBatchWriteRowRequest(executionContext.getRequest()), - executionContext.getTraceLogger(), - new BatchWriteRowAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(BatchWriteRowResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext), - executionContext.getAsyncClientCallback()); - } - - public void getRange(final OTSExecutionContext executionContext) { - - LogUtil.logBeforeExecution(executionContext); - - RangeRowQueryCriteria criteria = executionContext.getRequest().getRangeRowQueryCriteria(); - - asyncInvokePost( - URI_GET_RANGE, - null, - OTSProtocolHelper.buildGetRangeRequest(criteria), - executionContext.getTraceLogger(), - new GetRangeAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(GetRangeResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncTableOperation.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncTableOperation.java deleted file mode 100755 index ae25cab..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSAsyncTableOperation.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.OTSActionNames; -import com.aliyun.openservices.ots.OTSServiceConfiguration; -import com.aliyun.openservices.ots.auth.ServiceCredentials; -import com.aliyun.openservices.ots.comm.OTSUri; -import com.aliyun.openservices.ots.comm.ServiceClient; -import com.aliyun.openservices.ots.log.LogUtil; -import com.aliyun.openservices.ots.model.CreateTableRequest; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.DeleteTableRequest; -import com.aliyun.openservices.ots.model.DescribeTableRequest; -import com.aliyun.openservices.ots.model.ListTableRequest; -import com.aliyun.openservices.ots.model.UpdateTableRequest; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.*; - -import java.net.URI; -import java.util.Map; - -public class OTSAsyncTableOperation extends OTSOperation { - private OTSUri URI_CREATE_TABLE; - private OTSUri URI_LIST_TABLE; - private OTSUri URI_DELETE_TABLE; - private OTSUri URI_DESCRIBE_TABLE; - private OTSUri URI_UPDATE_TABLE; - - public OTSAsyncTableOperation(String endpoint, - String instanceName, - ServiceClient client, - ServiceCredentials credentials, - OTSServiceConfiguration serviceConfig) { - super(instanceName, client, credentials, serviceConfig); - - URI_CREATE_TABLE = new OTSUri(endpoint, OTSActionNames.ACTION_CREATE_TABLE); - URI_LIST_TABLE = new OTSUri(endpoint, OTSActionNames.ACTION_LIST_TABLE); - URI_DELETE_TABLE = new OTSUri(endpoint, OTSActionNames.ACTION_DELETE_TABLE); - URI_DESCRIBE_TABLE = new OTSUri(endpoint, OTSActionNames.ACTION_DESCRIBE_TABLE); - URI_UPDATE_TABLE = new OTSUri(endpoint, OTSActionNames.ACTION_UPDATE_TABLE); - } - - public void createTable(final OTSExecutionContext executionContext) { - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_CREATE_TABLE, - null, - OTSProtocolHelper.buildCreateTableRequest(executionContext.getRequest()), - executionContext.getTraceLogger(), - new CreateTableAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(CreateTableResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void listTable(final OTSExecutionContext executionContext) { - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_LIST_TABLE, - null, - OTSProtocolHelper.buildListTableRequest(), - executionContext.getTraceLogger(), - new ListTableAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(ListTableResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void deleteTable(final OTSExecutionContext executionContext) { - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_DELETE_TABLE, - null, - OTSProtocolHelper.buildDeleteTableRequest(executionContext.getRequest().getTableName()), - executionContext.getTraceLogger(), - new DeleteTableAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(DeleteTableResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void describeTable(final OTSExecutionContext executionContext) { - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_DESCRIBE_TABLE, - null, - OTSProtocolHelper.buildDescribeTableRequest(executionContext.getRequest().getTableName()), - executionContext.getTraceLogger(), - new DescribeTableAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(DescribeTableResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - - public void updateTable(final OTSExecutionContext executionContext) { - - LogUtil.logBeforeExecution(executionContext); - - asyncInvokePost( - URI_UPDATE_TABLE, - null, - OTSProtocolHelper.buildUpdateTableRequest(executionContext.getRequest()), - executionContext.getTraceLogger(), - new UpdateTableAsyncResponseConsumer(OTSResultParserFactory.createFactory(). - createProtocolBufferResultParser(UpdateTableResponse.getDefaultInstance(), - executionContext.getTraceLogger().getTraceId()), - executionContext.getTraceLogger()), - executionContext.getAsyncClientCallback()); - } - -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSCallable.java deleted file mode 100644 index 17836c9..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSCallable.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -public interface OTSCallable { - - public void call(); - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSCallback.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSCallback.java deleted file mode 100755 index 91f3238..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSCallback.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.model.OTSContext; - -public interface OTSCallback { - /** - * 当请求成功完成时执行 - * @param otsContext - */ - void onCompleted(OTSContext otsContext); - - /** - * 在请求失败,且异常为OTSException时执行。 - * @param otsContext - * @param ex - */ - void onFailed(OTSContext otsContext, OTSException ex); - - /** - * 在请求成功,且异常为ClientException时执行。 - * @param otsContext - * @param ex - */ - void onFailed(OTSContext otsContext, ClientException ex); - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSConsts.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSConsts.java deleted file mode 100755 index 9c0c152..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSConsts.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -public interface OTSConsts { - /** - * 默认的OTS Endpoint。 - */ - public static final String DEFAULT_OTS_ENDPOINT = "http://ots.aliyuncs.com"; - - /** - * OTS RESTful API的版本号。 - */ - public static final String API_VERSION = "2014-08-08"; - - /** - * OTS请求的编码方法。 - */ - public static final String DEFAULT_ENCODING = "utf-8"; - - /** - * OTS请求返回结果的失效时间。 - */ - public static final int RESPONSE_EXPIRE_MINUTES = 15; // 表示返回结果的过期时间。 - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSContentMD5ResponseHandler.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSContentMD5ResponseHandler.java deleted file mode 100755 index c102ef8..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSContentMD5ResponseHandler.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -import com.aliyun.openservices.ots.comm.ResponseHandler; -import com.aliyun.openservices.ots.comm.ResponseMessage; -import com.aliyun.openservices.ots.utils.BinaryUtil; -import com.aliyun.openservices.ots.utils.IOUtils; -import com.aliyun.openservices.ots.utils.ResourceManager; -import com.aliyun.openservices.ots.utils.ServiceConstants; -import com.aliyun.openservices.ots.ClientException; -import org.apache.http.entity.ByteArrayEntity; - -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.*; -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; - -/** - * 验证返回结果。 - * - */ -public class OTSContentMD5ResponseHandler implements ResponseHandler{ - public OTSContentMD5ResponseHandler(){ - } - - public void handle(ResponseMessage responseData) throws ClientException { - Map headers = responseData.getHeadersMap(); - - // 验证头信息完整性 - if (!headers.containsKey(OTS_HEADER_OTS_CONTENT_MD5)){ - throw OTSExceptionFactory.createResponseException( - OTS_RESOURCE_MANAGER.getFormattedString("MissingHeader", OTS_HEADER_OTS_CONTENT_MD5), null); - } - String contentMd5 = headers.get(OTS_HEADER_OTS_CONTENT_MD5); - - // 验证返回值MD5值是否正确 - byte[] content = null; - String md5 = null; - InputStream dataStream = null; - try { - dataStream = responseData.getContent(); - } catch (IOException e) { - throw new ClientException("Can not read response from server.", e); - } - if (dataStream == null){ - throw OTSExceptionFactory.createResponseException( - ResourceManager.getInstance(ServiceConstants.RESOURCE_NAME_COMMON) - .getString("ServerReturnsUnknownError"), - null); - } - try { - content = IOUtils.readStreamAsBytesArray(dataStream); - md5 = BinaryUtil.toBase64String(BinaryUtil.calculateMd5(content)); - } catch (Exception e) { - throw OTSExceptionFactory.createResponseException( - ResourceManager.getInstance(ServiceConstants.RESOURCE_NAME_COMMON) - .getString("ServerReturnsUnknownError"), - null); - } - if (!md5.equals(contentMd5)) { - throw new ClientException(OTS_RESOURCE_MANAGER.getString("ResponseContentMD5Invalid")); - } - - // 检查通过 - IOUtils.safeClose(dataStream); - responseData.getResponse().setEntity(new ByteArrayEntity(content)); // reset output stream - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSDefaultRetryStrategy.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSDefaultRetryStrategy.java deleted file mode 100644 index a3b7364..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSDefaultRetryStrategy.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.*; - -public class OTSDefaultRetryStrategy implements OTSRetryStrategy { - - private static final int DEFAULT_RETRY_PAUSE_SCALE_IN_MILLIS = 50; // milliseconds. - private static final int DEFAULT_MAX_RETRY_PAUSE_IN_MILLIS = 100 * 1000; - private static final int DEFAULT_MAX_RETRY_TIMES = 3; - - private int retryPauseInMillis = DEFAULT_RETRY_PAUSE_SCALE_IN_MILLIS; - private int maxPauseInMillis = DEFAULT_MAX_RETRY_PAUSE_IN_MILLIS; - private int maxRetryTimes = DEFAULT_MAX_RETRY_TIMES; - - public int getRetryPauseInMillis() { - return retryPauseInMillis; - } - - public void setRetryPauseInMillis(int retryPauseInMillis) { - this.retryPauseInMillis = retryPauseInMillis; - } - - public int getMaxRetryTimes() { - return maxRetryTimes; - } - - public void setMaxRetryTimes(int maxRetryTimes) { - this.maxRetryTimes = maxRetryTimes; - } - - public int getMaxPauseInMillis() { - return maxPauseInMillis; - } - - public void setMaxPauseInMillis(int maxPauseInMillis) { - this.maxPauseInMillis = maxPauseInMillis; - } - - private boolean isIdempotent(String action) { - if (action.equals(OTSActionNames.ACTION_BATCH_GET_ROW) || action.equals(OTSActionNames.ACTION_GET_RANGE) || - action.equals(OTSActionNames.ACTION_DESCRIBE_TABLE) || action.equals(OTSActionNames.ACTION_GET_ROW) || - action.equals(OTSActionNames.ACTION_LIST_TABLE)) { - return true; - } else { - return false; - } - } - - private boolean retryNotMatterActions(String errorCode, String errorMessage) { - if (errorCode.equals(OTSErrorCode.ROW_OPERATION_CONFLICT) || errorCode.equals(OTSErrorCode.NOT_ENOUGH_CAPACITY_UNIT) - || errorCode.equals(OTSErrorCode.TABLE_NOT_READY) || errorCode.equals(OTSErrorCode.PARTITION_UNAVAILABLE) - || errorCode.equals(OTSErrorCode.SERVER_BUSY) - || (errorCode.equals(OTSErrorCode.QUOTA_EXHAUSTED) && errorMessage.equals("Too frequent table operations."))) { - return true; - } else { - return false; - } - } - - public boolean shouldRetryWithOTSException(String action, boolean isIdempotent, String errorCode, String errorMessage, int httpStatus) { - if (retryNotMatterActions(errorCode, errorMessage)) { - return true; - } - - boolean serverError = httpStatus >= 500 && httpStatus <= 599; - if (isIdempotent && - (errorCode.equals(OTSErrorCode.STORAGE_TIMEOUT) || errorCode.equals(OTSErrorCode.INTERNAL_SERVER_ERROR) || - errorCode.equals(OTSErrorCode.SERVER_UNAVAILABLE) || serverError)) { - return true; - } - return false; - } - - /** - * SDK提供的默认重试策略,规则为: - * 1. 若异常为OTSException,且错误码为OTSRowOperationConflict, OTSNotEnoughCapacityUnit, OTSTableNotReady, - * OTSPartitionUnavailable或OTSServerBusy,则可以重试。 - * 2. 若异常为OTSQuotaExhausted且异常消息为"Too frequent table operations.",则可以重试。 - * 3. 若异常为ClientException(网络类异常),且操作是幂等的,则可以重试。 - * 4. 若异常为OTSTimeout, OTSInternalServerError, OTSServerUnavailable或http状态码为500, 502或503,且操作为幂等的,则可以重试。 - * - * 默认的重试策略会把所有读相关的操作认为是幂等的,而所有写相关的操作会被认为是非幂等的,若用户对写有重试的需求,需要定制重试策略。 - * - * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 - * @param ex 上次访问失败的错误信息、为ClientException或OTSException - * @param retries 表示本次判断的为第retries次重试,retries 大于 0 - * @return 是否需要重试 - */ - @Override - public boolean shouldRetry(String action, Exception ex, int retries) { - if (retries > maxRetryTimes) { - return false; - } - - boolean isIdempotent = isIdempotent(action); - if (ex instanceof OTSException) { - if (ex instanceof PartialResultFailedException) { - PartialResultFailedException prfe = (PartialResultFailedException) ex; - for (OTSException otsException : prfe.getErrors()) { - if (!shouldRetryWithOTSException(action, isIdempotent, otsException.getErrorCode(), otsException.getMessage(), prfe.getHttpStatus())) { - return false; - } - } - return true; - } else { - OTSException otsException = (OTSException) ex; - return shouldRetryWithOTSException(action, isIdempotent, otsException.getErrorCode(), otsException.getMessage(), otsException.getHttpStatus()); - } - } else if (ex instanceof ClientException) { - return isIdempotent; - } else { - return false; - } - } - - /** - * 返回本次重试需要等待的间隔时间。 - * 默认的重试策略中重试间隔时间的计算公式为: Math.pow(2, retries) * {@link #retryPauseInMillis}。 - * - * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 - * @param ex 上次访问失败的错误信息、为ClientException或OTSException - * @param retries 表示将要发起第retries次重试, retries 大于 0 - * @return - */ - @Override - public long getPauseDelay(String action, Exception ex, int retries) { - // make the pause time increase exponentially - // based on an assumption that the more times it retries, - // the less probability it succeeds. - int scale = retryPauseInMillis; - - // avoid overflow - if (retries > 30) { - return maxPauseInMillis; - } - long delay = (long) Math.pow(2, retries) * scale; - return delay; - } - - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSDeflateResponseHandler.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSDeflateResponseHandler.java deleted file mode 100755 index fbc476c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSDeflateResponseHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import java.io.InputStream; -import java.util.Map; -import java.util.zip.Inflater; - -import com.aliyun.openservices.ots.comm.ResponseHandler; -import com.aliyun.openservices.ots.comm.ResponseMessage; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.ServiceException; -import org.apache.http.entity.ByteArrayEntity; - -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.*; -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; - -/** - * 检查从OTS服务返回的响应数据是否经过压缩, 若是则进行解压 - */ -public class OTSDeflateResponseHandler implements ResponseHandler{ - private final static String OTS_COMPRESS_TYPE = "deflate"; - - @Override - public void handle(ResponseMessage responseData) throws ServiceException, - ClientException { - Map header = responseData.getHeadersMap(); - String compressType = header.get(OTS_HEADER_RESPONSE_COMPRESS_TYPE); - if(compressType != null) { - try{ - if(!OTS_COMPRESS_TYPE.equalsIgnoreCase(compressType.trim())){ - throw new ClientException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidResponseCompressType", compressType.trim())); - } - String strRawDataSize = header.get(OTS_HEADER_RESPONSE_COMPRESS_SIZE); - if(strRawDataSize == null){ - throw new ClientException(OTS_RESOURCE_MANAGER.getFormattedString("RequiredHeaderNotFound", OTS_HEADER_RESPONSE_COMPRESS_SIZE)); - } - int rawDataSize = 0; - try { - rawDataSize = Integer.valueOf(strRawDataSize); - if(rawDataSize <= 0){ - throw new ClientException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidResponseCompressSize", strRawDataSize)); - } - } catch(NumberFormatException e) { - throw new ClientException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidResponseCompressSize", strRawDataSize)); - } - InputStream oldInput = responseData.getContent(); - Inflater decompresser = new Inflater(); - byte[] content = OTSCompressUtil.decompress(oldInput, rawDataSize, decompresser); - responseData.getResponse().setEntity(new ByteArrayEntity(content)); - oldInput.close(); - } catch(Exception e) { - throw new ClientException(OTS_RESOURCE_MANAGER.getFormattedString("ResponseDecompressFail", e.getMessage())); - } - } - else { - // no need decompress, do nothing - } - } - - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSErrorResponseHandler.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSErrorResponseHandler.java deleted file mode 100755 index 7619f09..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSErrorResponseHandler.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.OTS_HEADER_REQUEST_ID; -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.OTS_HTTP_MOVED_PERMANENTLY; -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.OTS_MOVED_PERMANENTLY_LOCATION; -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; - -import com.aliyun.openservices.ots.comm.ResponseHandler; -import com.aliyun.openservices.ots.comm.ResponseMessage; -import com.aliyun.openservices.ots.utils.ResourceManager; -import com.aliyun.openservices.ots.utils.ServiceConstants; -import com.aliyun.openservices.ots.ClientErrorCode; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.Error; - -/** - * 检查返回结果是否有错误。 - * 如果返回状态码不为200,则抛出OTSException异常。 - * - */ -public class OTSErrorResponseHandler implements ResponseHandler{ - public void handle(ResponseMessage responseData) throws OTSException, ClientException { - assertParameterNotNull(responseData, "responseData"); - if (responseData.isSuccessful()){ - return; - } - - Map headers = responseData.getHeadersMap(); - int httpStatus = responseData.getStatusCode(); - - if (httpStatus == OTS_HTTP_MOVED_PERMANENTLY) { - if (!headers.containsKey(OTS_MOVED_PERMANENTLY_LOCATION)){ - throw OTSExceptionFactory.createResponseException( - OTS_RESOURCE_MANAGER.getFormattedString("MissingHeader", OTS_MOVED_PERMANENTLY_LOCATION), null); - } - String location = headers.get(OTS_MOVED_PERMANENTLY_LOCATION); - throw new ClientException( - OTS_RESOURCE_MANAGER.getFormattedString("MovedPermanently", location)); - } - - InputStream errorStream = null; - try { - errorStream = responseData.getContent(); - } catch (IOException e) { - throw new ClientException("Failed to read response from server.", e); - } - if (errorStream == null){ - throw OTSExceptionFactory.createResponseException( - ResourceManager.getInstance(ServiceConstants.RESOURCE_NAME_COMMON) - .getString("ServerReturnsUnknownError"), - null); - } - - if (!headers.containsKey(OTS_HEADER_REQUEST_ID)){ - // SDK接到OTS服务器返回的异常,但是该异常中未包含协议定义的必选header。 - // 此种情况发生在请求被OTS的HTTP服务器直接拦截,未到OTS Server端被处理。 - throw new ClientException(ClientErrorCode.INVALID_RESPONSE, - "OTS returns a response with status code: " + responseData.getStatusCode() + ".", null); - } - - try { - Error errMsg = Error.parseFrom(errorStream); - throw OTSExceptionFactory.create(errMsg, headers.get(OTS_HEADER_REQUEST_ID), httpStatus); - } catch (IOException e) { - throw OTSExceptionFactory.createResponseException( - ResourceManager.getInstance(ServiceConstants.RESOURCE_NAME_COMMON) - .getString("ServerReturnsUnknownError"), - e); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSExceptionFactory.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSExceptionFactory.java deleted file mode 100755 index 71c4030..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSExceptionFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - -import com.aliyun.openservices.ots.ClientErrorCode; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.Error; - -public class OTSExceptionFactory{ - - public static OTSException create(String message, Throwable cause){ - return new OTSException(message, cause); - } - - public static OTSException create(String message, Throwable cause, - String errorCode, String requestId, int httpStatus){ - return new OTSException(message, cause, errorCode, requestId, httpStatus); - } - - public static ClientException createResponseException(String message, Throwable cause){ - return new ClientException( - ClientErrorCode.INVALID_RESPONSE, - OTSUtil.OTS_RESOURCE_MANAGER.getString("ResponseInvalid") + message, - cause); - } - - public static OTSException create(Error errMsg, String requestId, int httpStatus) { - assertParameterNotNull(errMsg, "errMsg"); - return new OTSException(errMsg.getMessage(), null, errMsg.getCode(), requestId, httpStatus); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSExecutionContext.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSExecutionContext.java deleted file mode 100644 index 11c7903..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSExecutionContext.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.aliyun.openservices.ots.internal; - - -import com.aliyun.openservices.ots.model.OTSBasicFuture; -import org.apache.http.concurrent.FutureCallback; - -import java.util.concurrent.ScheduledExecutorService; - -public class OTSExecutionContext { - private Req request; - private OTSBasicFuture future; - private OTSTraceLogger traceLogger; - private FutureCallback asyncClientCallback; - private OTSRetryStrategy retryStrategy; - private ScheduledExecutorService retryExecutor; - private OTSCallable callable; - protected int retries = 0; - - public OTSExecutionContext(Req request, OTSBasicFuture future, OTSTraceLogger traceLogger, - OTSRetryStrategy retryStrategy, ScheduledExecutorService retryExecutor) { - this.request = request; - this.future = future; - this.traceLogger = traceLogger; - this.retryStrategy = retryStrategy; - this.retryExecutor = retryExecutor; - } - - /** - * asyncClientCallback的创建依赖OTSExecutionContext对象,所以这里要单独set, 且应在setRetryHandler之后。 - */ - public void setAsyncClientCallback(FutureCallback futureCallback) { - this.asyncClientCallback = futureCallback; - } - - public void setCallable(OTSCallable callable) { - this.callable = callable; - } - - public OTSCallable getCallable() { - return this.callable; - } - - public void retry(Exception ex) { - retries++; - } - - public void setRequest(Req request) { - this.request = request; - } - - public Req getRequest() { - return this.request; - } - - public OTSBasicFuture getFuture() { - return this.future; - } - - public OTSTraceLogger getTraceLogger() { - return this.traceLogger; - } - - public FutureCallback getAsyncClientCallback() { - return asyncClientCallback; - } - - public OTSRetryStrategy getRetryStrategy() { - return retryStrategy; - } - - public ScheduledExecutorService getRetryExecutor() { - return retryExecutor; - } - - public int getRetries() { - return retries; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSLoggerConstant.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSLoggerConstant.java deleted file mode 100644 index 7f7becf..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSLoggerConstant.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -public class OTSLoggerConstant { - public static final String COLON = ":"; - public static final String DELIMITER = "\t"; - public static final String OTS_ACTION = "OTSAction"; - public static final String REQUEST_CONTENT_SIZE = "RequestContentSize"; - public static final String RESPONSE_CONTENT_SIZE = "ResponseContentSize"; - public static final String REQUEST_ID = "RequestId"; - public static final String TRACE_ID_WITH_COLON = "TraceId:"; - public static final String RETRIES_WITH_COLON = "Retries:"; - public static final String TOTAL_TIME_WITH_COLON = "TotalTime:"; - public static final String OTS_ACTION_WITH_COLON = "OTSAction:"; - public static final String REQUEST_CONTENT_SIZE_WITH_COLON = "RequestContentSize:"; - public static final String RESPONSE_CONTENT_SIZE_WITH_COLON = "ResponseContentSize:"; - public static final String REQUEST_ID_WITH_COLON = "RequestId:"; - public static final String FIRST_EXECUTION = "FirstExecution"; - public static final String START_RETRY = "StartRetry"; - public static final String INTO_HTTP_ASYNC_CLIENT = "IntoHttpAsyncClient"; - public static final String REQUEST_SENT = "RequestSent"; - public static final String RESPONSE_RECEIVED = "ResponseReveived"; - public static final String COMPLETED = "Completed"; - public static final String FAILED = "Failed"; -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSOperation.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSOperation.java deleted file mode 100755 index 4fb0209..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSOperation.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSServiceConfiguration; -import com.aliyun.openservices.ots.auth.ServiceCredentials; -import com.aliyun.openservices.ots.comm.*; -import com.aliyun.openservices.ots.utils.BinaryUtil; -import com.aliyun.openservices.ots.utils.DateUtil; -import com.aliyun.openservices.ots.utils.HttpHeaders; -import com.google.protobuf.Message; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.concurrent.FutureCallback; -import org.apache.http.entity.ByteArrayEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Map; -import java.util.zip.Deflater; - -import static com.aliyun.openservices.ots.internal.OTSConsts.API_VERSION; -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.*; -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - -/** - * 表示对OTS进行操作的类。 - * - */ -public abstract class OTSOperation { - protected Logger logger = LoggerFactory.getLogger(OTSOperation.class); - - private String instanceName; - private ServiceClient client; - private ServiceCredentials credentials; - private OTSServiceConfiguration serviceConfig; - private Map extraHeaders; - - public OTSOperation(String instanceName, - ServiceClient client, ServiceCredentials credentials, - OTSServiceConfiguration serviceConfig) { - assertParameterNotNull(instanceName, "instanceName"); - assertParameterNotNull(client, "client"); - assertParameterNotNull(credentials, "credentials"); - assertParameterNotNull(serviceConfig, "serviceConfig"); - this.instanceName = instanceName; - this.client = client; - this.credentials = credentials; - this.serviceConfig = serviceConfig; - } - - private URI buildURI(OTSUri actionUri, Map queryParameter) { - if (queryParameter == null || queryParameter.isEmpty()) { - return actionUri.getUri(); - } else { - try { - URIBuilder builder = new URIBuilder(actionUri.getUri()); - for (Map.Entry entry : queryParameter.entrySet()) { - builder.addParameter(entry.getKey(), entry.getValue()); - } - return builder.build(); - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } - } - } - - protected void asyncInvokePost(OTSUri actionURI, - Map queryParameters, Message message, - OTSTraceLogger traceLogger, - OTSAsyncResponseConsumer consumer, - FutureCallback callback) throws ClientException { - URI uri = buildURI(actionURI, queryParameters); - HttpPost request = new HttpPost(uri); - - if (logger.isDebugEnabled()) { - logger.debug("Operation: {}, PBRequestMessage: {}, TraceId: {}", - actionURI.getAction(), message.toString(), traceLogger.getTraceId()); - } - - byte[] content = message.toByteArray(); - if (content == null) { - content = new byte[0]; - } - - byte[] dataToSend = null; - if (this.serviceConfig.isEnableRequestCompression()) { - try { - dataToSend = OTSCompressUtil.compress(new ByteArrayInputStream( - content), new Deflater()); - } catch (IOException e) { - throw new ClientException( - OTS_RESOURCE_MANAGER.getFormattedString( - "RequestCompressFail", e.getMessage())); - } - request.addHeader(OTS_HEADER_REQUEST_COMPRESS_TYPE, - OTS_COMPRESS_TYPE); - request.addHeader(OTS_HEADER_REQUEST_COMPRESS_SIZE, - Integer.toString(content.length)); - } else { - dataToSend = content; - } - - request.setEntity(new ByteArrayEntity(dataToSend)); - - String contentMd5 = BinaryUtil.toBase64String(BinaryUtil.calculateMd5(dataToSend)); - - // build a wrapper for HttpRequestBase to store additional information - RequestMessage requestMessage = new RequestMessage(request); - requestMessage.setQueryParameters(queryParameters); - requestMessage.setActionUri(actionURI); - requestMessage.setContentLength(content.length); - - addRequiredHeaders(requestMessage, contentMd5, traceLogger.getTraceId()); - - client.asyncSendRequest(requestMessage, createContext(actionURI.getAction()), consumer, callback, traceLogger); - } - - private ExecutionContext createContext(String otsAction) { - ExecutionContext ec = new ExecutionContext(); - ec.setCharset(OTSConsts.DEFAULT_ENCODING); - ec.setSigner(new OTSRequestSigner(otsAction, credentials)); - - // OTSExceptionResponseHandler必须在OTSValidationResponseHandler之前, - // 因为如果返回结果引发异常时将不需要再进行验证。 - if (this.serviceConfig.isEnableResponseContentMD5Checking()) { - ec.getResponseHandlers().add(new OTSContentMD5ResponseHandler()); - } - ec.getResponseHandlers().add(new OTSDeflateResponseHandler()); - ec.getResponseHandlers().add(new OTSErrorResponseHandler()); - if (this.serviceConfig.isEnableResponseValidation()) { - ec.getResponseHandlers().add( - new OTSValidationResponseHandler(credentials, otsAction)); - } - return ec; - } - - private void addRequiredHeaders(RequestMessage request, String contentMd5, String traceId) { - request.addHeader(OTS_HEADER_OTS_CONTENT_MD5, contentMd5); - request.addHeader(OTS_HEADER_API_VERSION, API_VERSION); - request.addHeader(OTS_HEADER_INSTANCE_NAME, instanceName); - request.addHeader(OTS_HEADER_DATE, DateUtil.getCurrentRfc822Date()); - request.addHeader(OTS_HEADER_ACCESS_KEY_ID, credentials.getAccessKeyId()); - if (credentials.getStsToken() != null && !credentials.getStsToken().isEmpty()) { - request.addHeader(OTS_HEADER_STS_TOKEN, credentials.getStsToken()); - } - if (this.serviceConfig.isEnableResponseCompression()) { - request.addHeader(OTS_HEADER_RESPONSE_COMPRESS_TYPE, - OTS_COMPRESS_TYPE); - } - request.addHeader(OTS_HEADER_SDK_TRACE_ID, traceId); - // Set content type and encoding - request.addHeader(HttpHeaders.CONTENT_TYPE, - "application/x-www-form-urlencoded; " + "charset=" - + OTSConsts.DEFAULT_ENCODING); - - if (extraHeaders != null) { - for (Map.Entry entry : extraHeaders.entrySet()) { - request.addHeader(entry.getKey(), entry.getValue()); - } - } - } - - public void setExtraHeaders(Map extraHeaders) { - this.extraHeaders = extraHeaders; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSRequestSigner.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSRequestSigner.java deleted file mode 100755 index 654d116..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSRequestSigner.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; - -import com.aliyun.openservices.ots.auth.RequestSigner; -import com.aliyun.openservices.ots.auth.ServiceCredentials; -import com.aliyun.openservices.ots.auth.ServiceSignature; -import com.aliyun.openservices.ots.comm.RequestMessage; -import com.aliyun.openservices.ots.utils.DateUtil; -import com.aliyun.openservices.ots.utils.HttpUtil; -import com.aliyun.openservices.ots.ClientException; -import org.apache.http.Header; - -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.*; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - - -public class OTSRequestSigner implements RequestSigner { - - private String otsAction; - private ServiceCredentials credentials; - - public OTSRequestSigner(String otsAction, ServiceCredentials credentials) { - assertParameterNotNull(otsAction, "otsAction"); - assertParameterNotNull(credentials, "credentials"); - - this.otsAction = otsAction; - this.credentials = credentials; - } - - @Override - public void sign(RequestMessage request) throws ClientException { - try { - String signature = getSignature(otsAction, request.getRequest().getMethod(), request.getQueryParameters(), request.getRequest().getAllHeaders(), credentials); - request.addHeader(OTS_HEADER_SIGNATURE, signature); - } catch (UnsupportedEncodingException e) { - throw new ClientException("无法计算签名:" + e.getMessage()); - } - } - - private static String getSignature(String action, String method, Map queryParameters, Header[] headers, ServiceCredentials credentials) - throws UnsupportedEncodingException{ - StringBuilder canonicalizedOtsHeader = new StringBuilder(1000); - Map headerMap = new HashMap(); - for (Header header : headers) { - headerMap.put(header.getName(), header.getValue()); - } - Map sortedMap = sortMap(headerMap); - for(String key : sortedMap.keySet()){ - if (key.startsWith(OTS_HEADER_PREFIX)){ - canonicalizedOtsHeader.append(key).append(":").append(sortedMap.get(key).trim()).append("\n"); - } - } - - if (queryParameters == null) { - queryParameters = new HashMap(); - } - - StringBuilder sb = new StringBuilder(1000); - sb.append("/").append(action).append("\n").append(method).append("\n"). - append(queryParameters.size() == 0 ? "" : HttpUtil.paramToQueryString(sortMap(queryParameters), OTSConsts.DEFAULT_ENCODING)). - append("\n"). - append(canonicalizedOtsHeader.toString()); - - return ServiceSignature.create().computeSignature(credentials.getAccessKeySecret(), sb.toString()); - } - - private static Map sortMap(Map unsortMap) { - //put sorted list into map again - Map sortedMap = new TreeMap(); - sortedMap.putAll(unsortMap); - return sortedMap; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSResultParserFactory.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSResultParserFactory.java deleted file mode 100755 index bc2292f..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSResultParserFactory.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.parser.ResultParser; -import com.google.protobuf.Message; - -public class OTSResultParserFactory { - - private OTSResultParserFactory(){ - } - - public static OTSResultParserFactory createFactory() { - return new OTSResultParserFactory(); - } - - public ResultParser createProtocolBufferResultParser(Message m, String traceId) { - return new ProtocolBufferParser(m, traceId); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSRetryStrategy.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSRetryStrategy.java deleted file mode 100644 index 373546c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSRetryStrategy.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -public interface OTSRetryStrategy { - - /** - * 返回是否需要发起第retries次重试。 - * - * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 - * @param ex 上次访问失败的错误信息、为ClientException或OTSException - * @param retries 表示本次判断的为第retries次重试,retries 大于 0 - * @return 是否需要进行第retries次重试 - */ - public boolean shouldRetry(String action, Exception ex, int retries); - - /** - * 得到发起第retries次重试前延迟的时间。SDK会在这一段时间之后发起第retries次重试。 - * - * @param action 操作名,比如"ListTable"、"GetRow"、"PutRow"等 - * @param ex 上次访问失败的错误信息、为ClientException或OTSException - * @param retries 表示将要发起第retries次重试, retries 大于 0 - * @return 发起第retries次重试前延迟的时间(单位毫秒) - */ - public long getPauseDelay(String action, Exception ex, int retries); -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSTraceLogger.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSTraceLogger.java deleted file mode 100644 index 3a61b8e..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSTraceLogger.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import java.util.LinkedList; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static com.aliyun.openservices.ots.internal.OTSLoggerConstant.*; - -public class OTSTraceLogger { - private String traceId; - private List> eventTimeRecord; - private List> requestInfoRecord; - private static Logger logger = LoggerFactory.getLogger(OTSTraceLogger.class); - private int timeThreshold; - - private class Pair { - private K key; - private V value; - - public Pair(K key, V value) { - this.setKey(key); - this.setValue(value); - } - - public K getKey() { - return key; - } - - public void setKey(K key) { - this.key = key; - } - - public V getValue() { - return value; - } - - public void setValue(V value) { - this.value = value; - } - - public String toString() { - return getKey() + ":" + getValue(); - } - } - - public OTSTraceLogger(String traceId, int timeThreshold) { - this.traceId = traceId; - this.timeThreshold = timeThreshold; - this.eventTimeRecord = new LinkedList>(); - this.requestInfoRecord = new LinkedList>(); - } - - public void addRequestInfo(String key, String value) { - this.requestInfoRecord.add(new Pair(key, value)); - } - - public void addEventTime(String event, Long time) { - this.eventTimeRecord.add(new Pair(event, time)); - } - - public void printLog() { - if (logger.isWarnEnabled()) { - long startTime = eventTimeRecord.get(0).getValue(); - long totalTime = eventTimeRecord.get(eventTimeRecord.size() - 1) - .getValue() - startTime; - if (totalTime > timeThreshold) { - StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(TRACE_ID_WITH_COLON + traceId + DELIMITER); - strBuilder - .append(TOTAL_TIME_WITH_COLON + totalTime + DELIMITER); - for (Pair pair : requestInfoRecord) { - strBuilder.append(pair + DELIMITER); - } - for (Pair pair : eventTimeRecord) { - strBuilder.append(pair + DELIMITER); - } - logger.warn(strBuilder.toString()); - } - } - } - - public String getTraceId() { - return traceId; - } - -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSUtil.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSUtil.java deleted file mode 100755 index 77f5be3..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSUtil.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import java.io.UnsupportedEncodingException; -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CodingErrorAction; - -import com.aliyun.openservices.ots.utils.ResourceManager; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.model.PrimaryKeyValue; -import com.aliyun.openservices.ots.model.PrimaryKeyType; - - -/** - * Utils. - * - */ -public class OTSUtil { - - public static final ResourceManager OTS_RESOURCE_MANAGER = - ResourceManager.getInstance("ots"); - - public static byte[] dataEncode(String data){ - try { - return data.getBytes(OTSConsts.DEFAULT_ENCODING); - } catch (UnsupportedEncodingException e) { - throw new AssertionError("Unsupported encoding:" + OTSConsts.DEFAULT_ENCODING); - } - } - - public static String dataDecode(byte[] bytes) { - try { - CharsetDecoder decoder = Charset.forName(OTSConsts.DEFAULT_ENCODING).newDecoder().onMalformedInput(CodingErrorAction.REPORT); - CharBuffer cb = decoder.decode(ByteBuffer.wrap(bytes)); - return cb.toString(); - } catch(CharacterCodingException e) { - throw new ClientException(OTS_RESOURCE_MANAGER.getFormattedString("ValueInInvalidCharset", new String(bytes))); - } - } - /** - * 参考规范: http://tools.ietf.org/html/rfc3629 - */ - public static int stringtoUTF8Bytes(String str, byte[] buffer) { - int index = 0; - for (int i = 0; i < str.length(); i++) { - char strChar = str.charAt(i); - if( (strChar & 0xFF80) == 0 ) { - // (00000000 00000000 - 00000000 01111111) -> 0xxxxxxx - buffer[index++] = (byte)(strChar & 0x00FF); - } else if( (strChar & 0xF800) == 0 ) { - // (00000000 10000000 - 00000111 11111111) -> 110xxxxx 10xxxxxx - buffer[index++] = (byte)((strChar >> 6) | 0x00c0); - buffer[index++] = (byte)((strChar & 0x003F) | 0x0080); - } else { - // (00001000 00000000 - 11111111 11111111) -> 1110xxxx 10xxxxxx 10xxxxxx - buffer[index++] = (byte)((strChar >> 12) | 0x00e0); - buffer[index++] = (byte)(((strChar >> 6) & 0x003F) | 0x0080); - buffer[index++] = (byte)((strChar & 0x003F) | 0x0080); - } - } - return index; - } - - // return 0 : equals. >0 : left is greater. <0 : right is greater. - public static int compare(PrimaryKeyValue left, PrimaryKeyValue right){ - if (left == null && right == null){ - return 0; - } - - if (left == null){ - return -1; - } - if (right == null){ - return 1; - } - - // left == InfMin - if (left.equals(PrimaryKeyValue.INF_MIN)){ - return right.equals(PrimaryKeyValue.INF_MIN) ? 0 : -1; - } - - // left == InfMax - if (left.equals(PrimaryKeyValue.INF_MAX)){ - return right.equals(PrimaryKeyValue.INF_MAX) ? 0 : 1; - } - - // right == InfMin - if (right.equals(PrimaryKeyValue.INF_MIN)){ - return left.equals(PrimaryKeyValue.INF_MIN) ? 0 : 1; - } - - // right == InfMax - if (right.equals(PrimaryKeyValue.INF_MAX)){ - return left.equals(PrimaryKeyValue.INF_MAX) ? 0 : -1; - } - - if (!( left.getType() != null && right.getType() != null - && left.getType() == right.getType() )) { - throw new AssertionError("type mismatch."); - }; - if (left.getType() == PrimaryKeyType.INTEGER){ - long lLeft = left.asLong(); - long lRight = right.asLong(); - if (lLeft > lRight){ - return 1; - } else if (lLeft < lRight){ - return -1; - } else { - return 0; - } - } - - if (left.getType() != PrimaryKeyType.STRING) { - throw new AssertionError("type mismatch."); - } - return left.asString().compareTo(right.asString()); - } - - // Is a PrimaryKeyValue INF_MAX / INF_MIN - public static boolean isPKInf(PrimaryKeyValue pk){ - return pk == PrimaryKeyValue.INF_MAX || pk == PrimaryKeyValue.INF_MIN; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/OTSValidationResponseHandler.java b/src/main/java/com/aliyun/openservices/ots/internal/OTSValidationResponseHandler.java deleted file mode 100755 index d88eb5d..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/OTSValidationResponseHandler.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import java.util.Date; -import java.util.Map; -import java.util.TreeMap; - -import com.aliyun.openservices.ots.auth.ServiceCredentials; -import com.aliyun.openservices.ots.auth.ServiceSignature; -import com.aliyun.openservices.ots.comm.ResponseHandler; -import com.aliyun.openservices.ots.comm.ResponseMessage; -import com.aliyun.openservices.ots.utils.DateUtil; -import com.aliyun.openservices.ots.ClientException; -import static com.aliyun.openservices.ots.internal.OTSHTTPConstant.*; -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - -/** - * 验证返回结果。 - * - */ -public class OTSValidationResponseHandler implements ResponseHandler{ - - private int responseExpireMinutes = OTSConsts.RESPONSE_EXPIRE_MINUTES; - private ServiceCredentials credentials; - private String otsAction; - - public OTSValidationResponseHandler(ServiceCredentials credentials, String otsAction){ - assertParameterNotNull(credentials, "credentials"); - assertParameterNotNull(otsAction, "otsAction"); - this.credentials = credentials; - this.otsAction = otsAction; - } - - public int getResponseExpireMinutes() { - return responseExpireMinutes; - } - - public void setResponseExpireMinutes(int responseExpireMinutes) { - this.responseExpireMinutes = responseExpireMinutes; - } - - public void handle(ResponseMessage responseData) throws ClientException { - Map headers = responseData.getHeadersMap(); - - // 验证头信息完整性 - if (!headers.containsKey(OTS_HEADER_DATE)){ - throw OTSExceptionFactory.createResponseException( - OTS_RESOURCE_MANAGER.getFormattedString("MissingHeader", OTS_HEADER_DATE), null); - } - if (!headers.containsKey(OTS_HEADER_OTS_CONTENT_MD5)){ - throw OTSExceptionFactory.createResponseException( - OTS_RESOURCE_MANAGER.getFormattedString("MissingHeader", OTS_HEADER_OTS_CONTENT_MD5), null); - } - if (!headers.containsKey(OTS_HEADER_OTS_CONTENT_TYPE)){ - throw OTSExceptionFactory.createResponseException( - OTS_RESOURCE_MANAGER.getFormattedString("MissingHeader", OTS_HEADER_OTS_CONTENT_TYPE), null); - } - if (!headers.containsKey(OTS_HEADER_AUTHORIZATION)){ - throw OTSExceptionFactory.createResponseException( - OTS_RESOURCE_MANAGER.getFormattedString("MissingHeader", OTS_HEADER_AUTHORIZATION), null); - } - final String NEW_LINE = "\n"; - - // 验证结果是否过期 - - Date responseDate; - - try { - responseDate = DateUtil.parseRfc822Date(headers.get(OTS_HEADER_DATE)); - } catch (IllegalArgumentException e) { - throw OTSExceptionFactory.createResponseException("Parse date header from response failed.", e); - } catch (UnsupportedOperationException e) { - throw OTSExceptionFactory.createResponseException("Parse date header from response failed.", e); - } - Date now = new Date(); - long span = (now.getTime() - responseDate.getTime()) / (1000 * 60); // as minutes - if (span > this.responseExpireMinutes){ - throw OTSExceptionFactory.createResponseException("The response has expired.", null); - } - - // 验证授权信息 - StringBuilder canonicalizedOtsHeader = new StringBuilder(1000); - Map sortedMap = new TreeMap(); - sortedMap.putAll(headers); - for(String key : sortedMap.keySet()){ - if (key.startsWith(OTS_HEADER_PREFIX)){ - canonicalizedOtsHeader.append(key); - canonicalizedOtsHeader.append(":"); - canonicalizedOtsHeader.append(sortedMap.get(key)); - canonicalizedOtsHeader.append(NEW_LINE); - } - } - - String canonicalizedResource = "/" + this.otsAction; - - String data = - canonicalizedOtsHeader.toString() + - canonicalizedResource; - String actualSign = - ServiceSignature.create().computeSignature( - this.credentials.getAccessKeySecret(), data); - - String authHeader = headers.get(OTS_HEADER_AUTHORIZATION); - boolean authEqual = false; - if (authHeader.contains(":")){ - String[] arr = authHeader.split(":"); - authEqual = arr[arr.length - 1].endsWith(actualSign); - } - if (!authEqual){ - throw OTSExceptionFactory.createResponseException("返回结果授权信息验证失败。", null); - } - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/internal/PutRowAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/PutRowAsyncResponseConsumer.java deleted file mode 100755 index 8726a14..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/PutRowAsyncResponseConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.model.PutRowResult; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse; - -class PutRowAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public PutRowAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected PutRowResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - PutRowResponse putRowResponse = (PutRowResponse) responseContent - .getMessage(); - PutRowResult result = OTSResultFactory.createPutRowResult( - responseContent, putRowResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/PutRowCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/PutRowCallable.java deleted file mode 100644 index 98c5b15..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/PutRowCallable.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.PutRowRequest; -import com.aliyun.openservices.ots.model.PutRowResult; - -public class PutRowCallable implements OTSCallable { - - private OTSAsyncDataOperation dataOperation; - private OTSExecutionContext executionContext; - - public PutRowCallable(OTSAsyncDataOperation dataOperation, OTSExecutionContext executionContext) { - this.dataOperation = dataOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.dataOperation.putRow(this.executionContext); - } -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/UpdateRowAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/UpdateRowAsyncResponseConsumer.java deleted file mode 100755 index 2b23fae..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/UpdateRowAsyncResponseConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.model.UpdateRowResult; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse; - -class UpdateRowAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public UpdateRowAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected UpdateRowResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - UpdateRowResponse updateRowResponse = (UpdateRowResponse) responseContent - .getMessage(); - UpdateRowResult result = OTSResultFactory.createUpdateRowResult( - responseContent, updateRowResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/UpdateRowCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/UpdateRowCallable.java deleted file mode 100644 index c7e5668..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/UpdateRowCallable.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.UpdateRowRequest; -import com.aliyun.openservices.ots.model.UpdateRowResult; - -public class UpdateRowCallable implements OTSCallable { - - private OTSAsyncDataOperation dataOperation; - private OTSExecutionContext executionContext; - - public UpdateRowCallable(OTSAsyncDataOperation dataOperation, OTSExecutionContext executionContext) { - this.dataOperation = dataOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.dataOperation.updateRow(this.executionContext); - } -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/UpdateTableAsyncResponseConsumer.java b/src/main/java/com/aliyun/openservices/ots/internal/UpdateTableAsyncResponseConsumer.java deleted file mode 100755 index 764e8f9..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/UpdateTableAsyncResponseConsumer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.model.OTSResultFactory; -import com.aliyun.openservices.ots.model.UpdateTableResult; -import com.aliyun.openservices.ots.parser.ResultParser; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse; - -class UpdateTableAsyncResponseConsumer extends - OTSAsyncResponseConsumer { - - public UpdateTableAsyncResponseConsumer(ResultParser resultParser, - OTSTraceLogger traceLogger) { - super(resultParser, traceLogger); - } - - @Override - protected UpdateTableResult parseResult() throws Exception { - ResponseContentWithMeta responseContent = getResponseContentWithMeta(); - UpdateTableResponse updateTableResponse = (UpdateTableResponse) responseContent - .getMessage(); - UpdateTableResult result = OTSResultFactory.createUpdateTableResult( - responseContent, updateTableResponse); - return result; - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/internal/UpdateTableCallable.java b/src/main/java/com/aliyun/openservices/ots/internal/UpdateTableCallable.java deleted file mode 100644 index 6c318a9..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/UpdateTableCallable.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.UpdateTableRequest; -import com.aliyun.openservices.ots.model.UpdateTableResult; - -public class UpdateTableCallable implements OTSCallable { - - private OTSAsyncTableOperation tableOperation; - private OTSExecutionContext executionContext; - - public UpdateTableCallable(OTSAsyncTableOperation tableOperation, OTSExecutionContext executionContext) { - this.tableOperation = tableOperation; - this.executionContext = executionContext; - } - - @Override - public void call() { - this.tableOperation.updateTable(this.executionContext); - } - -} - diff --git a/src/main/java/com/aliyun/openservices/ots/internal/writer/FlushCallback.java b/src/main/java/com/aliyun/openservices/ots/internal/writer/FlushCallback.java deleted file mode 100644 index da7d12a..0000000 --- a/src/main/java/com/aliyun/openservices/ots/internal/writer/FlushCallback.java +++ /dev/null @@ -1,260 +0,0 @@ -package com.aliyun.openservices.ots.internal.writer; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSAsync; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.Error; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Executor; -import java.util.concurrent.Semaphore; -import java.util.concurrent.atomic.AtomicInteger; - -class FlushCallback implements OTSCallback { - private Logger logger = LoggerFactory.getLogger(FlushCallback.class); - - private OTSAsync ots; - private AtomicInteger count; - private Semaphore semaphore; - private long startTime; - private OTSCallback callback; - private Executor executor; - - public FlushCallback(OTSAsync ots, AtomicInteger count, Semaphore semaphore, OTSCallback callback, Executor executor) { - this.ots = ots; - this.count = count; - this.semaphore = semaphore; - this.startTime = System.currentTimeMillis(); - this.callback = callback; - this.executor = executor; - } - - private void triggerSucceedCallback(final RowChange rowChange, final ConsumedCapacity consumedCapacity) { - if (callback == null) { - return; - } - - executor.execute(new Runnable() { - @Override - public void run() { - callback.onCompleted(new OTSContext(rowChange, consumedCapacity)); - } - }); - } - - private void triggerFailedCallback(final RowChange rowChange, final Exception exp) { - if (callback == null) { - return; - } - - executor.execute(new Runnable() { - @Override - public void run() { - if (exp instanceof OTSException) { - callback.onFailed(new OTSContext(rowChange, null), (OTSException) exp); - } else { - callback.onFailed(new OTSContext(rowChange, null), (ClientException) exp); - } - } - }); - } - - private void triggerFailedCallback(final List rowChanges, final Exception exp) { - if (callback == null) { - return; - } - - executor.execute(new Runnable() { - @Override - public void run() { - for (RowChange rowChange : rowChanges) { - if (exp instanceof OTSException) { - callback.onFailed(new OTSContext(rowChange, null), (OTSException) exp); - } else { - callback.onFailed(new OTSContext(rowChange, null), (ClientException) exp); - } - } - } - }); - } - - /** - * 当请求结束后,需要主动释放信号量。
- * 但是注意:这里不是每个请求完成都能去释放信号量。
- * 例如一次BatchWriteRow请求申请了一个信号量,但是由于其包含脏数据,所以需要对每一行数据单独发送一次请求来重试,此时一个并发会分裂为 - * N个并发,这N个并发请求会有自己独立的callback。而其申请的那一个信号量需要由这N个并发中的其中一个来释放,如何选择哪个来释放? - * 这里采取的策略是用一个原子计数器,哪个请求最后一个完成,则由其来释放这个信号量。 - */ - private void requestComplete() { - int remain = this.count.decrementAndGet(); - if (remain == 0) { - semaphore.release(); - logger.debug("Release semaphore."); - } - long endTime = System.currentTimeMillis(); - logger.debug("BatchWriteRow latency: {}", endTime - startTime); - } - - public void onCompleted(BatchWriteRowRequest originRequest, BatchWriteRowResult result) { - List succeed = new ArrayList(); - List failed = new ArrayList(); - - // handle row put - result.getResultOfPut(succeed, failed); - for (BatchWriteRowResult.RowStatus status : succeed) { - triggerSucceedCallback(originRequest.getRowPutChange(status.getTableName(), status.getIndex()), status.getConsumedCapacity()); - } - for (BatchWriteRowResult.RowStatus status : failed) { - Error error = status.getError(); - triggerFailedCallback(originRequest.getRowPutChange(status.getTableName(), status.getIndex()), new OTSException(error.getMessage(), error.getCode(), result.getRequestID())); - } - - // handle row update - succeed.clear(); - failed.clear(); - result.getResultOfUpdate(succeed, failed); - for (BatchWriteRowResult.RowStatus status : succeed) { - triggerSucceedCallback(originRequest.getRowUpdateChange(status.getTableName(), status.getIndex()), status.getConsumedCapacity()); - } - for (BatchWriteRowResult.RowStatus status : failed) { - Error error = status.getError(); - triggerFailedCallback(originRequest.getRowUpdateChange(status.getTableName(), status.getIndex()), new OTSException(error.getMessage(), error.getCode(), result.getRequestID())); - } - - // handle row delete - succeed.clear(); - failed.clear(); - result.getResultOfDelete(succeed, failed); - for (BatchWriteRowResult.RowStatus status : succeed) { - triggerSucceedCallback(originRequest.getRowDeleteChange(status.getTableName(), status.getIndex()), status.getConsumedCapacity()); - } - for (BatchWriteRowResult.RowStatus status : failed) { - Error error = status.getError(); - triggerFailedCallback(originRequest.getRowDeleteChange(status.getTableName(), status.getIndex()), new OTSException(error.getMessage(), error.getCode(), result.getRequestID())); - } - } - - @Override - public void onCompleted(OTSContext otsContext) { - Req request = otsContext.getOTSRequest(); - Res response = otsContext.getOTSResult(); - logger.debug("OnComplete: {}", request.getClass().getName()); - if (request instanceof BatchWriteRowRequest) { - onCompleted((BatchWriteRowRequest) request, (BatchWriteRowResult) response); - } else if (request instanceof PutRowRequest) { - PutRowRequest pr = (PutRowRequest) request; - triggerSucceedCallback(pr.getRowChange(), ((PutRowResult) response).getConsumedCapacity()); - } else if (request instanceof UpdateRowRequest) { - UpdateRowRequest ur = (UpdateRowRequest) request; - triggerSucceedCallback(ur.getRowChange(), ((UpdateRowResult) response).getConsumedCapacity()); - } else if (request instanceof DeleteRowRequest) { - DeleteRowRequest dr = (DeleteRowRequest) request; - triggerSucceedCallback(dr.getRowChange(), ((DeleteRowResult) response).getConsumedCapacity()); - } - - requestComplete(); - } - - @Override - public void onFailed(OTSContext otsContext, OTSException ex) { - Req request = otsContext.getOTSRequest(); - logger.debug("OnFailed on OTSException: {}, {}", request.getClass().getName(), ex); - if (request instanceof BatchWriteRowRequest) { - retryBatchWrite((BatchWriteRowRequest) request); - } else if (request instanceof PutRowRequest) { - PutRowRequest pr = (PutRowRequest) request; - triggerFailedCallback(pr.getRowChange(), ex); - } else if (request instanceof UpdateRowRequest) { - UpdateRowRequest ur = (UpdateRowRequest) request; - triggerFailedCallback(ur.getRowChange(), ex); - } else if (request instanceof DeleteRowRequest) { - DeleteRowRequest dr = (DeleteRowRequest) request; - triggerFailedCallback(dr.getRowChange(), ex); - } - - requestComplete(); - } - - /** - * 在一般情况下,BatchWriteRow是不会发生整体异常的,若发生,则代表其中包含有脏数据,例如有一行的属性列的大小超过大小限制等。 - * 在这种情况下,我们不希望因为这一行脏数据,导致其他的行导入失败。但是由于我们无法找出这是哪一行,所以采取的做法是将这一次Batch内 - * 包含的所有行通过PutRow等单行写操作写过去。 - * 由于我们在writer外层是有一层参数检查了,所以这种情况是极少发生的。 - * - * @param request - */ - private void retryBatchWrite(BatchWriteRowRequest request) { - for (Map.Entry> entry : request.getRowPutChange().entrySet()) { - count.addAndGet(entry.getValue().size()); - for (RowPutChange rowChange : entry.getValue()) { - PutRowRequest pr = new PutRowRequest(); - pr.setRowChange(rowChange); - ots.putRow(pr, new FlushCallback(ots, count, semaphore, callback, executor)); - } - } - - for (Map.Entry> entry : request.getRowUpdateChange().entrySet()) { - count.addAndGet(entry.getValue().size()); - for (RowUpdateChange rowChange : entry.getValue()) { - UpdateRowRequest ur = new UpdateRowRequest(); - ur.setRowChange(rowChange); - ots.updateRow(ur, new FlushCallback(ots, count, semaphore, callback, executor)); - } - } - - for (Map.Entry> entry : request.getRowDeleteChange().entrySet()) { - count.addAndGet(entry.getValue().size()); - for (RowDeleteChange rowChange : entry.getValue()) { - DeleteRowRequest dr = new DeleteRowRequest(); - dr.setRowChange(rowChange); - ots.deleteRow(dr, new FlushCallback(ots, count, semaphore, callback, executor)); - } - } - } - - @Override - public void onFailed(OTSContext otsContext, ClientException ex) { - Req request = otsContext.getOTSRequest(); - logger.debug("OnFailed on ClientException: {}, {}", request.getClass().getName(), ex); - List failedRows = new ArrayList(); - if (request instanceof BatchWriteRowRequest) { - BatchWriteRowRequest bwr = (BatchWriteRowRequest) request; - for (Map.Entry> entry : bwr.getRowPutChange().entrySet()) { - for (RowPutChange rowChange : entry.getValue()) { - failedRows.add(rowChange); - } - } - - for (Map.Entry> entry : bwr.getRowUpdateChange().entrySet()) { - for (RowUpdateChange rowChange : entry.getValue()) { - failedRows.add(rowChange); - } - } - - for (Map.Entry> entry : bwr.getRowDeleteChange().entrySet()) { - for (RowDeleteChange rowChange : entry.getValue()) { - failedRows.add(rowChange); - } - } - } else if (request instanceof PutRowRequest) { - PutRowRequest pr = (PutRowRequest) request; - failedRows.add(pr.getRowChange()); - } else if (request instanceof UpdateRowRequest) { - UpdateRowRequest ur = (UpdateRowRequest) request; - failedRows.add(ur.getRowChange()); - } else if (request instanceof DeleteRowRequest) { - DeleteRowRequest dr = (DeleteRowRequest) request; - failedRows.add(dr.getRowChange()); - } - - triggerFailedCallback(failedRows, ex); - - requestComplete(); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/log/LogUtil.java b/src/main/java/com/aliyun/openservices/ots/log/LogUtil.java deleted file mode 100644 index 8ccb325..0000000 --- a/src/main/java/com/aliyun/openservices/ots/log/LogUtil.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.aliyun.openservices.ots.log; - -import com.aliyun.openservices.ots.internal.OTSExecutionContext; -import com.aliyun.openservices.ots.internal.OTSOperation; -import com.aliyun.openservices.ots.internal.OTSTraceLogger; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static com.aliyun.openservices.ots.internal.OTSLoggerConstant.*; - -public class LogUtil { - public static Logger LOG = LoggerFactory.getLogger(OTSOperation.class); - - public static void logBeforeExecution(OTSExecutionContext executionContext) { - OTSTraceLogger traceLogger = executionContext.getTraceLogger(); - int retries = executionContext.getRetries(); - if (retries == 0) { - if (LOG.isDebugEnabled()) { - LOG.debug(TRACE_ID_WITH_COLON - + traceLogger.getTraceId() + DELIMITER - + FIRST_EXECUTION); - } - traceLogger.addEventTime(FIRST_EXECUTION, - System.currentTimeMillis()); - } else { - if (LOG.isDebugEnabled()) { - LOG.debug(TRACE_ID_WITH_COLON - + traceLogger.getTraceId() + DELIMITER + START_RETRY - + retries); - } - traceLogger.addEventTime(START_RETRY, System.currentTimeMillis()); - } - } - - public static void logRequestInfo(OTSTraceLogger traceLogger, String otsAction, - int contentSize) { - if (LOG.isDebugEnabled()) { - LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() - + DELIMITER + OTS_ACTION_WITH_COLON + otsAction + DELIMITER - + REQUEST_CONTENT_SIZE_WITH_COLON + contentSize); - } - traceLogger.addRequestInfo(OTS_ACTION, otsAction); - traceLogger.addRequestInfo(REQUEST_CONTENT_SIZE, "" + contentSize); - } - - public static void logOnCompleted(OTSExecutionContext executionContext, String requestId) { - OTSTraceLogger traceLogger = executionContext.getTraceLogger(); - int retries = executionContext.getRetries(); - if (LOG.isDebugEnabled()) { - LOG.debug(TRACE_ID_WITH_COLON + traceLogger.getTraceId() - + DELIMITER + COMPLETED + DELIMITER + RETRIES_WITH_COLON - + retries + DELIMITER + REQUEST_ID_WITH_COLON + requestId); - } - traceLogger.addEventTime(COMPLETED, System.currentTimeMillis()); - if (requestId != null) { - traceLogger.addRequestInfo(REQUEST_ID, requestId); - } - } - - public static void logOnFailed(OTSExecutionContext executionContext, Exception ex, String requestId) { - OTSTraceLogger traceLogger = executionContext.getTraceLogger(); - int retries = executionContext.getRetries(); - if (LOG.isErrorEnabled()) { - LOG.error(TRACE_ID_WITH_COLON + traceLogger.getTraceId() - + DELIMITER + FAILED + DELIMITER + RETRIES_WITH_COLON - + retries + DELIMITER + ex); - } - traceLogger.addEventTime(FAILED, System.currentTimeMillis()); - if (requestId != null) { - traceLogger.addRequestInfo(REQUEST_ID, requestId); - } - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowRequest.java b/src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowRequest.java deleted file mode 100755 index e422198..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowRequest.java +++ /dev/null @@ -1,240 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - -public class BatchWriteRowRequest { - - private Map> rowPutChangesGroupByTable; - - private Map> rowUpdateChangesGroupByTable; - - private Map> rowDeleteChangesGroupByTable; - - public BatchWriteRowRequest() { - rowPutChangesGroupByTable = new HashMap>(); - rowUpdateChangesGroupByTable = new HashMap>(); - rowDeleteChangesGroupByTable = new HashMap>(); - } - - /** - * 添加某个表的PutRow参数。在BatchWriteRowRequest中,相同表的PutRow参数会被组织在一起。 - * @param rowPutChange PutRow参数 - */ - public void addRowPutChange(RowPutChange rowPutChange) { - assertParameterNotNull(rowPutChange, "rowPutChange"); - String tableName = rowPutChange.getTableName(); - List rowPutChanges = rowPutChangesGroupByTable.get(tableName); - if (rowPutChanges == null) { - rowPutChanges = new ArrayList(); - rowPutChangesGroupByTable.put(tableName, rowPutChanges); - } - rowPutChanges.add(rowPutChange); - } - - /** - * 根据表名和索引返回PutRow参数。 - * BatchWriteRowResult中返回的多行结果允许部分成功部分失败,返回结果按表组织,且表内行的顺序与BatchWriteRowRequest中一一对应。 - * 若用户需要对BatchWriteRowResult中部分失败的行进行重试,则可以根据失败的行所在的表的表名以及在其在返回结果列表内的索引,从BatchWriteRowRequest中反查即可得到请求参数。 - * @param tableName 表的名称 - * @param index 该行在参数列表中得索引 - * @return PutRow参数 - */ - public RowPutChange getRowPutChange(String tableName, int index) { - List rowPutChanges = rowPutChangesGroupByTable.get(tableName); - if (rowPutChanges == null) { - return null; - } - - if (index >= rowPutChanges.size()) { - return null; - } - return rowPutChanges.get(index); - } - - /** - * 获取所有表的PutRow参数。 - * @return 所有表的PutRow参数。 - */ - public Map> getRowPutChange() { - return rowPutChangesGroupByTable; - } - - public void addRowChange(RowChange rowChange) { - if (rowChange instanceof RowPutChange) { - addRowPutChange((RowPutChange) rowChange); - } else if (rowChange instanceof RowUpdateChange) { - addRowUpdateChange((RowUpdateChange) rowChange); - } else { - addRowDeleteChange((RowDeleteChange) rowChange); - } - } - - /** - * 添加某个表的UpdateRow参数。在BatchWriteRowRequest中,相同表的UpdateRow参数会被组织在一起。 - * @param rowUpdateChange UpdateRow参数 - */ - public void addRowUpdateChange(RowUpdateChange rowUpdateChange) { - assertParameterNotNull(rowUpdateChange, "rowUpdateChange"); - String tableName = rowUpdateChange.getTableName(); - List rowUpdateChanges = rowUpdateChangesGroupByTable.get(tableName); - if (rowUpdateChanges == null) { - rowUpdateChanges = new ArrayList(); - rowUpdateChangesGroupByTable.put(tableName, rowUpdateChanges); - } - rowUpdateChanges.add(rowUpdateChange); - } - - /** - * 根据表名和索引返回UpdateRow参数。 - * BatchWriteRowResult中返回的多行结果允许部分成功部分失败,返回结果按表组织,且表内行的顺序与BatchWriteRowRequest中一一对应。 - * 若用户需要对BatchWriteRowResult中部分失败的行进行重试,则可以根据失败的行所在的表的表名以及在其在返回结果列表内的索引,从BatchWriteRowRequest中反查即可得到请求参数。 - * @param tableName 表的名称 - * @param index 该行在参数列表中得索引 - * @return UpdateRow参数 - */ - public RowUpdateChange getRowUpdateChange(String tableName, int index) { - List rowUpdateChanges = rowUpdateChangesGroupByTable.get(tableName); - if (rowUpdateChanges == null) { - return null; - } - - if (index >= rowUpdateChanges.size()) { - return null; - } - return rowUpdateChanges.get(index); - } - - /** - * 获取所有表的UpdateRow参数。 - * @return 所有表的UpdateRow参数。 - */ - public Map> getRowUpdateChange() { - return rowUpdateChangesGroupByTable; - } - - /** - * 添加某个表的DeleteRow参数。在BatchWriteRowRequest中,相同表的DeleteRow参数会被组织在一起。 - * @param rowDeleteChange DeleteRow参数 - */ - public void addRowDeleteChange(RowDeleteChange rowDeleteChange) { - assertParameterNotNull(rowDeleteChange, "rowDeleteChange"); - String tableName = rowDeleteChange.getTableName(); - List rowDeleteChanges = rowDeleteChangesGroupByTable.get(tableName); - if (rowDeleteChanges == null) { - rowDeleteChanges = new ArrayList(); - rowDeleteChangesGroupByTable.put(tableName, rowDeleteChanges); - } - rowDeleteChanges.add(rowDeleteChange); - } - - /** - * 根据表名和索引返回DeleteRow参数。 - * BatchWriteRowResult中返回的多行结果允许部分成功部分失败,返回结果按表组织,且表内行的顺序与BatchWriteRowRequest中一一对应。 - * 若用户需要对BatchWriteRowResult中部分失败的行进行重试,则可以根据失败的行所在的表的表名以及在其在返回结果列表内的索引,从BatchWriteRowRequest中反查即可得到请求参数。 - * @param tableName 表的名称 - * @param index 该行在参数列表中得索引 - * @return DeleteRow参数 - */ - public RowDeleteChange getRowDeleteChange(String tableName, int index) { - List rowDeleteChanges = rowDeleteChangesGroupByTable.get(tableName); - if (rowDeleteChanges == null) { - return null; - } - - if (index >= rowDeleteChanges.size()) { - return null; - } - return rowDeleteChanges.get(index); - } - - /** - * 获取所有表的DeleteRow参数。 - * @return 所有表的DeleteRow参数。 - */ - public Map> getRowDeleteChange() { - return rowDeleteChangesGroupByTable; - } - - /** - * 检查BatchWriteRowRequest是否包含行。 - * - * @return true if there is no rows - */ - public boolean isEmpty() { - return rowPutChangesGroupByTable.isEmpty() && rowUpdateChangesGroupByTable.isEmpty() && rowDeleteChangesGroupByTable.isEmpty(); - } - - /** - * 获取该BatchWriteRow请求中包含的总的行数。 - * - * @return 总的行数 - */ - public int getRowsCount() { - int rowsCount = 0; - for (Map.Entry> entry : rowPutChangesGroupByTable.entrySet()) { - rowsCount += entry.getValue().size(); - } - - for (Map.Entry> entry : rowUpdateChangesGroupByTable.entrySet()) { - rowsCount += entry.getValue().size(); - } - - for (Map.Entry> entry : rowDeleteChangesGroupByTable.entrySet()) { - rowsCount += entry.getValue().size(); - } - return rowsCount; - } - - /** - * 根据请求返回的结果,提取执行失败的行重新构造一次新的请求。 - * - * @param failedRowsToPut 执行PutRow操作失败的行 - * @param failedRowsToUpdate 执行UpdateRow操作失败的行 - * @param failedRowsToDelete 执行DeleteRow操作失败的行 - * @return 新的用于重试的请求 - */ - public BatchWriteRowRequest createRequestForRetry(List failedRowsToPut, - List failedRowsToUpdate, - List failedRowsToDelete) { - BatchWriteRowRequest request = new BatchWriteRowRequest(); - if (failedRowsToPut != null) { - for (BatchWriteRowResult.RowStatus rowResult : failedRowsToPut) { - RowPutChange rowChange = getRowPutChange(rowResult.getTableName(), rowResult.getIndex()); - if (rowChange == null) { - throw new IllegalArgumentException("Can not find item in table '" + rowResult.getTableName() + "' " + - "with index " + rowResult.getIndex()); - } - request.addRowPutChange(rowChange); - } - } - - if (failedRowsToUpdate != null) { - for (BatchWriteRowResult.RowStatus rowResult : failedRowsToUpdate) { - RowUpdateChange rowChange = getRowUpdateChange(rowResult.getTableName(), rowResult.getIndex()); - if (rowChange == null) { - throw new IllegalArgumentException("Can not find item in table '" + rowResult.getTableName() + "' " + - "with index " + rowResult.getIndex()); - } - request.addRowUpdateChange(rowChange); - } - } - - if (failedRowsToDelete != null) { - for (BatchWriteRowResult.RowStatus rowResult : failedRowsToDelete) { - RowDeleteChange rowChange = getRowDeleteChange(rowResult.getTableName(), rowResult.getIndex()); - if (rowChange == null) { - throw new IllegalArgumentException("Can not find item in table '" + rowResult.getTableName() + "' " + - "with index " + rowResult.getIndex()); - } - request.addRowDeleteChange(rowChange); - } - } - - return request; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowResult.java b/src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowResult.java deleted file mode 100755 index 0bc1fd9..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/BatchWriteRowResult.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class BatchWriteRowResult extends OTSResult { - /** - * BatchWriteRow批量操作中单行写的结果。 - * 若isSucceed为true,则代表该行写操作成功。 - * 若isSucceed为false,则代表该行写操作失败,可以通过getError获取失败的错误信息。 - */ - public static class RowStatus { - private boolean isSucceed = false; - private Error error; - private ConsumedCapacity consumedCapacity; - private String tableName; - private int index; - - public RowStatus(String tableName, ConsumedCapacity consumedCapacity, int index) { - this.isSucceed = true; - this.tableName = tableName; - this.consumedCapacity = consumedCapacity; - this.index = index; - } - - public RowStatus(String tableName, Error error, int index) { - this.isSucceed = false; - this.tableName = tableName; - this.error = error; - this.index = index; - } - - public boolean isSucceed() { - return isSucceed; - } - - public Error getError() { - return error; - } - - public String getTableName() { - return tableName; - } - - public ConsumedCapacity getConsumedCapacity() { - return consumedCapacity; - } - - public int getIndex() { - return index; - } - } - - private Map> tableToPutRowStatus; - private Map> tableToUpdateRowStatus; - private Map> tableToDeleteRowStatus; - - /** - * internal use - */ - public BatchWriteRowResult(OTSResult meta) { - super(meta); - this.tableToPutRowStatus = new HashMap>(); - this.tableToUpdateRowStatus = new HashMap>(); - this.tableToDeleteRowStatus = new HashMap>(); - } - - /** - * internal use - */ - public void addPutRowResult(RowStatus status) { - addResult(status, tableToPutRowStatus); - } - - /** - * internal use - */ - public void addUpdateRowResult(RowStatus status) { - addResult(status, tableToUpdateRowStatus); - } - - /** - * internal use - */ - public void addDeleteRowResult(RowStatus status) { - addResult(status, tableToDeleteRowStatus); - } - - private void addResult(RowStatus status, - Map> tableToRowStatus) { - String tableName = status.getTableName(); - - List statuses = tableToRowStatus.get(tableName); - if (statuses == null) { - statuses = new ArrayList(); - tableToRowStatus.put(tableName, statuses); - } - statuses.add(status); - } - - /** - * 获取某个表上所有PutRow的返回结果。 - * - * @return PutRow的返回结果,若该表不存在,则返回null。 - */ - public List getPutRowStatus(String tableName) { - return tableToPutRowStatus.get(tableName); - } - - /** - * 获取所有表上PutRow的返回结果。 - * - * @return 所有表PutRow返回结果。 - */ - public Map> getPutRowStatus() { - return tableToPutRowStatus; - } - - /** - * 获取某个表上所有UpdateRow的返回结果。 - * - * @return UpdateRow的返回结果,若该表不存在,则返回null。 - */ - public List getUpdateRowStatus(String tableName) { - return tableToUpdateRowStatus.get(tableName); - } - - /** - * 获取所有表上UpdateRow的返回结果。 - * - * @return 所有表UpdateRow返回结果。 - */ - public Map> getUpdateRowStatus() { - return tableToUpdateRowStatus; - } - - /** - * 获取某个表上所有DeleteRow的返回结果。 - * - * @return DeleteRow的返回结果,若该表不存在,则返回null。 - */ - public List getDeleteRowStatus(String tableName) { - return tableToDeleteRowStatus.get(tableName); - } - - /** - * 获取所有表上PutRow的返回结果。 - * - * @return 所有表PutRow返回结果。 - */ - public Map> getDeleteRowStatus() { - return tableToDeleteRowStatus; - } - - /** - * 获取所有PutRow操作执行失败的行。 - * - * @return 若存在执行失败的行,则返回所有行,否则返回空列表 - */ - public List getFailedRowsOfPut() { - List result = new ArrayList(); - getResultOfPut(null, result); - return result; - } - - /** - * 获取所有PutRow操作执行成功的行。 - * - * @return 若存在执行成功的行,则返回所有行,否则返回空列表 - */ - public List getSucceedRowsOfPut() { - List result = new ArrayList(); - getResultOfPut(result, null); - return result; - } - - /** - * 获取所有PutRow执行成功过的行以及所有执行失败的行。 - * - * @param succeedRows 所有执行成功的行 - * @param failedRows 所有执行失败的行 - */ - public void getResultOfPut(List succeedRows, List failedRows) { - for (Map.Entry> entry : tableToPutRowStatus.entrySet()) { - for (RowStatus rs : entry.getValue()) { - if (rs.isSucceed) { - if (succeedRows != null) { - succeedRows.add(rs); - } - } else { - if (failedRows != null) { - failedRows.add(rs); - } - } - } - } - } - - /** - * 获取所有UpdateRow操作执行失败的行。 - * - * @return 若存在执行失败的行,则返回所有行,否则返回空列表 - */ - public List getFailedRowsOfUpdate() { - List result = new ArrayList(); - getResultOfUpdate(null, result); - return result; - } - - /** - * 获取所有UpdateRow操作执行成功的行。 - * - * @return 若存在执行成功的行,则返回所有行,否则返回空列表 - */ - public List getSucceedRowsOfUpdate() { - List result = new ArrayList(); - getResultOfUpdate(result, null); - return result; - } - - /** - * 获取所有UpdateRow执行成功过的行以及所有执行失败的行。 - * - * @param succeedRows 所有执行成功的行 - * @param failedRows 所有执行失败的行 - */ - public void getResultOfUpdate(List succeedRows, List failedRows) { - for (Map.Entry> entry : tableToUpdateRowStatus.entrySet()) { - for (RowStatus rs : entry.getValue()) { - if (rs.isSucceed) { - if (succeedRows != null) { - succeedRows.add(rs); - } - } else { - if (failedRows != null) { - failedRows.add(rs); - } - } - } - } - } - - /** - * 获取所有DeleteRow操作执行失败的行。 - * - * @return 若存在执行失败的行,则返回所有行,否则返回空列表 - */ - public List getFailedRowsOfDelete() { - List result = new ArrayList(); - getResultOfDelete(null, result); - return result; - } - - /** - * 获取所有DeleteRow操作执行成功的行。 - * - * @return 若存在执行成功的行,则返回所有行,否则返回空列表 - */ - public List getSucceedRowsOfDelete() { - List result = new ArrayList(); - getResultOfDelete(result, null); - return result; - } - - /** - * 获取所有DeleteRow执行成功过的行以及所有执行失败的行。 - * - * @param succeedRows 所有执行成功的行 - * @param failedRows 所有执行失败的行 - */ - public void getResultOfDelete(List succeedRows, List failedRows) { - for (Map.Entry> entry : tableToDeleteRowStatus.entrySet()) { - for (RowStatus rs : entry.getValue()) { - if (rs.isSucceed) { - if (succeedRows != null) { - succeedRows.add(rs); - } - } else { - if (failedRows != null) { - failedRows.add(rs); - } - } - } - } - } - - /** - * 是否所有行修改操作都执行成功。 - * - * @return 若所有行修改操作都执行成功,则返回true,否则返回false - */ - public boolean isAllSucceed() { - return getFailedRowsOfPut().isEmpty() && getFailedRowsOfUpdate().isEmpty() && getFailedRowsOfDelete().isEmpty(); - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/model/CapacityUnit.java b/src/main/java/com/aliyun/openservices/ots/model/CapacityUnit.java deleted file mode 100755 index 0eda326..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/CapacityUnit.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.aliyun.openservices.ots.model; - -/** - * 表示表(Table)的CapacityUnit设置。 - */ -public class CapacityUnit { - /** - * 表的读CapacityUnit设置。 - */ - private int readCapacityUnit; - - /** - * 表的写CapacityUnit设置。 - */ - private int writeCapacityUnit; - - /** - * 默认构造函数,读CapacityUnit和写CapacityUnit的值都将初始化为0。 - */ - public CapacityUnit() { - this(0, 0); - } - - /** - * 构造CapacityUnit对象,并指定表的读CapacityUnit和写CapacityUnit配置。 - * @param readCapacityUnit 表的读CapacityUnit,其值必须大于等于0。 - * @param writeCapacityUnit 写CapacityUnit,其值必须大于等于0。 - * @throws IllegalArgumentException - * 若读CapacityUnit或写CapacityUnit的值负数。 - */ - public CapacityUnit(int readCapacityUnit, int writeCapacityUnit) { - setReadCapacityUnit(readCapacityUnit); - setWriteCapacityUnit(writeCapacityUnit); - } - - /** - * 获取读CapacityUnit设置。 - * @return 读CapacityUnit。 - */ - public int getReadCapacityUnit() { - return readCapacityUnit; - } - - /** - * 设置创建表时初始读CapacityUnit的值,设置的值必须为非负数。 - * @param readCapacityUnit 读CapacityUnit的配置 - * @throws IllegalArgumentException - * 若读CapacityUnit的值为负数。 - */ - public void setReadCapacityUnit(int readCapacityUnit) { - if (readCapacityUnit < 0) { - throw new IllegalArgumentException("The read capacity unit must be positive."); - } - this.readCapacityUnit = readCapacityUnit; - } - - /** - * 获取写CapacityUnit设置。 - * @return 写CapacityUnit。 - */ - public int getWriteCapacityUnit() { - return writeCapacityUnit; - } - - /** - * 设置创建表时初始写CapacityUnit的值,设置的值必须为非负数。 - * @param writeCapacityUnit 写CapacityUnit的配置 - * @throws IllegalArgumentException - * 若写CapacityUnit的值为负数。 - */ - public void setWriteCapacityUnit(int writeCapacityUnit) { - if (readCapacityUnit < 0) { - throw new IllegalArgumentException("The write capacity unit must be positive."); - } - this.writeCapacityUnit = writeCapacityUnit; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/ColumnType.java b/src/main/java/com/aliyun/openservices/ots/model/ColumnType.java deleted file mode 100755 index 491e0f1..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/ColumnType.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.HashMap; -import java.util.Map; - -/** - * 表示表(Table)中列的数据类型。 - * - */ -public enum ColumnType { - /** - * 字符串型。 - */ - STRING, - - /** - * 64位带符号的整型。 - */ - INTEGER, - - /** - * 布尔型。 - */ - BOOLEAN, - - /** - * 64位浮点型。 - */ - DOUBLE, - - /** - * 二进制数据。 - */ - BINARY; - - private static final Map strToEnum = new HashMap(); - - static { // Initialize the map - for(ColumnType t : values()){ - strToEnum.put(t.toString(), t); - } - } - - // package-private only. - static ColumnType fromString(String value){ - if (value == null){ - throw new NullPointerException(); - } - return strToEnum.get(value); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/ColumnValue.java b/src/main/java/com/aliyun/openservices/ots/model/ColumnValue.java deleted file mode 100755 index 0d48a76..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/ColumnValue.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.Arrays; -import com.aliyun.openservices.ots.utils.Bytes; -import com.aliyun.openservices.ots.utils.CalculateHelper; - -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; -import static com.aliyun.openservices.ots.utils.CodingUtils.*; - -/** - * 表示行中数据列的值。 - * - */ -public class ColumnValue implements Comparable { - private ColumnType type; // 类型。 - private Object value; // 值。 - private int dataSize = 0; - - private ColumnValue(Object value, ColumnType type){ - assertParameterNotNull(value, "value"); - assertParameterNotNull(type, "type"); - this.value = value; - this.type = type; - switch (this.type) { - case INTEGER: - this.dataSize = 8; - break; - case STRING: - this.dataSize = CalculateHelper.getStringDataSize(this.asString()); - break; - case BINARY: - this.dataSize = this.asBinary().length; - break; - case DOUBLE: - this.dataSize = 8; - break; - case BOOLEAN: - this.dataSize = 1; - break; - default: - throw new IllegalStateException("Bug: not support the type : " + type); - } - } - - /** - * 获取主键列值的大小,各类型大小计算公式为: - * - {@link ColumnType#INTEGER}: 恒定大小为8个字节 - * - {@link ColumnType#DOUBLE}: 恒定大小为8个字节 - * - {@link ColumnType#BOOLEAN}: 恒定大小为1个字节 - * - {@link ColumnType#BINARY}: 大小为字节数 - * - {@link ColumnType#STRING}: 大小为按UTF-8编码后的字节数 - * - * @return 值的大小 - */ - public int getSize() { - return this.dataSize; - } - - /** - * 获取值的数据类型。 - * @return 值的数据类型。 - */ - public ColumnType getType() { - return this.type; - } - - /** - * 使用int对象构造值的数据类型为ColumnType.INTEGER的ColumnValue对象。 - * @param value - * int值。 - */ - public static ColumnValue fromLong(long value) { - return new ColumnValue(value, ColumnType.INTEGER); - } - - /** - * 使用boolean值构造值的数据类型为ColumnType.BOOLEAN的ColumnValue对象。 - * @param value - * boolean值。 - */ - public static ColumnValue fromBoolean(boolean value) { - return new ColumnValue(value, ColumnType.BOOLEAN); - } - - /** - * 使用double对象构造值的数据类型为ColumnType.DOUBLE的ColumnValue对象。 - * @param value - * double值。 - */ - public static ColumnValue fromDouble(double value) { - if (Double.isNaN(value)) { - throw new IllegalArgumentException( - OTS_RESOURCE_MANAGER.getString("DoubleNaNNotSupported")); - } - - return new ColumnValue(value, ColumnType.DOUBLE); - } - - public static ColumnValue fromBinary(byte[] value) { - assertParameterNotNull(value, "value"); - return new ColumnValue(value, ColumnType.BINARY); - } - - /** - * 转换为字符串类型。 - * 当且仅当数据类型为ColumnType.STRING时转换能够成功。 - * @return String值。 - */ - public String asString() { - if (this.type != ColumnType.STRING) { - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "STRING")); - } - - return this.value.toString(); - } - - /** - * 使用String对象构造值的数据类型为ColumnType.STRING的ColumnValue对象。 - * @param value - * String对象。 - */ - public static ColumnValue fromString(String value) { - assertParameterNotNull(value, "value"); - return new ColumnValue(value, ColumnType.STRING); - } - - /** - * 转换为长整型。 - * 当且仅当数据类型为ColumnType.INTEGER时转换能够成功。 - * @return long值。 - */ - public long asLong() { - if (this.type != ColumnType.INTEGER) { - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "INTEGER")); - } - - return (Long)value; - } - - /** - * 转换为双整型。 - * 当且仅当数据类型为ColumnType.DOUBLE时转换能够成功。 - * @return double值。 - */ - public double asDouble() { - if (this.type != ColumnType.DOUBLE) { - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "DOUBLE")); - } - - Double result = (Double)value; - // Handle the precision difference between java and OTS server. - if (result == Double.POSITIVE_INFINITY) { - return Double.MAX_VALUE; - } else if (result == Double.NEGATIVE_INFINITY){ - return -Double.MAX_VALUE; - } - else{ - return result; - } - } - /** - * 转换为布尔型。 - * 当且仅当数据类型为ColumnType.BOOLEAN时转换能够成功。 - * @return boolean值。 - */ - public boolean asBoolean() { - if (this.type != ColumnType.BOOLEAN) { - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "BOOLEAN")); - } - - return (Boolean)value; - } - - /** - * 转换为二进制类型。 - * 当且仅当数据类型为ColumnType.BINARY时转换能够成功。 - * @return byte[]值。 - */ - public byte[] asBinary() { - if (this.type != ColumnType.BINARY) { - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "BINARY")); - } - return (byte[])value; - } - - @Override - public boolean equals(Object o) { - if (o == null || !(o instanceof ColumnValue)) { - return false; - } - ColumnValue val = (ColumnValue) o; - if (this.type == val.type) { - if (this.type == ColumnType.BINARY) { - return Bytes.equals((byte[]) value, (byte[]) val.value); - } else { - return this.value.equals(val.value); - } - } else { - return false; - } - } - - @Override - public int hashCode() { - if (this.type == ColumnType.BINARY) { - return Arrays.hashCode(asBinary()) * 31 + this.type.hashCode(); - } else { - return this.value.hashCode() * 31 + this.type.hashCode(); - } - } - - @Override - public String toString() { - if (this.type == ColumnType.BINARY) { - return Arrays.toString(asBinary()) + ":" + this.type; - } else { - return this.value.toString() + ":" + this.type; - } - } - - /** - * 比较两个属性列的值的大小。 - *

注意:不同类型的属性列无法比较。

- * - * @param target - * @return 如果大于返回值大于0,等于返回0,小于返回值小于0 - */ - @Override - public int compareTo(ColumnValue target) { - if (this.type != target.type) { - throw new IllegalArgumentException("The type of column to compare must be the same."); - } - - switch (this.type) { - case STRING: - return ((String) value).compareTo(target.asString()); - case INTEGER: - return ((Long) value).compareTo(target.asLong()); - case BINARY: - byte[] b1 = (byte[]) this.value; - byte[] b2 = (byte[]) target.value; - int ret = Bytes.compareByteArrayInLexOrder(b1, 0, b1.length, b2, 0, b2.length); - return ret; - case DOUBLE: - return ((Double) value).compareTo(target.asDouble()); - case BOOLEAN: - return ((Boolean) value).compareTo(target.asBoolean()); - default: - throw new IllegalArgumentException("Unknown type: " + this.type); - } - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/ConsumedCapacity.java b/src/main/java/com/aliyun/openservices/ots/model/ConsumedCapacity.java deleted file mode 100755 index 20cdd06..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/ConsumedCapacity.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class ConsumedCapacity { - - private CapacityUnit capacityUnit; - - public ConsumedCapacity() { - - } - - /** - * 获取CapacityUnit。 - * @return CapacityUnit。 - */ - public CapacityUnit getCapacityUnit() { - return capacityUnit; - } - - /** - * 设置CapacityUnit。 - * @param capacityUnit capacityUnit。 - */ - public void setCapacityUnit(CapacityUnit capacityUnit) { - this.capacityUnit = capacityUnit; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/CreateTableRequest.java b/src/main/java/com/aliyun/openservices/ots/model/CreateTableRequest.java deleted file mode 100755 index b598ac4..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/CreateTableRequest.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static com.aliyun.openservices.ots.utils.CodingUtils.*; - -public class CreateTableRequest { - /** - * 表的Meta - */ - private TableMeta tableMeta; - - /** - * 表的预留吞吐量设置。 - */ - private ReservedThroughput reservedThroughput; - - public CreateTableRequest() { - tableMeta = new TableMeta(); - } - - public CreateTableRequest(TableMeta tableMeta) { - setTableMeta(tableMeta); - } - - /** - * 获取表的Meta。 - * @return 表的Meta - */ - public TableMeta getTableMeta() { - return tableMeta; - } - - /** - * 设置表的Meta。 - * @param tableMeta 表的Meta - */ - public void setTableMeta(TableMeta tableMeta) { - assertParameterNotNull(tableMeta, "tableMeta"); - this.tableMeta = tableMeta; - } - - /** - * 获取表的预留吞吐量。 - * @return 表的预留吞吐量设置。 - */ - public ReservedThroughput getReservedThroughput() { - return reservedThroughput; - } - - /** - * 设置表的预留吞吐量。 - * @param reservedThroughput 表的预留吞吐量。 - */ - public void setReservedThroughput(ReservedThroughput reservedThroughput) { - assertParameterNotNull(reservedThroughput, "reservedThroughput"); - this.reservedThroughput = reservedThroughput; - } - - /** - * 设置表的预留吞吐量。 - * @param capacityUnit 表的预留吞吐量的值。 - */ - public void setReservedThroughput(CapacityUnit capacityUnit) { - assertParameterNotNull(capacityUnit, "capacityUnit"); - this.reservedThroughput = new ReservedThroughput(capacityUnit); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/CreateTableResult.java b/src/main/java/com/aliyun/openservices/ots/model/CreateTableResult.java deleted file mode 100755 index 5cf839f..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/CreateTableResult.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class CreateTableResult extends OTSResult { - - CreateTableResult() { - - } - - CreateTableResult(OTSResult meta) { - super(meta); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/DeleteRowRequest.java b/src/main/java/com/aliyun/openservices/ots/model/DeleteRowRequest.java deleted file mode 100755 index 37aae37..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/DeleteRowRequest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static com.aliyun.openservices.ots.utils.CodingUtils.*; - -public class DeleteRowRequest { - - /** - * DeleteRow操作的请求参数。 - */ - private RowDeleteChange rowChange; - - public DeleteRowRequest() { - - } - - public DeleteRowRequest(RowDeleteChange rowChange) { - setRowChange(rowChange); - } - - /** - * 获取DeleteRow操作的请求参数。 - * @return - */ - public RowDeleteChange getRowChange() { - return rowChange; - } - - /** - * 设置DeleteRow操作的请求参数。 - * @param rowChange DeleteRow操作的请求参数。 - */ - public void setRowChange(RowDeleteChange rowChange) { - assertParameterNotNull(rowChange, "rowChange"); - this.rowChange = rowChange; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/DeleteRowResult.java b/src/main/java/com/aliyun/openservices/ots/model/DeleteRowResult.java deleted file mode 100755 index e2ad7db..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/DeleteRowResult.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class DeleteRowResult extends OTSResult { - private ConsumedCapacity consumedCapacity; - - public DeleteRowResult(OTSResult meta) { - super(meta); - } - - public ConsumedCapacity getConsumedCapacity() { - return consumedCapacity; - } - - public void setConsumedCapacity(ConsumedCapacity consumedCapacity) { - this.consumedCapacity = consumedCapacity; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/DeleteTableRequest.java b/src/main/java/com/aliyun/openservices/ots/model/DeleteTableRequest.java deleted file mode 100755 index 230a317..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/DeleteTableRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static com.aliyun.openservices.ots.utils.CodingUtils.*; - -public class DeleteTableRequest { - /** - * 表的名称。 - */ - private String tableName; - - public DeleteTableRequest() { - this(""); - } - - public DeleteTableRequest(String tableName) { - setTableName(tableName); - } - - /** - * 获取表的名称。 - * @return 表的名称。 - */ - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - assertParameterNotNull(tableName, "tableName"); - this.tableName = tableName; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/DeleteTableResult.java b/src/main/java/com/aliyun/openservices/ots/model/DeleteTableResult.java deleted file mode 100755 index 4ce5081..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/DeleteTableResult.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class DeleteTableResult extends OTSResult { - - public DeleteTableResult() { - - } - - public DeleteTableResult(OTSResult meta) { - super(meta); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/DescribeTableResult.java b/src/main/java/com/aliyun/openservices/ots/model/DescribeTableResult.java deleted file mode 100755 index 0213c2b..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/DescribeTableResult.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class DescribeTableResult extends OTSResult { - /** - * 表的Meta定义。 - */ - private TableMeta tableMeta; - - /** - * 表的预留吞吐量的更改信息。 - */ - private ReservedThroughputDetails reservedThroughputDetails; - - public DescribeTableResult(OTSResult meta) { - super(meta); - } - - public void setTableMeta(TableMeta tableMeta) { - this.tableMeta = tableMeta; - } - - /** - * 返回表的Meta定义。 - * @return 表的Meta。 - */ - public TableMeta getTableMeta() { - return tableMeta; - } - - void setReservedThroughputDetails(ReservedThroughputDetails reservedThroughputDetails) { - this.reservedThroughputDetails = reservedThroughputDetails; - } - - /** - * 返回表的预留吞吐量的更改信息。 - * @return 表的预留吞吐量的更改信息。 - */ - public ReservedThroughputDetails getReservedThroughputDetails() { - return reservedThroughputDetails; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/Direction.java b/src/main/java/com/aliyun/openservices/ots/model/Direction.java deleted file mode 100755 index ce15476..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/Direction.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public enum Direction { - /** - * 正序读。 - */ - FORWARD("FORWARD"), - /** - * 反序读。 - */ - BACKWARD("BACKWARD"); - - private String name; - - private Direction(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/GetRangeResult.java b/src/main/java/com/aliyun/openservices/ots/model/GetRangeResult.java deleted file mode 100755 index 096ff0c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/GetRangeResult.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.List; - -public class GetRangeResult extends OTSResult { - /** - * 此次操作消耗的CapacityUnit。 - */ - private ConsumedCapacity consumedCapacity; - - /** - * 范围查询返回的所有行。 - */ - private List rows; - - /** - * 下一次查询的范围的起始边界。 - */ - private RowPrimaryKey nextStartPrimaryKey; - - public GetRangeResult(OTSResult meta) { - super(meta); - } - - /** - * 获取此次操作消耗的CapacityUnit。 - * @return 此次操作消耗的CapacityUnit。 - */ - public ConsumedCapacity getConsumedCapacity() { - return consumedCapacity; - } - - void setConsumedCapacity(ConsumedCapacity consumedCapacity) { - this.consumedCapacity = consumedCapacity; - } - - /** - * 获取本次查询返回的所有行。 - * @return - */ - public List getRows() { - return rows; - } - - void setRows(List rows) { - this.rows = rows; - } - - /** - * 获取下一次查询的范围的起始边界。 - * 若为null,则代表本次查询已经返回所有数据,无需再次查询。 - * @return - */ - public RowPrimaryKey getNextStartPrimaryKey() { - return nextStartPrimaryKey; - } - - void setNextStartPrimaryKey(RowPrimaryKey nextStartPrimaryKey) { - this.nextStartPrimaryKey = nextStartPrimaryKey; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/GetRowResult.java b/src/main/java/com/aliyun/openservices/ots/model/GetRowResult.java deleted file mode 100755 index e82b8d1..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/GetRowResult.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class GetRowResult extends OTSResult { - /** - * 单行查询返回的数据。 - */ - private Row row; - - /** - * 此次操作消耗的CapacityUnit。 - */ - private ConsumedCapacity consumedCapacity; - - GetRowResult(OTSResult meta) { - super(meta); - } - - /** - * 获取单行查询返回的数据。 - * @return - */ - public Row getRow() { - return row; - } - - void setRow(Row row) { - this.row = row; - } - - /** - * 获取此次操作消耗的CapacityUnit。 - * @return 此次操作消耗的CapacityUnit。 - */ - public ConsumedCapacity getConsumedCapacity() { - return consumedCapacity; - } - - void setConsumedCapacity(ConsumedCapacity consumedCapacity) { - this.consumedCapacity = consumedCapacity; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/ListTableRequest.java b/src/main/java/com/aliyun/openservices/ots/model/ListTableRequest.java deleted file mode 100755 index 589766b..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/ListTableRequest.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class ListTableRequest { - -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/ListTableResult.java b/src/main/java/com/aliyun/openservices/ots/model/ListTableResult.java deleted file mode 100755 index b376b61..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/ListTableResult.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.List; - -public class ListTableResult extends OTSResult { - /** - * 表的名称列表。 - */ - private List tableNames; - - ListTableResult() { - } - - ListTableResult(OTSResult meta) { - super(meta); - } - - /** - * 获取表的名称列表。 - * @return 表的名称列表。 - */ - public List getTableNames() { - return tableNames; - } - - void setTableNames(List tableNames) { - this.tableNames = tableNames; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/MultiRowQueryCriteria.java b/src/main/java/com/aliyun/openservices/ots/model/MultiRowQueryCriteria.java deleted file mode 100755 index db48a45..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/MultiRowQueryCriteria.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.utils.Preconditions; - -import java.util.ArrayList; -import java.util.List; - -public class MultiRowQueryCriteria extends RowQueryCriteria { - - private List rowKeys; - - public MultiRowQueryCriteria(String tableName) { - super(tableName); - rowKeys = new ArrayList(); - } - - /** - * 向多行查询条件中插入要查询的行的主键。 - * @param primaryKey 要查询的行的主键。 - */ - public void addRow(RowPrimaryKey primaryKey) { - this.rowKeys.add(primaryKey); - } - - /** - * 获取该表中所要要查询的行的主键。 - * @return 所有行的主键。 - */ - public List getRowKeys() { - return rowKeys; - } - - /** - * 设置该表中所有要查询的行的主键。 - * @param primaryKeys 所有行的主键。 - */ - public void setRowKeys(List primaryKeys) { - this.rowKeys = primaryKeys; - } - - /** - * 获取某行的主键。 - *

若该行index不存在,则返回null。

- * - * @param index 该行的索引 - * @return 若该行存在,则返回该行主键,否则返回null - */ - public RowPrimaryKey get(int index) { - Preconditions.checkArgument(index >= 0, "The index should not be negative."); - - if (rowKeys == null || rowKeys.isEmpty()) { - return null; - } - - if (index >= rowKeys.size()) { - return null; - } - return rowKeys.get(index); - } - - /** - * 清空要查询的所有行。 - */ - public void clear() { - this.rowKeys.clear(); - } - - /** - * 获取要查询的行的个数。 - * - * @return 行数。 - */ - public int size() { - return rowKeys.size(); - } - - public boolean isEmpty() { - return rowKeys.isEmpty(); - } - - public MultiRowQueryCriteria cloneWithoutRowKeys() { - MultiRowQueryCriteria newCriteria = new MultiRowQueryCriteria(this.getTableName()); - this.copyTo(newCriteria); - return newCriteria; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/OTSBasicFuture.java b/src/main/java/com/aliyun/openservices/ots/model/OTSBasicFuture.java deleted file mode 100644 index 9c3fe05..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/OTSBasicFuture.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; -import org.apache.http.util.Args; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -public class OTSBasicFuture implements OTSFuture { - - private final OTSFutureCallback callback; - - private volatile boolean completed; - private volatile T result; - private volatile Exception ex; - - public OTSBasicFuture(final OTSFutureCallback callback) { - super(); - this.callback = callback; - } - - public boolean isDone() { - return this.completed; - } - - private T getResult() throws OTSException, ClientException { - if (this.ex instanceof OTSException) { - // create a new exception as this.ex doesn't has current stack trace - OTSException tmp = (OTSException)this.ex; - OTSException newExp = new OTSException(tmp.getMessage(), tmp, tmp.getErrorCode(), tmp.getRequestId(), tmp.getHttpStatus()); - newExp.setTraceId(tmp.getTraceId()); - throw newExp; - } else if (this.ex instanceof ClientException) { - // create a new exception as this.ex doesn't has current stack trace - throw new ClientException(this.ex.getMessage(), this.ex, ((ClientException) this.ex).getTraceId()); - } - return this.result; - } - - public synchronized T get() throws OTSException, ClientException { - while (!this.completed) { - try { - wait(); - } catch (InterruptedException e) { - throw new ClientException(String.format( - "The thread was interrupted: %s", e.getMessage())); - } - } - return getResult(); - } - - public synchronized T get(final long timeout, final TimeUnit unit) - throws OTSException, ClientException, TimeoutException { - Args.notNull(unit, "Time unit"); - final long msecs = unit.toMillis(timeout); - final long startTime = (msecs <= 0) ? 0 : System.currentTimeMillis(); - long waitTime = msecs; - if (this.completed) { - return getResult(); - } else if (waitTime <= 0) { - throw new TimeoutException(); - } else { - for (;;) { - try { - wait(waitTime); - } catch (InterruptedException e) { - throw new ClientException(String.format( - "The thread was interrupted: %s", e.getMessage())); - } - if (this.completed) { - return getResult(); - } else { - waitTime = msecs - (System.currentTimeMillis() - startTime); - if (waitTime <= 0) { - throw new TimeoutException(); - } - } - } - } - } - - public boolean completed(final T result) { - synchronized (this) { - if (this.completed) { - return false; - } - this.completed = true; - this.result = result; - notifyAll(); - } - if (this.callback != null) { - this.callback.completed(result); - } - return true; - } - - public boolean failed(final Exception exception) { - synchronized (this) { - if (this.completed) { - return false; - } - this.completed = true; - this.ex = exception; - notifyAll(); - } - if (this.callback != null) { - this.callback.failed(exception); - } - return true; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/OTSContext.java b/src/main/java/com/aliyun/openservices/ots/model/OTSContext.java deleted file mode 100755 index 37a40f0..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/OTSContext.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class OTSContext { - private Req otsRequest; - private Res otsResult; - - public OTSContext(Req otsRequest, Res otsResult) { - this.otsRequest = otsRequest; - this.otsResult = otsResult; - } - - public Req getOTSRequest() { - return otsRequest; - } - - public void setOTSRequest(Req otsRequest) { - this.otsRequest = otsRequest; - } - - public Res getOTSResult() { - return otsResult; - } - - public void setOTSResult(Res otsResult) { - this.otsResult = otsResult; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/OTSFuture.java b/src/main/java/com/aliyun/openservices/ots/model/OTSFuture.java deleted file mode 100755 index 8fec678..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/OTSFuture.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; - -/* - * 关于OTSFuture接口的使用,可以参考java.util.concurrent.Future。 - * OTSFuture没有提供类似Future.cancel()的cancel方法, - * 因为与OTS的连接建立之后,实际上已不能取消本次请求。 - * - */ -public interface OTSFuture { - - public boolean isDone(); - - public V get() throws ClientException, OTSException; - - public V get(long timeout, TimeUnit unit) throws ClientException, - OTSException, TimeoutException; -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/OTSFutureCallback.java b/src/main/java/com/aliyun/openservices/ots/model/OTSFutureCallback.java deleted file mode 100644 index 7252583..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/OTSFutureCallback.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public interface OTSFutureCallback { - - void completed(T result); - - void failed(Exception ex); - -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/model/OTSProtocolHelper.java b/src/main/java/com/aliyun/openservices/ots/model/OTSProtocolHelper.java deleted file mode 100755 index 6c82c89..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/OTSProtocolHelper.java +++ /dev/null @@ -1,775 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.model.condition.ColumnCondition; -import com.aliyun.openservices.ots.model.condition.ColumnConditionType; -import com.aliyun.openservices.ots.protocol.OtsProtocol2; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.*; -import com.google.protobuf.ByteString; - -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; - -public class OTSProtocolHelper { - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType toPBColumnType(PrimaryKeyType pkType) { - switch(pkType) { - case INTEGER: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER; - case STRING: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING; - case BINARY: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY; - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidPrimaryKeyType", pkType.toString())); - } - } - - public static PrimaryKeyType toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType type) { - switch(type) { - case INTEGER: - return PrimaryKeyType.INTEGER; - case STRING: - return PrimaryKeyType.STRING; - case BINARY: - return PrimaryKeyType.BINARY; - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidPrimaryKeyType", type.toString())); - } - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType toPBColumnType(com.aliyun.openservices.ots.model.ColumnType colType) { - switch(colType) { - case BOOLEAN: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BOOLEAN; - case INTEGER: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER; - case STRING: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING; - case DOUBLE: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.DOUBLE; - case BINARY: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY; - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidColumnType", colType.toString())); - } - } - - public static com.aliyun.openservices.ots.model.ColumnType toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType type) { - switch(type) { - case BOOLEAN: - return com.aliyun.openservices.ots.model.ColumnType.BOOLEAN; - case DOUBLE: - return com.aliyun.openservices.ots.model.ColumnType.DOUBLE; - case INTEGER: - return com.aliyun.openservices.ots.model.ColumnType.INTEGER; - case STRING: - return com.aliyun.openservices.ots.model.ColumnType.STRING; - case BINARY: - return com.aliyun.openservices.ots.model.ColumnType.BINARY; - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidColumnType", type.toString())); - } - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue buildColumnValue(com.aliyun.openservices.ots.model.PrimaryKeyValue primaryKey) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(); - switch(primaryKey.getType()){ - case INTEGER: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - // optional int64 v_int = 2; - builder.setVInt(primaryKey.asLong()); - break; - case STRING: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - // optional string v_string = 3; - builder.setVString(primaryKey.asString()); - break; - case BINARY: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY); - // optional string v_binary = 4; - builder.setVBinary(ByteString.copyFrom(primaryKey.asBinary())); - break; - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidPartitionKeyType", primaryKey.getType().toString())); - } - return builder.build(); - } - - public static PrimaryKeyValue toPrimaryKeyValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - switch(value.getType()) { - case INTEGER: - if (!value.hasVInt()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_int")); - } - return PrimaryKeyValue.fromLong(value.getVInt()); - case STRING: - if (!value.hasVString()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_string")); - } - return PrimaryKeyValue.fromString(value.getVString()); - case BINARY: - if (!value.hasVBinary()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_binary")); - } - return PrimaryKeyValue.fromBinary(value.getVBinary().toByteArray()); - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidPrimaryKeyType", value.getType().toString())); - } - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue buildColumnValue(com.aliyun.openservices.ots.model.ColumnValue column) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(); - switch(column.getType()){ - case INTEGER: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - // optional int64 v_int = 2; - builder.setVInt(column.asLong()); - break; - case STRING: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - // optional string v_string = 3; - builder.setVString(column.asString()); - break; - case BOOLEAN: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BOOLEAN); - // optional bool v_bool = 4; - builder.setVBool(column.asBoolean()); - break; - case DOUBLE: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.DOUBLE); - // optional double v_double = 5; - builder.setVDouble(column.asDouble()); - break; - case BINARY: - // required ColumnType type = 1; - builder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY); - // optional double v_binary = 5; - builder.setVBinary(ByteString.copyFrom(column.asBinary())); - break; - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidColumnType", column.getType().toString())); - } - return builder.build(); - } - - public static com.aliyun.openservices.ots.model.ColumnValue toColumnValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - switch(value.getType()) { - case BOOLEAN: - if(!value.hasVBool()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_bool")); - } - return com.aliyun.openservices.ots.model.ColumnValue.fromBoolean(value.getVBool()); - case INTEGER: - if(!value.hasVInt()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_int")); - } - return com.aliyun.openservices.ots.model.ColumnValue.fromLong(value.getVInt()); - case STRING: - if(!value.hasVString()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_string")); - } - return com.aliyun.openservices.ots.model.ColumnValue.fromString(value.getVString()); - case DOUBLE: - if(!value.hasVDouble()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_double")); - } - return com.aliyun.openservices.ots.model.ColumnValue.fromDouble(value.getVDouble()); - case BINARY: - if(!value.hasVBinary()) { - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("ValueNotSet", "ColumnValue.v_binary")); - } - return com.aliyun.openservices.ots.model.ColumnValue.fromBinary(value.getVBinary().toByteArray()); - default: - throw new IllegalArgumentException(OTS_RESOURCE_MANAGER.getFormattedString("InvalidColumnType", value.getType().toString())); - } - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation toPBRowExistenceExpectation( - com.aliyun.openservices.ots.model.RowExistenceExpectation rowExistenceExpectation) { - switch(rowExistenceExpectation) { - case EXPECT_EXIST: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.EXPECT_EXIST; - case EXPECT_NOT_EXIST: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.EXPECT_NOT_EXIST; - case IGNORE: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.IGNORE; - default: - throw new IllegalArgumentException("Invalid row existence expectation: " + rowExistenceExpectation); - } - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType toPBColumnConditionType(ColumnConditionType cct) - { - switch (cct) { - case RELATIONAL_CONDITION: - return OtsProtocol2.ColumnConditionType.CCT_RELATION; - case COMPOSITE_CONDITION: - return OtsProtocol2.ColumnConditionType.CCT_COMPOSITE; - default: - throw new IllegalArgumentException("Invalid column condition type: " + cct); - } - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition buildColumnCondition(ColumnCondition cc) - { - OtsProtocol2.ColumnCondition.Builder builder = OtsProtocol2.ColumnCondition.newBuilder(); - builder.setType(toPBColumnConditionType(cc.getType())); - builder.setCondition(cc.serialize()); - - return builder.build(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition buildCondition(Condition cond) - { - OtsProtocol2.Condition.Builder builder = OtsProtocol2.Condition.newBuilder(); - builder.setRowExistence(toPBRowExistenceExpectation(cond.getRowExistenceExpectation())); - if (cond.getColumnCondition() != null) { - builder.setColumnCondition(buildColumnCondition(cond.getColumnCondition())); - } - - return builder.build(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column buildColumn(String name, PrimaryKeyValue value) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - // required string name = 1; - builder.setName(name); - // required ColumnValue value = 2; - builder.setValue(buildColumnValue(value)); - return builder.build(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column buildColumn(String name, com.aliyun.openservices.ots.model.ColumnValue value) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - // required string name = 1; - builder.setName(name); - // required ColumnValue value = 2; - builder.setValue(buildColumnValue(value)); - return builder.build(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema buildColumnSchema(String name, PrimaryKeyType type) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.newBuilder(); - // required string name = 1; - builder.setName(name); - // required ColumnType type = 2; - builder.setType(toPBColumnType(type)); - return builder.build(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta buildTableMeta( - TableMeta tableMeta) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.newBuilder(); - // required string table_name = 1; - builder.setTableName(tableMeta.getTableName()); - - // repeated ColumnSchema primary_keys = 2; - for (Entry entry : tableMeta.getPrimaryKey().entrySet()) { - builder.addPrimaryKey(buildColumnSchema(entry.getKey(), entry.getValue())); - } - - return builder.build(); - } - - public static OtsProtocol2.GetRowRequest buildGetRowRequest(SingleRowQueryCriteria criteria) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.newBuilder(); - // required string table_name = 1; - builder.setTableName(criteria.getTableName()); - - // repeated Column primary_keys = 2; - for (Entry entry : criteria.getRowPrimaryKey().getPrimaryKey().entrySet()) { - builder.addPrimaryKey(buildColumn(entry.getKey(), entry.getValue())); - } - - // repeated string columns_to_get = 3; - for (String name : criteria.getColumnsToGet()) { - builder.addColumnsToGet(name); - } - - // optional ColumnCondition filter = 4; - if (criteria.getFilter() != null) { - builder.setFilter(buildColumnCondition(criteria.getFilter())); - } - - return builder.build(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row buildRow( - Map primaryKey, - Map attributeColumns) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.newBuilder(); - - for (Entry entry : primaryKey.entrySet()) { - builder.addPrimaryKeyColumns(buildColumn(entry.getKey(), entry.getValue())); - } - - for (Entry entry : attributeColumns.entrySet()) { - builder.addAttributeColumns(buildColumn(entry.getKey(), entry.getValue())); - } - - return builder.build(); - } - - public static OtsProtocol2.CreateTableRequest buildCreateTableRequest(CreateTableRequest request) { - TableMeta tableMeta = request.getTableMeta(); - ReservedThroughput reservedThroughput = request.getReservedThroughput(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.newBuilder(); - - // required TableMeta table_meta = 1; - builder.setTableMeta(buildTableMeta(tableMeta)); - - builder.setReservedThroughput(buildReservedThroughput(reservedThroughput)); - - return builder.build(); - } - - private static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput buildReservedThroughput( - com.aliyun.openservices.ots.model.ReservedThroughput reservedThroughput) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder rtBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.newBuilder(); - - com.aliyun.openservices.ots.model.CapacityUnit capacityUnit = reservedThroughput.getCapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(); - - builder.setRead(capacityUnit.getReadCapacityUnit()); - builder.setWrite(capacityUnit.getWriteCapacityUnit()); - rtBuilder.setCapacityUnit(builder.build()); - return rtBuilder.build(); - } - - public static OtsProtocol2.DeleteTableRequest buildDeleteTableRequest(String tableName) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.newBuilder(); - - // required string table_name = 1; - builder.setTableName(tableName); - return builder.build(); - } - - public static OtsProtocol2.DeleteRowRequest buildDeleteRowRequest(RowDeleteChange rowChange) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.newBuilder(); - - // required string table_name = 1; - builder.setTableName(rowChange.getTableName()); - - // required Condition condition = 2; - builder.setCondition(buildCondition(rowChange.getCondition())); - - // repeated Column primary_keys = 3; - for (Entry entry : rowChange.getRowPrimaryKey().getPrimaryKey().entrySet()) { - builder.addPrimaryKey(buildColumn(entry.getKey(), entry.getValue())); - } - - return builder.build(); - } - - public static OtsProtocol2.PutRowRequest buildPutRowRequest(RowPutChange rowChange) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.newBuilder(); - - // required string table_name = 1; - builder.setTableName(rowChange.getTableName()); - - // required Condition condition = 2; - builder.setCondition(buildCondition(rowChange.getCondition())); - - // repeated Column primary_keys = 3; - for (Entry entry : rowChange.getRowPrimaryKey().getPrimaryKey().entrySet()) { - builder.addPrimaryKey(buildColumn(entry.getKey(), entry.getValue())); - } - - // repeated Column columns = 4; - for (Entry entry : rowChange.getAttributeColumns().entrySet()) { - builder.addAttributeColumns(buildColumn(entry.getKey(), entry.getValue())); - } - - return builder.build(); - } - - public static ReservedThroughputDetails parseCapacityUnitDetails(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails capacityUnitDetails) { - ReservedThroughputDetails details = new ReservedThroughputDetails(); - - com.aliyun.openservices.ots.model.CapacityUnit tableCU = new com.aliyun.openservices.ots.model.CapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit capacityUnit = capacityUnitDetails.getCapacityUnit(); - if (capacityUnit.hasRead()) { - tableCU.setReadCapacityUnit(capacityUnit.getRead()); - } - - if (capacityUnit.hasWrite()) { - tableCU.setWriteCapacityUnit(capacityUnit.getWrite()); - } - - details.setCapacityUnit(tableCU); - details.setLastIncreaseTime(capacityUnitDetails.getLastIncreaseTime()); - details.setNumberOfDecreasesToday(capacityUnitDetails.getNumberOfDecreasesToday()); - if (capacityUnitDetails.hasLastDecreaseTime()) { - details.setLastDecreaseTime(capacityUnitDetails.getLastDecreaseTime()); - } - return details; - } - - public static TableMeta parseTableMeta(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta meta) { - TableMeta tableMeta = new TableMeta(meta.getTableName()); - - for (com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema pk : meta.getPrimaryKeyList()) { - tableMeta.addPrimaryKeyColumn(pk.getName(), toPrimaryKeyType(pk.getType())); - } - - return tableMeta; - } - - public static Row parseRow(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row pbRow) { - Row row = new Row(); - for (com.aliyun.openservices.ots.protocol.OtsProtocol2.Column pk : pbRow.getPrimaryKeyColumnsList()) { - row.addColumn(pk.getName(), toColumnValue(pk.getValue())); - } - - for (com.aliyun.openservices.ots.protocol.OtsProtocol2.Column col : pbRow.getAttributeColumnsList()) { - row.addColumn(col.getName(), toColumnValue(col.getValue())); - } - return row; - } - - public static Row parseGetRowResponse(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse response) { - return parseRow(response.getRow()); - } - - public static OtsProtocol2.ListTableRequest buildListTableRequest() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.newBuilder(); - return builder.build(); - } - - public static OtsProtocol2.DescribeTableRequest buildDescribeTableRequest(String tableName) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.newBuilder(); - - // required string table_name = 1; - builder.setTableName(tableName); - - return builder.build(); - } - - public static OtsProtocol2.UpdateTableRequest buildUpdateTableRequest(UpdateTableRequest request) { - String tableName = request.getTableName(); - ReservedThroughputChange rtChange = request.getReservedThrougputChange(); - - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.newBuilder(); - - // required string table_name = 1; - builder.setTableName(tableName); - - // optional CapacityUnit capacity_unit = 2; - if (rtChange != null) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder rtBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.newBuilder(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder cuBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(); - - if (rtChange.isReadSet()) { - cuBuilder.setRead(rtChange.getReadCapacityUnit()); - } - - if (rtChange.isWriteSet()) { - cuBuilder.setWrite(rtChange.getWriteCapacityUnit()); - } - - rtBuilder.setCapacityUnit(cuBuilder.build()); - builder.setReservedThroughput(rtBuilder.build()); - } - - return builder.build(); - } - - public static OtsProtocol2.UpdateRowRequest buildUpdateRowRequest(RowUpdateChange rowChange) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.newBuilder(); - - // required string table_name = 1; - builder.setTableName(rowChange.getTableName()); - - // required Condition condition = 2; - builder.setCondition(buildCondition(rowChange.getCondition())); - - // repeated Column primary_keys = 3; - for (Entry entry : rowChange.getRowPrimaryKey().getPrimaryKey().entrySet()) { - builder.addPrimaryKey(buildColumn(entry.getKey(), entry.getValue())); - } - - // repeated ColumnUpdate columns = 4; - for (Entry entry : rowChange.getAttributeColumns().entrySet()) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder columnUpdateBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.newBuilder(); - columnUpdateBuilder.setName(entry.getKey()); - if (entry.getValue() != null) { - columnUpdateBuilder.setType(OperationType.PUT); - columnUpdateBuilder.setValue(buildColumnValue(entry.getValue())); - } else { - columnUpdateBuilder.setType(OperationType.DELETE); - } - builder.addAttributeColumns(columnUpdateBuilder.build()); - } - - return builder.build(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction toPBDirection(Direction direction) { - switch (direction) { - case BACKWARD: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.BACKWARD; - case FORWARD: - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.FORWARD; - default: - throw new IllegalArgumentException("Invalid direction type: " + direction); - } - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column buildRangeColumn(String name, PrimaryKeyValue value) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - builder.setName(name); - - if(value == PrimaryKeyValue.INF_MIN) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder valueBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(); - valueBuilder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN); - builder.setValue(valueBuilder.build()); - } else if(value == PrimaryKeyValue.INF_MAX) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder valueBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(); - valueBuilder.setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MAX); - builder.setValue(valueBuilder.build()); - } else { - builder.setValue(buildColumnValue(value)); - } - - return builder.build(); - } - - public static OtsProtocol2.GetRangeRequest buildGetRangeRequest(RangeRowQueryCriteria criteria) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.newBuilder(); - - //required string table_name = 1; - builder.setTableName(criteria.getTableName()); - - //required Direction direction = 2; - builder.setDirection(toPBDirection(criteria.getDirection())); - - //repeated string columns_to_get = 3; - for (String column : criteria.getColumnsToGet()) { - builder.addColumnsToGet(column); - } - - //optional uint32 limit = 4; - if (criteria.getLimit() >= 0) { - builder.setLimit(criteria.getLimit()); - } - - //repeated Column inclusive_start_primary_keys = 5; - for (Entry column : criteria.getInclusiveStartPrimaryKey().getPrimaryKey().entrySet()) { - builder.addInclusiveStartPrimaryKey(buildRangeColumn(column.getKey(), column.getValue())); - } - - //repeated Column exclusive_end_primary_keys = 6; - for (Entry column : criteria.getExclusiveEndPrimaryKey().getPrimaryKey().entrySet()) { - builder.addExclusiveEndPrimaryKey(buildRangeColumn(column.getKey(), column.getValue())); - } - - //optional ColumnCondition filter = 7; - if (criteria.getFilter() != null) { - builder.setFilter(buildColumnCondition(criteria.getFilter())); - } - return builder.build(); - } - - public static OtsProtocol2.BatchGetRowRequest buildBatchGetRowRequest( - Map criteriasGroupByTable) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.newBuilder(); - - for (Entry entry : criteriasGroupByTable.entrySet()) { - String tableName = entry.getKey(); - MultiRowQueryCriteria criteria = entry.getValue(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder tableBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.newBuilder(); - tableBuilder.setTableName(tableName); - for (RowPrimaryKey primaryKey : criteria.getRowKeys()) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder rowBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.newBuilder(); - for (Entry key : primaryKey.getPrimaryKey().entrySet()) { - rowBuilder.addPrimaryKey(buildColumn(key.getKey(), key.getValue())); - } - - tableBuilder.addRows(rowBuilder.build()); - } - - for (String column : criteria.getColumnsToGet()) { - tableBuilder.addColumnsToGet(column); - } - - if (criteria.getFilter() != null) { - tableBuilder.setFilter(buildColumnCondition(criteria.getFilter())); - } - builder.addTables(tableBuilder.build()); - } - - return builder.build(); - } - - public static OtsProtocol2.BatchWriteRowRequest buildBatchWriteRowRequest(BatchWriteRowRequest request) { - Map> rowPutChangesGroupByTable = request.getRowPutChange(); - Map> rowUpdateChangesGroupByTable = request.getRowUpdateChange(); - Map> rowDeleteChangesGroupByTable = request.getRowDeleteChange(); - - Set allTables = new HashSet(); - allTables.addAll(rowPutChangesGroupByTable.keySet()); - allTables.addAll(rowUpdateChangesGroupByTable.keySet()); - allTables.addAll(rowDeleteChangesGroupByTable.keySet()); - - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.Builder builder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.newBuilder(); - - for (String tableName : allTables) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder tableBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.newBuilder(); - - tableBuilder.setTableName(tableName); - - List rowPutChanges = rowPutChangesGroupByTable.get(tableName); - if (rowPutChanges != null) { - for (RowPutChange rowPutChange : rowPutChanges) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder putRowBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.newBuilder(); - - putRowBuilder.setCondition(buildCondition(rowPutChange.getCondition())); - - for (Entry primaryKey : rowPutChange.getRowPrimaryKey().getPrimaryKey().entrySet()) { - putRowBuilder.addPrimaryKey(buildColumn(primaryKey.getKey(), primaryKey.getValue())); - } - - for (Entry column : rowPutChange.getAttributeColumns().entrySet()) { - putRowBuilder.addAttributeColumns(buildColumn(column.getKey(), column.getValue())); - } - - tableBuilder.addPutRows(putRowBuilder.build()); - } - } - - List rowUpdateChanges = rowUpdateChangesGroupByTable.get(tableName); - if (rowUpdateChanges != null) { - for (RowUpdateChange rowUpdateChange : rowUpdateChanges) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder updateRowBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.newBuilder(); - - updateRowBuilder.setCondition(buildCondition(rowUpdateChange.getCondition())); - - for (Entry primaryKey : rowUpdateChange.getRowPrimaryKey().getPrimaryKey().entrySet()) { - updateRowBuilder.addPrimaryKey(buildColumn(primaryKey.getKey(), primaryKey.getValue())); - } - - for (Entry column : rowUpdateChange.getAttributeColumns().entrySet()) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder columnUpdateBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.newBuilder(); - columnUpdateBuilder.setName(column.getKey()); - if (column.getValue() != null) { - columnUpdateBuilder.setType(OperationType.PUT); - columnUpdateBuilder.setValue(buildColumnValue(column.getValue())); - } else { - columnUpdateBuilder.setType(OperationType.DELETE); - } - updateRowBuilder.addAttributeColumns(columnUpdateBuilder.build()); - } - - tableBuilder.addUpdateRows(updateRowBuilder.build()); - } - } - - List rowDeleteChanges = rowDeleteChangesGroupByTable.get(tableName); - if (rowDeleteChanges != null) { - for (RowDeleteChange rowDeleteChange : rowDeleteChanges) { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder deleteRowBuilder = - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.newBuilder(); - - deleteRowBuilder.setCondition(buildCondition(rowDeleteChange.getCondition())); - - for (Entry primaryKey : rowDeleteChange.getRowPrimaryKey().getPrimaryKey().entrySet()) { - deleteRowBuilder.addPrimaryKey(buildColumn(primaryKey.getKey(), primaryKey.getValue())); - } - - tableBuilder.addDeleteRows(deleteRowBuilder.build()); - } - } - - builder.addTables(tableBuilder.build()); - } - - return builder.build(); - } - - public static com.aliyun.openservices.ots.model.ConsumedCapacity parseConsumedCapacity(ConsumedCapacity consumed) { - com.aliyun.openservices.ots.model.ConsumedCapacity cc = new com.aliyun.openservices.ots.model.ConsumedCapacity(); - com.aliyun.openservices.ots.model.CapacityUnit cu = new com.aliyun.openservices.ots.model.CapacityUnit(); - CapacityUnit capacityUnit = consumed.getCapacityUnit(); - if (capacityUnit.hasRead()) { - cu.setReadCapacityUnit(capacityUnit.getRead()); - } - - if (capacityUnit.hasWrite()) { - cu.setWriteCapacityUnit(capacityUnit.getWrite()); - } - - cc.setCapacityUnit(cu); - - return cc; - } - - public static com.aliyun.openservices.ots.model.BatchGetRowResult.RowStatus parseBatchGetRowStatus(String tableName, RowInBatchGetRowResponse status, int index) { - if (status.getIsOk()) { - Row row = parseRow(status.getRow()); - com.aliyun.openservices.ots.model.ConsumedCapacity cc = parseConsumedCapacity(status.getConsumed()); - return new com.aliyun.openservices.ots.model.BatchGetRowResult.RowStatus(tableName, row, cc, index); - } else { - Error error = new Error(status.getError().getCode(), status.getError().getMessage()); - return new com.aliyun.openservices.ots.model.BatchGetRowResult.RowStatus(tableName, error, index); - } - } - - public static com.aliyun.openservices.ots.model.BatchWriteRowResult.RowStatus parseBatchWriteRowStatus(String tableName, RowInBatchWriteRowResponse status, int index) { - if (status.getIsOk()) { - com.aliyun.openservices.ots.model.ConsumedCapacity cc = parseConsumedCapacity(status.getConsumed()); - return new com.aliyun.openservices.ots.model.BatchWriteRowResult.RowStatus(tableName, cc, index); - } else { - Error error = new Error(status.getError().getCode(), status.getError().getMessage()); - return new com.aliyun.openservices.ots.model.BatchWriteRowResult.RowStatus(tableName, error, index); - } - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/OTSResult.java b/src/main/java/com/aliyun/openservices/ots/model/OTSResult.java deleted file mode 100755 index c45d7b8..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/OTSResult.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class OTSResult { - private String requestID; - private String traceId; - - public OTSResult() { - - } - - public OTSResult(OTSResult meta) { - this.requestID = meta.requestID; - } - - public OTSResult(String requestID) { - this.requestID = requestID; - } - - public String getRequestID() { - return requestID; - } - - public void setRequestID(String requestID) { - this.requestID = requestID; - } - - public String getTraceId() { - return traceId; - } - - public void setTraceId(String traceId) { - this.traceId = traceId; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/OTSResultFactory.java b/src/main/java/com/aliyun/openservices/ots/model/OTSResultFactory.java deleted file mode 100755 index 185bc4a..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/OTSResultFactory.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.internal.model.ResponseContentWithMeta; -import com.aliyun.openservices.ots.protocol.OtsProtocol2; -import com.aliyun.openservices.ots.protocol.OtsProtocol2.*; - -import java.util.ArrayList; -import java.util.List; - -public class OTSResultFactory { - - public static CreateTableResult createCreateTableResult(ResponseContentWithMeta response, CreateTableResponse createTableResponse) { - CreateTableResult result = new CreateTableResult(response.getMeta()); - return result; - } - - public static ListTableResult createListTableResult( - ResponseContentWithMeta response, - ListTableResponse listTableResponse) { - ListTableResult result = new ListTableResult(response.getMeta()); - result.setTableNames(listTableResponse.getTableNamesList()); - return result; - } - - public static DescribeTableResult createDescribeTableResult( - ResponseContentWithMeta response, - DescribeTableResponse describeTableResponse) { - DescribeTableResult result = new DescribeTableResult(response.getMeta()); - result.setTableMeta(OTSProtocolHelper.parseTableMeta(describeTableResponse.getTableMeta())); - result.setReservedThroughputDetails(OTSProtocolHelper.parseCapacityUnitDetails(describeTableResponse.getReservedThroughputDetails())); - return result; - } - - public static DeleteTableResult createDeleteTableResult( - ResponseContentWithMeta response, - DeleteTableResponse deleteTableResponse) { - DeleteTableResult result = new DeleteTableResult(response.getMeta()); - return result; - } - - public static UpdateTableResult createUpdateTableResult( - ResponseContentWithMeta response, - UpdateTableResponse updateTableResponse) { - UpdateTableResult result = new UpdateTableResult(response.getMeta()); - ReservedThroughputDetails capacityUnitDetails = new ReservedThroughputDetails(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails details = updateTableResponse.getReservedThroughputDetails(); - capacityUnitDetails.setLastIncreaseTime(details.getLastIncreaseTime()); - if (details.hasLastDecreaseTime()) { - capacityUnitDetails.setLastDecreaseTime(details.getLastDecreaseTime()); - } - capacityUnitDetails.setNumberOfDecreasesToday(details.getNumberOfDecreasesToday()); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit cu = details.getCapacityUnit(); - CapacityUnit capacityUnit = new CapacityUnit(); - if (cu.hasRead()) { - capacityUnit.setReadCapacityUnit(cu.getRead()); - } - if(cu.hasWrite()) { - capacityUnit.setWriteCapacityUnit(cu.getWrite()); - } - capacityUnitDetails.setCapacityUnit(capacityUnit); - - result.setReservedThroughputDetails(capacityUnitDetails); - - return result; - } - - public static GetRowResult createGetRowResult( - ResponseContentWithMeta response, GetRowResponse getRowResponse) { - GetRowResult result = new GetRowResult(response.getMeta()); - result.setRow(OTSProtocolHelper.parseRow(getRowResponse.getRow())); - result.setConsumedCapacity(OTSProtocolHelper.parseConsumedCapacity(getRowResponse.getConsumed())); - return result; - } - - public static PutRowResult createPutRowResult( - ResponseContentWithMeta response, PutRowResponse putRowResponse) { - PutRowResult result = new PutRowResult(response.getMeta()); - result.setConsumedCapacity(OTSProtocolHelper.parseConsumedCapacity(putRowResponse.getConsumed())); - return result; - } - - public static UpdateRowResult createUpdateRowResult( - ResponseContentWithMeta response, UpdateRowResponse updateRowResponse) { - UpdateRowResult result = new UpdateRowResult(response.getMeta()); - result.setConsumedCapacity(OTSProtocolHelper.parseConsumedCapacity(updateRowResponse.getConsumed())); - return result; - } - - public static DeleteRowResult createDeleteRowResult( - ResponseContentWithMeta response, DeleteRowResponse deleteRowResponse) { - DeleteRowResult result = new DeleteRowResult(response.getMeta()); - result.setConsumedCapacity(OTSProtocolHelper.parseConsumedCapacity(deleteRowResponse.getConsumed())); - return result; - } - - public static GetRangeResult createGetRangeResult( - ResponseContentWithMeta response, GetRangeResponse getRangeResponse) { - GetRangeResult result = new GetRangeResult(response.getMeta()); - result.setConsumedCapacity(OTSProtocolHelper.parseConsumedCapacity(getRangeResponse.getConsumed())); - - if (getRangeResponse.getNextStartPrimaryKeyCount() == 0) { - // has no next primary key - result.setNextStartPrimaryKey(null); - } else { - RowPrimaryKey nextStart = new RowPrimaryKey(); - result.setNextStartPrimaryKey(nextStart); - for (com.aliyun.openservices.ots.protocol.OtsProtocol2.Column pbColumn : getRangeResponse.getNextStartPrimaryKeyList()) { - nextStart.addPrimaryKeyColumn(pbColumn.getName(), OTSProtocolHelper.toPrimaryKeyValue(pbColumn.getValue())); - } - } - - List rows = new ArrayList(); - for (com.aliyun.openservices.ots.protocol.OtsProtocol2.Row row : getRangeResponse.getRowsList()) { - rows.add(OTSProtocolHelper.parseRow(row)); - } - result.setRows(rows); - - return result; - } - - public static BatchGetRowResult createBatchGetRowResult( - ResponseContentWithMeta response, - BatchGetRowResponse batchGetRowResponse) { - BatchGetRowResult result = new BatchGetRowResult(response.getMeta()); - - for (TableInBatchGetRowResponse table : batchGetRowResponse.getTablesList()) { - String tableName = table.getTableName(); - List rowList = table.getRowsList(); - for (int i = 0; i < rowList.size(); i++) { - result.addResult(OTSProtocolHelper.parseBatchGetRowStatus(tableName, rowList.get(i), i)); - } - } - return result; - } - - public static BatchWriteRowResult createBatchWriteRowResult( - ResponseContentWithMeta response, - BatchWriteRowResponse batchWriteRowResponse) { - BatchWriteRowResult result = new BatchWriteRowResult(response.getMeta()); - - for (TableInBatchWriteRowResponse table : batchWriteRowResponse.getTablesList()) { - String tableName = table.getTableName(); - - List statuses = table.getPutRowsList(); - for (int i = 0; i < statuses.size(); i++) { - result.addPutRowResult(OTSProtocolHelper.parseBatchWriteRowStatus(tableName, statuses.get(i), i)); - } - - statuses = table.getUpdateRowsList(); - for (int i = 0; i < statuses.size(); i++) { - result.addUpdateRowResult(OTSProtocolHelper.parseBatchWriteRowStatus(tableName, statuses.get(i), i)); - } - - statuses = table.getDeleteRowsList(); - for (int i = 0; i < statuses.size(); i++) { - result.addDeleteRowResult(OTSProtocolHelper.parseBatchWriteRowStatus(tableName, statuses.get(i), i)); - } - } - - return result; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyType.java b/src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyType.java deleted file mode 100755 index 829a764..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyType.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.HashMap; -import java.util.Map; - -/** - * 表示主键(PrimaryKey)的数据类型。 - * - */ -public enum PrimaryKeyType { - /** - * 字符串型。 - */ - STRING, - - /** - * 64位整型。 - */ - INTEGER, - - /** - * 字节数组。 - */ - BINARY; - - private static final Map strToEnum = - new HashMap(); - static { // Initialize the map - for(PrimaryKeyType t : values()){ - strToEnum.put(t.toString(), t); - } - } - - // Package-private only. - static PrimaryKeyType fromString(String value){ - if (value == null){ - throw new NullPointerException(); - } - return strToEnum.get(value); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyValue.java b/src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyValue.java deleted file mode 100755 index b8e96f9..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/PrimaryKeyValue.java +++ /dev/null @@ -1,249 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.utils.Bytes; -import com.aliyun.openservices.ots.utils.CalculateHelper; - -import java.util.Arrays; - -import static com.aliyun.openservices.ots.utils.CodingUtils.*; -import static com.aliyun.openservices.ots.internal.OTSUtil.OTS_RESOURCE_MANAGER; - -/** - * 表示主键(PrimaryKey)列的值。 - * - */ -public class PrimaryKeyValue implements Comparable { - - /** - * 表示主键值范围的最大值。 - */ - public static final PrimaryKeyValue INF_MAX = new PrimaryKeyValue("INF_MAX", null); - /** - * 表示主键值范围的最小值。 - */ - public static final PrimaryKeyValue INF_MIN = new PrimaryKeyValue("INF_MIN", null); - - private Object value; - private PrimaryKeyType type; - private int dataSize = 0; - - /** - * 构造函数。 - * 对用户隐藏该构造函数,以防止用户提供错误的值。比如类型指定为INTEGER,但值并非合法的表示整数的字符串。 - * @param value - * 主键值。 - * @param type - * 值的数据类型。 - */ - PrimaryKeyValue(Object value, PrimaryKeyType type){ - this.value = value; - this.type = type; - - if (this.type != null) { - switch (this.type) { - case INTEGER: - this.dataSize = 8; - break; - case STRING: - this.dataSize = CalculateHelper.getStringDataSize(this.asString()); - break; - case BINARY: - this.dataSize = this.asBinary().length; - break; - default: - throw new IllegalStateException("Bug: not support the type : " + type); - } - } - } - - /** - * 获取值的数据类型。 - * @return 值的数据类型。 - */ - public PrimaryKeyType getType() { - return type; - } - - /** - * 获取主键列值的大小,各类型大小计算公式为: - * - {@link PrimaryKeyType#INTEGER}: 恒定大小为8个字节 - * - {@link PrimaryKeyType#STRING}: 大小为按UTF-8编码后的字节数 - * - * @return 值的大小 - */ - public int getSize() { - return this.dataSize; - } - - /** - * 使用String对象构造值的数据类型为{@link PrimaryKeyType#STRING}的 - * {@link PrimaryKeyValue}对象。 - * @param value - * String对象。 - */ - public static PrimaryKeyValue fromString(String value){ - assertParameterNotNull(value, "value"); - - return new PrimaryKeyValue(value, PrimaryKeyType.STRING); - } - - /** - * 使用int值构造值的数据类型为{@link PrimaryKeyType#INTEGER}的 - * {@link PrimaryKeyValue}对象。 - * @param value - * int值。 - */ - public static PrimaryKeyValue fromLong(long value){ - return new PrimaryKeyValue(value, PrimaryKeyType.INTEGER); - } - - public String asString() { - if (this.type != PrimaryKeyType.STRING){ - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "STRING")); - } - - return (String)value; - } - - /** - * 转换为长整型。 - * 当且仅当数据类型为{@link PrimaryKeyType#INTEGER}时转换能够成功。 - * @return long 长整数值。 - */ - public long asLong() { - if (this.type != PrimaryKeyType.INTEGER){ - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "INTEGER")); - } - - return (Long)value; - } - - public static PrimaryKeyValue fromBinary(byte[] value) { - return new PrimaryKeyValue(value, PrimaryKeyType.BINARY); - } - - public byte[] asBinary() { - if (this.type != PrimaryKeyType.BINARY) { - throw new IllegalStateException( - OTS_RESOURCE_MANAGER.getFormattedString("DateTypeIsNot", "BINARY")); - } - return (byte[])value; - } - - public boolean isInfMin() { - return type == null && value.equals("INF_MIN"); - } - - public boolean isInfMax() { - return type == null && value.equals("INF_MAX"); - } - - public static PrimaryKeyValue fromColumn(ColumnValue value) { - switch (value.getType()) { - case STRING: - return fromString(value.asString()); - case INTEGER: - return fromLong(value.asLong()); - case BINARY: - return fromBinary(value.asBinary()); - default: - throw new IllegalArgumentException("Can not convert from column with not compatible type: " + value.getType()); - } - } - - @Override - public int hashCode() { - if (this.type == PrimaryKeyType.BINARY) { - return Arrays.hashCode(asBinary()) * 31 + this.type.hashCode(); - } else { - return this.value.hashCode() * 31 + this.type.hashCode(); - } - } - - @Override - public boolean equals(Object o) { - if (o == null || !(o instanceof PrimaryKeyValue)) { - return false; - } - - PrimaryKeyValue val = (PrimaryKeyValue)o; - if (isInfMin()) { - return val.isInfMin(); - } - - if (isInfMax()) { - return val.isInfMax(); - } - - if (this.type == val.type) { - if (this.type == PrimaryKeyType.BINARY) { - return Bytes.equals((byte[]) value, (byte[]) val.value); - } else { - return this.value.equals(val.value); - } - } else { - return false; - } - } - - @Override - public String toString() { - if (this.type == PrimaryKeyType.BINARY) { - return Arrays.toString(asBinary()) + ":" + this.type; - } else { - return this.value.toString() + ":" + this.type; - } - } - - /** - * 比较两个主键列的值的大小。 - *

注意:不同类型的主键列无法比较。

- *

{@link #INF_MIN}和{@link #INF_MAX}可以与其他类型的主键列进行比较, - * 并且{@link #INF_MIN}比任何类型的主键列值小,{@link #INF_MAX}比任何类型的主键列值大。

- * - * @param target - * @return 如果大于返回值大于0,等于返回0,小于返回值小于0 - */ - @Override - public int compareTo(PrimaryKeyValue target) { - if (this.type == null) { // INF_MIN or INF_MAX - if (target.type == null && target.value.equals(this.value)) { - return 0; - } - - if (this.value.equals("INF_MIN")) { - return -1; - } else { - return 1; - } - } else { - if (target.type == null) { - if (target.value.equals("INF_MIN")) { - return 1; - } else { - return -1; - } - } - - if (this.type != target.type) { - throw new IllegalArgumentException("The type of primary key to compare must be the same."); - } - - switch (this.type) { - case STRING: - return ((String) value).compareTo(target.asString()); - case INTEGER: - return ((Long) value).compareTo(target.asLong()); - case BINARY: - byte[] b1 = (byte[]) this.value; - byte[] b2 = (byte[]) target.value; - int ret = Bytes.compareByteArrayInLexOrder(b1, 0, b1.length, b2, 0, b2.length); - return ret; - default: - throw new IllegalArgumentException("Unknown type: " + this.type); - } - } - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/PutRowResult.java b/src/main/java/com/aliyun/openservices/ots/model/PutRowResult.java deleted file mode 100755 index 926e771..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/PutRowResult.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class PutRowResult extends OTSResult { - /** - * 此次操作消耗的CapacityUnit。 - */ - private ConsumedCapacity consumedCapacity; - - public PutRowResult(OTSResult meta) { - super(meta); - } - - /** - * 获取此次操作消耗的CapacityUnit。 - * @return 此次操作消耗的CapacityUnit。 - */ - public ConsumedCapacity getConsumedCapacity() { - return consumedCapacity; - } - - void setConsumedCapacity(ConsumedCapacity consumedCapacity) { - this.consumedCapacity = consumedCapacity; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RecordColumn.java b/src/main/java/com/aliyun/openservices/ots/model/RecordColumn.java deleted file mode 100644 index 5254fa7..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RecordColumn.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.aliyun.openservices.ots.model; - - -public class RecordColumn { - - public enum ColumnType { - /** - * PUT类型 - * 表示写入该列 - */ - PUT, - - /** - * DELETE类型 - * 表示删除该列 - */ - DELETE - } - - /** - * 列名 - */ - private String name; - - /** - * 列值 - */ - private ColumnValue value; - - /** - * 列的类型 - */ - private ColumnType type; - - public RecordColumn(String name, ColumnValue value, ColumnType type) { - setName(name); - setValue(value); - setType(type); - } - - /** - * 获取列名 - * @return 列名 - */ - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - /** - * 获取列值 - * @return 列值,当该列类型为DELETE时,返回null - */ - public ColumnValue getValue() { - return value; - } - - public void setValue(ColumnValue value) { - this.value = value; - } - - /** - * 获取列的类型 - * @return 列的类型 - */ - public ColumnType getType() { - return type; - } - - public void setType(ColumnType type) { - this.type = type; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("Name:"); - sb.append(getName()); - sb.append(",Value:"); - sb.append(getValue()); - sb.append(",ColumnType:"); - sb.append(getType()); - return sb.toString(); - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughput.java b/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughput.java deleted file mode 100755 index 1c43544..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughput.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class ReservedThroughput { - - /** - * 表的预留吞吐量。 - */ - private CapacityUnit capacityUnit; - - public ReservedThroughput() { - - } - - public ReservedThroughput(CapacityUnit capacityUnit) { - this.capacityUnit = capacityUnit; - } - - /** - * 获取表的预留吞吐量的值。 - * @return CapacityUnit。 - */ - public CapacityUnit getCapacityUnit() { - return capacityUnit; - } - - /** - * 设置表的预留吞吐量的值。 - * @param capacityUnit capacityUnit。 - */ - public void setCapacityUnit(CapacityUnit capacityUnit) { - this.capacityUnit = capacityUnit; - } - -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughputChange.java b/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughputChange.java deleted file mode 100755 index c017880..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/ReservedThroughputChange.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class ReservedThroughputChange { - /** - * 新的CapacityUnit设置。 - */ - private CapacityUnit capacityUnit; - - /** - * 标示用户是否更改了读CapacityUnit。 - */ - private boolean isReadSet; - - /** - * 标示用户是否更改了写CapacityUnit。 - */ - private boolean isWriteSet; - - public ReservedThroughputChange() { - this.isReadSet = false; - this.isWriteSet = false; - capacityUnit = new CapacityUnit(); - } - - /** - * 设置读CapacityUnit。 - * @param value 读CapacityUnit。 - */ - public void setReadCapacityUnit(int value) { - isReadSet = true; - capacityUnit.setReadCapacityUnit(value); - } - - /** - * 设置写CapacityUnit。 - * @param value 写CapacityUnit。 - */ - public void setWriteCapacityUnit(int value) { - isWriteSet = true; - capacityUnit.setWriteCapacityUnit(value); - } - - /** - * 查看是否设置过读CapacityUnit。 - * @return 是否设置过读CapacityUnit。 - */ - public boolean isReadSet() { - return isReadSet; - } - - /** - * 查看是否设置过写CapacityUnit。 - * @return 是否设置过写CapacityUnit。 - */ - public boolean isWriteSet() { - return isWriteSet; - } - - /** - * 获取设置的读CapacityUnit。 - * @return 若设置了值,则返回设置的值,否则返回0。 - */ - public int getReadCapacityUnit() { - if (isReadSet) { - return capacityUnit.getReadCapacityUnit(); - } - return 0; - } - - /** - * 获取设置的写CapacityUnit。 - * @return 若设置了值,则返回设置的值,否则返回0。 - */ - public int getWriteCapacityUnit() { - if (isWriteSet) { - return capacityUnit.getWriteCapacityUnit(); - } - return 0; - } - - /** - * 清除设置的读CapacityUnit。 - */ - public void clearReadCapacityUnit() { - isReadSet = false; - } - - /** - * 清除设置的写CapacityUnit。 - */ - public void clearWriteCapacityUnit() { - isWriteSet = false; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/Row.java b/src/main/java/com/aliyun/openservices/ots/model/Row.java deleted file mode 100755 index f42eb9c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/Row.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; - -import java.util.*; - -/** - * 表示查询时返回的数据行。 - *

- * {@link Row#getColumns()}包含了查询时指定的返回列,可能有主键列也可能有属性列。 - * 如果查询时没有指定返回列,则包含有整行所有列的数据。 - *

- */ -public class Row { - - private SortedMap columns = - new TreeMap(); // 行中的列 - - /** - * 获取列(Column)名称与值的只读对应字典。 - * @return 列(Column)名称与值的只读对应字典。 - * @throws ClientException 解码列值失败。 - */ - public Map getColumns() throws ClientException { - return Collections.unmodifiableMap(columns); - } - - /** - * 获取列(Column)名称与值的只读对应字典,字典中的列按名称进行排序。 - * - * @return 列(Column)名称与值的只读对应字典。 - * @throws ClientException 解码列值失败。 - */ - public SortedMap getSortedColumns() throws ClientException { - return Collections.unmodifiableSortedMap(columns); - } - - /** - * internal use - */ - public Row(){ - } - - /** - * internal use - */ - public void addColumn(String name, ColumnValue value) { - columns.put(name, value); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append('['); - boolean first = true; - for (Map.Entry entry : columns.entrySet()) { - if (first) { - first = false; - } else { - sb.append(", "); - } - sb.append(entry.getKey()).append(':').append(entry.getValue().toString()); - } - sb.append(']'); - return sb.toString(); - } -} \ No newline at end of file diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowChange.java b/src/main/java/com/aliyun/openservices/ots/model/RowChange.java deleted file mode 100755 index 6a705d1..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RowChange.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.utils.CodingUtils; - - -/** - * 表示行的数据变更信息。 - * - */ -public abstract class RowChange { - /** - * 表的名称。 - */ - private String tableName; - - /** - * 表的主键集合。 - */ - protected RowPrimaryKey primaryKey = new RowPrimaryKey(); - - /** - * 判断条件。 - */ - private Condition condition; - - /** - * 构造函数。 - */ - protected RowChange(String tableName){ - setTableName(tableName); - condition = new Condition(); - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public String getTableName() { - return tableName; - } - - /** - * 获取主键(Primary Key)列名称与值的对应只读字典。 - * @return 主键(Primary Key)列名称与值的对应只读字典。 - */ - public RowPrimaryKey getRowPrimaryKey() { - return primaryKey; - } - - /** - * 添加主键(Primary Key)列的名称和值。 - * @param primaryKey 行的主键。 - */ - public void setPrimaryKey(RowPrimaryKey primaryKey){ - CodingUtils.assertParameterNotNull(primaryKey, "primaryKey"); - - this.primaryKey = primaryKey; - } - - /** - * 获取判断条件。 - * @return 判断条件。 - */ - public Condition getCondition() { - return condition; - } - - /** - * 设置判断条件。 - * @param condition 判断条件。 - */ - public void setCondition(Condition condition) { - this.condition = condition; - } - - /** - * 获取一行的数据大小。 - * - * RowPutChange: 一行的数据大小包括所有主键列的名称和值的大小,以及所有属性列名称和值的大小总和。 - * RowUpdateChange: 一行的数据大小包括所有主键列的名称和值的大小,以及所有需要被更改的属性列的名称和值的大小,以及所有需要被删除的属性列的名称大小总和。 - * RowDeleteChange: 一行的数据大小只包括所有主键列的名称和值的大小总和。 - * - * @return int 数据大小 - */ - public abstract int getDataSize(); -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowDeleteChange.java b/src/main/java/com/aliyun/openservices/ots/model/RowDeleteChange.java deleted file mode 100755 index 2ad066e..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RowDeleteChange.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.aliyun.openservices.ots.model; - -/** - * 表示数据行的删除信息。 - * - */ -public class RowDeleteChange extends RowChange{ - @Override - public int getDataSize() { - return primaryKey.getSize(); - } - - /** - * 构造一个新的{@link RowDeleteChange}实例。 - * @param tableName 表的名称 - */ - public RowDeleteChange(String tableName) { - super(tableName); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowExistenceExpectation.java b/src/main/java/com/aliyun/openservices/ots/model/RowExistenceExpectation.java deleted file mode 100755 index 362af96..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RowExistenceExpectation.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public enum RowExistenceExpectation { - /** - * 不对行是否存在做任何判断。 - */ - IGNORE("IGNORE"), - - /** - * 期望该行存在。 - */ - EXPECT_EXIST("EXPECT_EXIST"), - - /** - * 期望该行不存在。 - */ - EXPECT_NOT_EXIST("EXPECT_NOT_EXIST"); - - private String name; - - private RowExistenceExpectation(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowPrimaryKey.java b/src/main/java/com/aliyun/openservices/ots/model/RowPrimaryKey.java deleted file mode 100755 index 0a6452d..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RowPrimaryKey.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.utils.CalculateHelper; - -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -public class RowPrimaryKey { - private Map primaryKey = new HashMap(); - - private int dataSize = -1; - - public RowPrimaryKey(){ - } - - /** - * 获取主键(Primary Key)列名称与值的对应字典(只读)。 - * @return 主键(Primary Key)列名称与值的对应字典(只读)。 - */ - public Map getPrimaryKey() { - return Collections.unmodifiableMap(primaryKey); - } - - /** - * 添加主键(Primary Key)列的名称和值。 - * @param name 主键列的名称。 - * @param value 主键列的值。 - * @return this for chain invocation - */ - public RowPrimaryKey addPrimaryKeyColumn(String name, PrimaryKeyValue value) { - assertParameterNotNull(name, "name"); - assertParameterNotNull(value, "value"); - - this.primaryKey.put(name, value); - this.dataSize = -1; // value changed, reset size - return this; - } - - /** - * 获取行主键的数据大小总和,大小总和包括所有主键列的名称和值。 - * - * @return 行主键的数据大小总和 - */ - public int getSize() { - if (dataSize == -1) { - dataSize = 0; - for (Map.Entry entry : primaryKey.entrySet()) { - this.dataSize += CalculateHelper.getStringDataSize(entry.getKey()); - this.dataSize += entry.getValue().getSize(); - } - } - return dataSize; - } - - @Override - public boolean equals(Object o) { - if (o == null || !(o instanceof RowPrimaryKey)) { - return false; - } - - RowPrimaryKey pk = (RowPrimaryKey) o; - if (this.primaryKey.size() != pk.primaryKey.size()) { - return false; - } - - for (Map.Entry entry : primaryKey.entrySet()) { - PrimaryKeyValue value = pk.primaryKey.get(entry.getKey()); - if (value == null) { - return false; - } - if (!value.equals(entry.getValue())) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - int result = 1; - - for (Map.Entry entry : primaryKey.entrySet()) { - result = 31 * result + entry.getKey().hashCode(); - result = 31 * result + entry.getValue().hashCode(); - } - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - boolean first = true; - for (Map.Entry pk : this.primaryKey.entrySet()) { - if (first) { - first = false; - } else { - sb.append(", "); - } - sb.append(pk.getKey()); - sb.append(":"); - sb.append(pk.getValue()); - } - return sb.toString(); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowPutChange.java b/src/main/java/com/aliyun/openservices/ots/model/RowPutChange.java deleted file mode 100755 index 9f20e3a..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RowPutChange.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.utils.CalculateHelper; -import com.aliyun.openservices.ots.utils.CodingUtils; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - - -/** - * 表示行的插入或更新信息。 - * - */ -public class RowPutChange extends RowChange{ - /** - * 行的属性列集合。 - */ - private Map attributeColumns = - new HashMap(); - - private int valueTotalSize = -1; - /** - * 构造一个新的{@link RowPutChange}实例。 - * @param tableName 表的名称 - */ - public RowPutChange(String tableName){ - super(tableName); - } - - @Override - public int getDataSize() { - if (valueTotalSize == -1) { - valueTotalSize = 0; - for (Map.Entry entry : attributeColumns.entrySet()) { - valueTotalSize += CalculateHelper.getStringDataSize(entry.getKey()); - valueTotalSize += entry.getValue().getSize(); - } - } - return primaryKey.getSize() + valueTotalSize; - } - - /** - * 返回属性列的名称与值的对应字典(只读)。 - * @return 名称与值的对应字典(只读)。 - */ - public Map getAttributeColumns(){ - return Collections.unmodifiableMap(attributeColumns); - } - - /** - * 添加属性列的名称和值。 - * @param name 属性列的列名。 - * @param value 属性列的值。 - * @return this for chain invocation - */ - public RowPutChange addAttributeColumn(String name, ColumnValue value){ - CodingUtils.assertParameterNotNull(name, "name"); - CodingUtils.assertParameterNotNull(value, "value"); - this.attributeColumns.put(name, value); - this.valueTotalSize = -1; // value changed, reset size - return this; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowQueryCriteria.java b/src/main/java/com/aliyun/openservices/ots/model/RowQueryCriteria.java deleted file mode 100755 index f817881..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RowQueryCriteria.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.model.condition.ColumnCondition; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import static com.aliyun.openservices.ots.utils.CodingUtils.assertParameterNotNull; -import static com.aliyun.openservices.ots.utils.CodingUtils.assertStringNotNullOrEmpty; - - -/** - * 表示返回行的查询条件。 - * - */ -public class RowQueryCriteria { - /** - * 查询的表的名称。 - */ - private String tableName; - - /** - * 要查询的列的名称,若未指定查询的列,则查询整行。 - */ - private List columnsToGet = new LinkedList(); - - /** - * 本次查询使用的Filter - */ - private ColumnCondition filter; - - /** - * 构造一个在给定名称的表中查询的条件。 - * @param tableName 查询的表名。 - */ - public RowQueryCriteria(String tableName){ - setTableName(tableName); - } - - /** - * 返回查询的表名。 - * @return 查询的表名。 - */ - public String getTableName() { - return tableName; - } - - /** - * 设置查询的表名。 - * @param tableName 查询的表名。 - */ - public void setTableName(String tableName) { - assertStringNotNullOrEmpty(tableName, "tableName"); - this.tableName = tableName; - } - - /** - * 返回返回列的名称的列表(只读)。 - * @return 列的名称的列表(只读)。 - */ - public List getColumnsToGet() { - return Collections.unmodifiableList(columnsToGet); - } - - /** - * 添加要返回的列。 - * @param columnName 要返回列的名称。 - */ - public void addColumnsToGet(String columnName){ - assertStringNotNullOrEmpty(columnName, "columnName"); - this.columnsToGet.add(columnName); - } - /** - * 添加要返回的列。 - * @param columnNames 要返回列的名称。 - */ - public void addColumnsToGet(String[] columnNames){ - assertParameterNotNull(columnNames, "columnNames"); - for(int i = 0; i < columnNames.length; ++i){ - this.columnsToGet.add(columnNames[i]); - } - } - - /** - * 设置需要读取的列的列表。若List为空,则读取所有列。 - * @param columnsToGet 需要读取的列的列表。 - */ - public void setColumnsToGet(List columnsToGet) { - assertParameterNotNull(columnsToGet, "columnsToGet"); - this.columnsToGet = columnsToGet; - } - - /** - * 获取本次查询使用的Filter。 - * @return 本次查询使用的Filter,若没有设置,返回null。 - */ - public ColumnCondition getFilter() { - return filter; - } - - /** - * 设置本次查询使用的Filter。 - * @param filter - */ - public void setFilter(ColumnCondition filter) { - assertParameterNotNull(filter, "filter"); - this.filter = filter; - } - - public void copyTo(RowQueryCriteria target) { - target.tableName = tableName; - target.columnsToGet.addAll(columnsToGet); - target.filter = filter; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/RowUpdateChange.java b/src/main/java/com/aliyun/openservices/ots/model/RowUpdateChange.java deleted file mode 100755 index d1176c8..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/RowUpdateChange.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import com.aliyun.openservices.ots.utils.CalculateHelper; -import com.aliyun.openservices.ots.utils.CodingUtils; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - - -/** - * 表示行的插入或更新信息。 - * - */ -public class RowUpdateChange extends RowChange { - /** - * 需要更改的属性列的值。 - * 若属性列的值为Null,则代表删除该列。 - */ - private Map attributeColumns = - new HashMap(); - - private int valueTotalSize = -1; - - /** - * 构造一个新的{@link RowPutChange}实例。 - * @param tableName 表的名称 - */ - public RowUpdateChange(String tableName){ - super(tableName); - } - - @Override - public int getDataSize() { - if (valueTotalSize == -1) { - valueTotalSize = 0; - for (Map.Entry entry : attributeColumns.entrySet()) { - valueTotalSize += CalculateHelper.getStringDataSize(entry.getKey()); - valueTotalSize += entry.getValue() == null ? 0 : entry.getValue().getSize(); - } - } - return primaryKey.getSize() + valueTotalSize; - } - - /** - * 返回属性列的名称与值的对应字典(只读)。 - * 若获取到得属性列的值为Null,则代表删除该列。 - * @return 名称与值的对应字典(只读)。 - */ - public Map getAttributeColumns() { - return Collections.unmodifiableMap(attributeColumns); - } - - /** - * 添加属性列的名称和值。 - * @param name 属性列的列名。 - * @param value 属性列的值。 - */ - public void addAttributeColumn(String name, ColumnValue value) { - CodingUtils.assertParameterNotNull(name, "name"); - CodingUtils.assertParameterNotNull(value, "value"); - this.attributeColumns.put(name, value); - this.valueTotalSize = -1; // value changed, reset size - } - - /** - * 删除某个属性列。 - * @param name 属性列的名称。 - */ - public void deleteAttributeColumn(String name) { - this.attributeColumns.put(name, null); - this.valueTotalSize = -1; // value changed, reset size - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/SingleRowQueryCriteria.java b/src/main/java/com/aliyun/openservices/ots/model/SingleRowQueryCriteria.java deleted file mode 100755 index fd57697..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/SingleRowQueryCriteria.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.aliyun.openservices.ots.model; - -/** - * 表示获取一行数据的查询条件。 - * - */ -public class SingleRowQueryCriteria extends RowQueryCriteria{ - private RowPrimaryKey primaryKey = new RowPrimaryKey(); - - /** - * 构造一个在给定名称的表中查询的条件。 - * @param tableName 查询的表名。 - */ - public SingleRowQueryCriteria(String tableName){ - super(tableName); - } - - /** - * 获取主键(Primary Key)列名称与值的对应字典(只读)。 - * @return 主键(Primary Key)列名称与值的对应字典(只读)。 - */ - public RowPrimaryKey getRowPrimaryKey() { - return primaryKey; - } - - /** - * 设置主键(Primary Key)。 - * @param primaryKey 行的主键。 - */ - public void setPrimaryKey(RowPrimaryKey primaryKey){ - this.primaryKey = primaryKey; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/TableMeta.java b/src/main/java/com/aliyun/openservices/ots/model/TableMeta.java deleted file mode 100755 index 5db1d3a..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/TableMeta.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - - -/** - * 表示表(Table)的结构信息。 - * - */ -public class TableMeta { - /** - * 表的名称。 - */ - private String tableName; - - /** - * 表的主键字典。 - * 字典内的主键是有顺序的,顺序与用户添加主键的顺序相同。 - */ - private Map primaryKey = new LinkedHashMap(); - - /** - * 该构造函数保留给从返回结果创建TableMeta使用, - * 用户不能通过该构造函数构造TableMeta。 - */ - TableMeta(){ - - } - - /** - * 创建一个新的给定表名的TableMeta实例。 - * @param tableName 表名。 - */ - public TableMeta(String tableName){ - if (tableName == null){ - throw new NullPointerException(); - } - this.tableName = tableName; - } - - /** - * 返回表的名称。 - * @return 表名。 - */ - public String getTableName() { - return tableName; - } - - /** - * 设置表的名称。 - * @param tableName 表的名称。 - */ - public void setTableName(String tableName) { - if (tableName == null){ - throw new NullPointerException(); - } - this.tableName = tableName; - } - - /** - * 返回主键的列名与值的只读对应字典。 - * @return 主键的列名与值的只读对应字典。 - */ - public Map getPrimaryKey() { - return Collections.unmodifiableMap(primaryKey); - } - - /** - * 添加一个主键列,最终创建的表中主键的顺序与用户添加主键的顺序相同。 - * @param name 主键列的名称。 - * @param type 主键列的数据类型。 - */ - public void addPrimaryKeyColumn(String name, PrimaryKeyType type){ - if (name == null){ - throw new NullPointerException(); - } - if (type == null){ - throw new NullPointerException(); - } - this.primaryKey.put(name, type); - } - - @Override - public String toString() { - String s = "TableName: " + tableName + ", PrimaryKeySchema: "; - boolean first = true; - for (Map.Entry entry : primaryKey.entrySet()) { - if (first) { - first = false; - } else { - s += ","; - } - s += entry.getKey() + ":" + entry.getValue(); - } - return s; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/UpdateRowResult.java b/src/main/java/com/aliyun/openservices/ots/model/UpdateRowResult.java deleted file mode 100755 index 77cb6d8..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/UpdateRowResult.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class UpdateRowResult extends OTSResult { - /** - * 此次操作消耗的CapacityUnit。 - */ - private ConsumedCapacity consumedCapacity; - - public UpdateRowResult() { - this.consumedCapacity = new ConsumedCapacity(); - } - - public UpdateRowResult(OTSResult meta) { - super(meta); - this.consumedCapacity = new ConsumedCapacity(); - } - - /** - * 获取此次操作消耗的CapacityUnit。 - * @return 此次操作消耗的CapacityUnit。 - */ - public ConsumedCapacity getConsumedCapacity() { - return consumedCapacity; - } - - void setConsumedCapacity(ConsumedCapacity consumedCapacity) { - this.consumedCapacity = consumedCapacity; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/UpdateTableRequest.java b/src/main/java/com/aliyun/openservices/ots/model/UpdateTableRequest.java deleted file mode 100755 index 37b824e..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/UpdateTableRequest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static com.aliyun.openservices.ots.utils.CodingUtils.*; - -public class UpdateTableRequest { - /** - * 表的名称。 - */ - private String tableName; - - /** - * 表的预留吞吐量变更。 - * 可以单独更改读CapacityUnit或者写CapacityUnit。 - */ - private ReservedThroughputChange reservedThroughputChange; - - public UpdateTableRequest() { - - } - - public UpdateTableRequest(String tableName) { - setTableName(tableName); - } - - public UpdateTableRequest(String tableName, ReservedThroughputChange capacityChange) { - setTableName(tableName); - setReservedThroughputChange(capacityChange); - } - - /** - * 获取表的名称。 - * @return 表的名称。 - */ - public String getTableName() { - return tableName; - } - - /** - * 设置表的名称 - * @param tableName 表的名称 - */ - public void setTableName(String tableName) { - assertParameterNotNull(tableName, "tableName"); - this.tableName = tableName; - } - - /** - * 获取表的预留吞吐量变更。 - * @return 表的预留吞吐量变更。 - */ - public ReservedThroughputChange getReservedThrougputChange() { - return reservedThroughputChange; - } - - /** - * 设置表的预留吞吐量变更。 - * @param reservedThroughputChange 表的预留吞吐量更改。 - */ - public void setReservedThroughputChange(ReservedThroughputChange reservedThroughputChange) { - assertParameterNotNull(reservedThroughputChange, "reservedThroughputChange"); - this.reservedThroughputChange = reservedThroughputChange; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/UpdateTableResult.java b/src/main/java/com/aliyun/openservices/ots/model/UpdateTableResult.java deleted file mode 100755 index fc54cd7..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/UpdateTableResult.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.aliyun.openservices.ots.model; - -public class UpdateTableResult extends OTSResult { - /** - * 表当前的预留吞吐量的更改信息。 - */ - private ReservedThroughputDetails reservedThroughputDetails; - - UpdateTableResult() { - - } - - UpdateTableResult(OTSResult meta) { - super(meta); - } - - /** - * 获取表当前的预留吞吐量的更改信息。 - * @return 表当前的预留吞吐量的更改信息。 - */ - public ReservedThroughputDetails getReservedThroughputDetails() { - return reservedThroughputDetails; - } - - void setReservedThroughputDetails(ReservedThroughputDetails reservedThroughputDetails) { - this.reservedThroughputDetails = reservedThroughputDetails; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnCondition.java b/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnCondition.java deleted file mode 100644 index d2f5809..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnCondition.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (C) Alibaba Cloud Computing - * All rights reserved. - * - * 版权所有 (C)阿里云计算有限公司 - */ - -package com.aliyun.openservices.ots.model.condition; - -import com.google.protobuf.ByteString; - -public interface ColumnCondition { - - public ColumnConditionType getType(); - - public ByteString serialize(); -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionBuilder.java b/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionBuilder.java deleted file mode 100644 index 6a03670..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionBuilder.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.aliyun.openservices.ots.model.condition; - -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.protocol.OtsProtocol2; -import com.google.protobuf.ByteString; - -public class ColumnConditionBuilder { - - private static OtsProtocol2.ComparatorType toComparatorType(RelationalCondition.CompareOperator operator) { - switch (operator) { - case EQUAL: - return OtsProtocol2.ComparatorType.CT_EQUAL; - case NOT_EQUAL: - return OtsProtocol2.ComparatorType.CT_NOT_EQUAL; - case GREATER_THAN: - return OtsProtocol2.ComparatorType.CT_GREATER_THAN; - case GREATER_EQUAL: - return OtsProtocol2.ComparatorType.CT_GREATER_EQUAL; - case LESS_THAN: - return OtsProtocol2.ComparatorType.CT_LESS_THAN; - case LESS_EQUAL: - return OtsProtocol2.ComparatorType.CT_LESS_EQUAL; - default: - throw new IllegalArgumentException("Unknown compare operator: " + operator); - } - } - - public static OtsProtocol2.LogicalOperator toLogicalOperator(CompositeCondition.LogicOperator type) { - switch (type) { - case NOT: - return OtsProtocol2.LogicalOperator.LO_NOT; - case AND: - return OtsProtocol2.LogicalOperator.LO_AND; - case OR: - return OtsProtocol2.LogicalOperator.LO_OR; - default: - throw new IllegalArgumentException("Unknown logic operation type: " + type); - } - } - - public static OtsProtocol2.ColumnConditionType toColumnConditionType(ColumnConditionType type) { - switch (type) { - case COMPOSITE_CONDITION: - return OtsProtocol2.ColumnConditionType.CCT_COMPOSITE; - case RELATIONAL_CONDITION: - return OtsProtocol2.ColumnConditionType.CCT_RELATION; - default: - throw new IllegalArgumentException("Unknown column condition type: " + type); - } - } - - public static OtsProtocol2.ColumnCondition toColumnCondition(ColumnCondition cc) { - OtsProtocol2.ColumnCondition.Builder builder = OtsProtocol2.ColumnCondition.newBuilder(); - builder.setType(toColumnConditionType(cc.getType())); - builder.setCondition(cc.serialize()); - return builder.build(); - } - - public static ByteString buildColumnCondition(ColumnCondition cc) { - return toColumnCondition(cc).toByteString(); - } - - public static ByteString buildCompositeCondition(CompositeCondition cc) { - OtsProtocol2.CompositeCondition.Builder builder = OtsProtocol2.CompositeCondition.newBuilder(); - builder.setCombinator(toLogicalOperator(cc.getOperationType())); - - for (ColumnCondition c : cc.getSubConditions()) { - builder.addSubConditions(toColumnCondition(c)); - } - - return builder.build().toByteString(); - } - - public static ByteString buildRelationalCondition(RelationalCondition scc) { - OtsProtocol2.RelationCondition.Builder builder = OtsProtocol2.RelationCondition.newBuilder(); - builder.setColumnName(scc.getColumnName()); - builder.setComparator(toComparatorType(scc.getOperator())); - builder.setColumnValue(OTSProtocolHelper.buildColumnValue(scc.getColumnValue())); - builder.setPassIfMissing(scc.isPassIfMissing()); - - return builder.build().toByteString(); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionType.java b/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionType.java deleted file mode 100644 index 6fc10f1..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/condition/ColumnConditionType.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.aliyun.openservices.ots.model.condition; - -public enum ColumnConditionType { - COMPOSITE_CONDITION, - RELATIONAL_CONDITION -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/condition/CompositeCondition.java b/src/main/java/com/aliyun/openservices/ots/model/condition/CompositeCondition.java deleted file mode 100644 index 984627a..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/condition/CompositeCondition.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.aliyun.openservices.ots.model.condition; - -import com.google.protobuf.ByteString; - -import java.util.ArrayList; -import java.util.List; - -public class CompositeCondition implements ColumnCondition { - public static enum LogicOperator { - NOT, AND, OR - } - - private LogicOperator type; - private List subConditions; - - public CompositeCondition(LogicOperator loType) { - this.type = loType; - this.subConditions = new ArrayList(); - } - - public CompositeCondition addCondition(ColumnCondition condition) { - this.subConditions.add(condition); - return this; - } - - public void clear() { - this.subConditions.clear(); - } - - /** - * 查看当前设置的逻辑关系。 - * - * @return 逻辑关系符号。 - */ - public LogicOperator getOperationType() { - return this.type; - } - - public List getSubConditions() { - return this.subConditions; - } - - @Override - public ColumnConditionType getType() { - return ColumnConditionType.COMPOSITE_CONDITION; - } - - @Override - public ByteString serialize() { - return ColumnConditionBuilder.buildCompositeCondition(this); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/model/condition/RelationalCondition.java b/src/main/java/com/aliyun/openservices/ots/model/condition/RelationalCondition.java deleted file mode 100644 index bec2f43..0000000 --- a/src/main/java/com/aliyun/openservices/ots/model/condition/RelationalCondition.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.aliyun.openservices.ots.model.condition; - -import com.aliyun.openservices.ots.model.ColumnValue; -import com.google.protobuf.ByteString; - -public class RelationalCondition implements ColumnCondition { - public static enum CompareOperator { - EQUAL, NOT_EQUAL, GREATER_THAN, GREATER_EQUAL, LESS_THAN, LESS_EQUAL - } - - private CompareOperator operator; - private String columnName; - private ColumnValue columnValue; - private boolean passIfMissing = true; - - public RelationalCondition( - String columnName, final CompareOperator operator, final ColumnValue columnValue) { - setColumnName(columnName); - setOperator(operator); - setColumnValue(columnValue); - } - - /** - * 获取列的比较操作符。 - * - * @return 比较操作符。 - */ - public CompareOperator getOperator() { - return operator; - } - - /** - * 设置列的比较操作符。 - * - * @param operator 比较操作符 - * @return this for chain invocation - */ - public RelationalCondition setOperator(CompareOperator operator) { - this.operator = operator; - return this; - } - - /** - * 获取列名。 - * - * @return 列的名称。 - */ - public String getColumnName() { - return columnName; - } - - /** - * 设置列的名称。 - * - * @param columnName 列的名称 - * @return this for chain invocation - */ - public RelationalCondition setColumnName(String columnName) { - this.columnName = columnName; - return this; - } - - /** - * 获取列的对比值。 - * - * @return 列的对比值。 - */ - public ColumnValue getColumnValue() { - return columnValue; - } - - /** - * 设置列的对比值。 - * - * @param columnValue 列的对比值。 - * @return this for chain invocation - */ - public RelationalCondition setColumnValue(ColumnValue columnValue) { - this.columnValue = columnValue; - return this; - } - - /** - * 返回设置的passIfMissing的值。 - * - * @return passIfMissing的值。 - */ - public boolean isPassIfMissing() { - return passIfMissing; - } - - /** - * 设置passIfMissing。 - * 于OTS一行的属性列不固定,有可能存在有condition条件的列在该行不存在的情况,这时{@link RelationalCondition#passIfMissing}参数控制在这种情况下对该行的检查结果。 - * 如果设置{@link RelationalCondition#passIfMissing}为true,则若列在该行中不存在,则检查条件通过。 - * 如果设置{@link RelationalCondition#passIfMissing}为false,则若列在该行中不存在,则检查条件失败。 - * 默认值为true。 - * - * @param passIfMissing - * @return this for chain invocation - */ - public RelationalCondition setPassIfMissing(boolean passIfMissing) { - this.passIfMissing = passIfMissing; - return this; - } - - @Override - public ColumnConditionType getType() { - return ColumnConditionType.RELATIONAL_CONDITION; - } - - @Override - public ByteString serialize() { - return ColumnConditionBuilder.buildRelationalCondition(this); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/protocol/OtsProtocol2.java b/src/main/java/com/aliyun/openservices/ots/protocol/OtsProtocol2.java deleted file mode 100755 index 40c9a04..0000000 --- a/src/main/java/com/aliyun/openservices/ots/protocol/OtsProtocol2.java +++ /dev/null @@ -1,33333 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: ots_protocol.2.proto - -package com.aliyun.openservices.ots.protocol; - -public final class OtsProtocol2 { - private OtsProtocol2() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - public enum ColumnType - implements com.google.protobuf.ProtocolMessageEnum { - INF_MIN(0, 0), - INF_MAX(1, 1), - INTEGER(2, 2), - STRING(3, 3), - BOOLEAN(4, 4), - DOUBLE(5, 5), - BINARY(6, 6), - ; - - public static final int INF_MIN_VALUE = 0; - public static final int INF_MAX_VALUE = 1; - public static final int INTEGER_VALUE = 2; - public static final int STRING_VALUE = 3; - public static final int BOOLEAN_VALUE = 4; - public static final int DOUBLE_VALUE = 5; - public static final int BINARY_VALUE = 6; - - - public final int getNumber() { return value; } - - public static ColumnType valueOf(int value) { - switch (value) { - case 0: return INF_MIN; - case 1: return INF_MAX; - case 2: return INTEGER; - case 3: return STRING; - case 4: return BOOLEAN; - case 5: return DOUBLE; - case 6: return BINARY; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public ColumnType findValueByNumber(int number) { - return ColumnType.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.getDescriptor().getEnumTypes().get(0); - } - - private static final ColumnType[] VALUES = { - INF_MIN, INF_MAX, INTEGER, STRING, BOOLEAN, DOUBLE, BINARY, - }; - - public static ColumnType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private ColumnType(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.aliyun.openservices.ots.protocol.ColumnType) - } - - public enum RowExistenceExpectation - implements com.google.protobuf.ProtocolMessageEnum { - IGNORE(0, 0), - EXPECT_EXIST(1, 1), - EXPECT_NOT_EXIST(2, 2), - ; - - public static final int IGNORE_VALUE = 0; - public static final int EXPECT_EXIST_VALUE = 1; - public static final int EXPECT_NOT_EXIST_VALUE = 2; - - - public final int getNumber() { return value; } - - public static RowExistenceExpectation valueOf(int value) { - switch (value) { - case 0: return IGNORE; - case 1: return EXPECT_EXIST; - case 2: return EXPECT_NOT_EXIST; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public RowExistenceExpectation findValueByNumber(int number) { - return RowExistenceExpectation.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.getDescriptor().getEnumTypes().get(1); - } - - private static final RowExistenceExpectation[] VALUES = { - IGNORE, EXPECT_EXIST, EXPECT_NOT_EXIST, - }; - - public static RowExistenceExpectation valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private RowExistenceExpectation(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.aliyun.openservices.ots.protocol.RowExistenceExpectation) - } - - public enum ColumnConditionType - implements com.google.protobuf.ProtocolMessageEnum { - CCT_RELATION(0, 1), - CCT_COMPOSITE(1, 2), - ; - - public static final int CCT_RELATION_VALUE = 1; - public static final int CCT_COMPOSITE_VALUE = 2; - - - public final int getNumber() { return value; } - - public static ColumnConditionType valueOf(int value) { - switch (value) { - case 1: return CCT_RELATION; - case 2: return CCT_COMPOSITE; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public ColumnConditionType findValueByNumber(int number) { - return ColumnConditionType.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.getDescriptor().getEnumTypes().get(2); - } - - private static final ColumnConditionType[] VALUES = { - CCT_RELATION, CCT_COMPOSITE, - }; - - public static ColumnConditionType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private ColumnConditionType(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.aliyun.openservices.ots.protocol.ColumnConditionType) - } - - public enum ComparatorType - implements com.google.protobuf.ProtocolMessageEnum { - CT_EQUAL(0, 1), - CT_NOT_EQUAL(1, 2), - CT_GREATER_THAN(2, 3), - CT_GREATER_EQUAL(3, 4), - CT_LESS_THAN(4, 5), - CT_LESS_EQUAL(5, 6), - ; - - public static final int CT_EQUAL_VALUE = 1; - public static final int CT_NOT_EQUAL_VALUE = 2; - public static final int CT_GREATER_THAN_VALUE = 3; - public static final int CT_GREATER_EQUAL_VALUE = 4; - public static final int CT_LESS_THAN_VALUE = 5; - public static final int CT_LESS_EQUAL_VALUE = 6; - - - public final int getNumber() { return value; } - - public static ComparatorType valueOf(int value) { - switch (value) { - case 1: return CT_EQUAL; - case 2: return CT_NOT_EQUAL; - case 3: return CT_GREATER_THAN; - case 4: return CT_GREATER_EQUAL; - case 5: return CT_LESS_THAN; - case 6: return CT_LESS_EQUAL; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public ComparatorType findValueByNumber(int number) { - return ComparatorType.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.getDescriptor().getEnumTypes().get(3); - } - - private static final ComparatorType[] VALUES = { - CT_EQUAL, CT_NOT_EQUAL, CT_GREATER_THAN, CT_GREATER_EQUAL, CT_LESS_THAN, CT_LESS_EQUAL, - }; - - public static ComparatorType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private ComparatorType(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.aliyun.openservices.ots.protocol.ComparatorType) - } - - public enum LogicalOperator - implements com.google.protobuf.ProtocolMessageEnum { - LO_NOT(0, 1), - LO_AND(1, 2), - LO_OR(2, 3), - ; - - public static final int LO_NOT_VALUE = 1; - public static final int LO_AND_VALUE = 2; - public static final int LO_OR_VALUE = 3; - - - public final int getNumber() { return value; } - - public static LogicalOperator valueOf(int value) { - switch (value) { - case 1: return LO_NOT; - case 2: return LO_AND; - case 3: return LO_OR; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public LogicalOperator findValueByNumber(int number) { - return LogicalOperator.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.getDescriptor().getEnumTypes().get(4); - } - - private static final LogicalOperator[] VALUES = { - LO_NOT, LO_AND, LO_OR, - }; - - public static LogicalOperator valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private LogicalOperator(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.aliyun.openservices.ots.protocol.LogicalOperator) - } - - public enum OperationType - implements com.google.protobuf.ProtocolMessageEnum { - PUT(0, 1), - DELETE(1, 2), - ; - - public static final int PUT_VALUE = 1; - public static final int DELETE_VALUE = 2; - - - public final int getNumber() { return value; } - - public static OperationType valueOf(int value) { - switch (value) { - case 1: return PUT; - case 2: return DELETE; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public OperationType findValueByNumber(int number) { - return OperationType.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.getDescriptor().getEnumTypes().get(5); - } - - private static final OperationType[] VALUES = { - PUT, DELETE, - }; - - public static OperationType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private OperationType(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.aliyun.openservices.ots.protocol.OperationType) - } - - public enum Direction - implements com.google.protobuf.ProtocolMessageEnum { - FORWARD(0, 0), - BACKWARD(1, 1), - ; - - public static final int FORWARD_VALUE = 0; - public static final int BACKWARD_VALUE = 1; - - - public final int getNumber() { return value; } - - public static Direction valueOf(int value) { - switch (value) { - case 0: return FORWARD; - case 1: return BACKWARD; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - private static com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public Direction findValueByNumber(int number) { - return Direction.valueOf(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(index); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.getDescriptor().getEnumTypes().get(6); - } - - private static final Direction[] VALUES = { - FORWARD, BACKWARD, - }; - - public static Direction valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int index; - private final int value; - - private Direction(int index, int value) { - this.index = index; - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:com.aliyun.openservices.ots.protocol.Direction) - } - - public interface ErrorOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string code = 1; - boolean hasCode(); - String getCode(); - - // optional string message = 2; - boolean hasMessage(); - String getMessage(); - } - public static final class Error extends - com.google.protobuf.GeneratedMessage - implements ErrorOrBuilder { - // Use Error.newBuilder() to construct. - private Error(Builder builder) { - super(builder); - } - private Error(boolean noInit) {} - - private static final Error defaultInstance; - public static Error getDefaultInstance() { - return defaultInstance; - } - - public Error getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Error_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Error_fieldAccessorTable; - } - - private int bitField0_; - // required string code = 1; - public static final int CODE_FIELD_NUMBER = 1; - private java.lang.Object code_; - public boolean hasCode() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getCode() { - java.lang.Object ref = code_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - code_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getCodeBytes() { - java.lang.Object ref = code_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - code_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string message = 2; - public static final int MESSAGE_FIELD_NUMBER = 2; - private java.lang.Object message_; - public boolean hasMessage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getMessage() { - java.lang.Object ref = message_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - message_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getMessageBytes() { - java.lang.Object ref = message_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - message_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - code_ = ""; - message_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCode()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getCodeBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getMessageBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getCodeBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getMessageBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Error parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.Error prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Error_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Error_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - code_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - message_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Error buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.Error(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.code_ = code_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.message_ = message_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.Error) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.Error)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.Error other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance()) return this; - if (other.hasCode()) { - setCode(other.getCode()); - } - if (other.hasMessage()) { - setMessage(other.getMessage()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCode()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - code_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - message_ = input.readBytes(); - break; - } - } - } - } - - private int bitField0_; - - // required string code = 1; - private java.lang.Object code_ = ""; - public boolean hasCode() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getCode() { - java.lang.Object ref = code_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - code_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setCode(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - code_ = value; - onChanged(); - return this; - } - public Builder clearCode() { - bitField0_ = (bitField0_ & ~0x00000001); - code_ = getDefaultInstance().getCode(); - onChanged(); - return this; - } - void setCode(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - code_ = value; - onChanged(); - } - - // optional string message = 2; - private java.lang.Object message_ = ""; - public boolean hasMessage() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getMessage() { - java.lang.Object ref = message_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - message_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setMessage(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - message_ = value; - onChanged(); - return this; - } - public Builder clearMessage() { - bitField0_ = (bitField0_ & ~0x00000002); - message_ = getDefaultInstance().getMessage(); - onChanged(); - return this; - } - void setMessage(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - message_ = value; - onChanged(); - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.Error) - } - - static { - defaultInstance = new Error(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.Error) - } - - public interface ColumnSchemaOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string name = 1; - boolean hasName(); - String getName(); - - // required .com.aliyun.openservices.ots.protocol.ColumnType type = 2; - boolean hasType(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType getType(); - } - public static final class ColumnSchema extends - com.google.protobuf.GeneratedMessage - implements ColumnSchemaOrBuilder { - // Use ColumnSchema.newBuilder() to construct. - private ColumnSchema(Builder builder) { - super(builder); - } - private ColumnSchema(boolean noInit) {} - - private static final ColumnSchema defaultInstance; - public static ColumnSchema getDefaultInstance() { - return defaultInstance; - } - - public ColumnSchema getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_fieldAccessorTable; - } - - private int bitField0_; - // required string name = 1; - public static final int NAME_FIELD_NUMBER = 1; - private java.lang.Object name_; - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getName() { - java.lang.Object ref = name_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - name_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.ColumnType type = 2; - public static final int TYPE_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType type_; - public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType getType() { - return type_; - } - - private void initFields() { - name_ = ""; - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasType()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeEnum(2, type_.getNumber()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(2, type_.getNumber()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchemaOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.type_ = type_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.getDefaultInstance()) return this; - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasType()) { - setType(other.getType()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasName()) { - - return false; - } - if (!hasType()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - name_ = input.readBytes(); - break; - } - case 16: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType value = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - bitField0_ |= 0x00000002; - type_ = value; - } - break; - } - } - } - } - - private int bitField0_; - - // required string name = 1; - private java.lang.Object name_ = ""; - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - name_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - void setName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.ColumnType type = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType getType() { - return type_; - } - public Builder setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - type_ = value; - onChanged(); - return this; - } - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000002); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ColumnSchema) - } - - static { - defaultInstance = new ColumnSchema(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ColumnSchema) - } - - public interface ColumnValueOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ColumnType type = 1; - boolean hasType(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType getType(); - - // optional int64 v_int = 2; - boolean hasVInt(); - long getVInt(); - - // optional string v_string = 3; - boolean hasVString(); - String getVString(); - - // optional bool v_bool = 4; - boolean hasVBool(); - boolean getVBool(); - - // optional double v_double = 5; - boolean hasVDouble(); - double getVDouble(); - - // optional bytes v_binary = 6; - boolean hasVBinary(); - com.google.protobuf.ByteString getVBinary(); - } - public static final class ColumnValue extends - com.google.protobuf.GeneratedMessage - implements ColumnValueOrBuilder { - // Use ColumnValue.newBuilder() to construct. - private ColumnValue(Builder builder) { - super(builder); - } - private ColumnValue(boolean noInit) {} - - private static final ColumnValue defaultInstance; - public static ColumnValue getDefaultInstance() { - return defaultInstance; - } - - public ColumnValue getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ColumnType type = 1; - public static final int TYPE_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType type_; - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType getType() { - return type_; - } - - // optional int64 v_int = 2; - public static final int V_INT_FIELD_NUMBER = 2; - private long vInt_; - public boolean hasVInt() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public long getVInt() { - return vInt_; - } - - // optional string v_string = 3; - public static final int V_STRING_FIELD_NUMBER = 3; - private java.lang.Object vString_; - public boolean hasVString() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public String getVString() { - java.lang.Object ref = vString_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - vString_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getVStringBytes() { - java.lang.Object ref = vString_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - vString_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional bool v_bool = 4; - public static final int V_BOOL_FIELD_NUMBER = 4; - private boolean vBool_; - public boolean hasVBool() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public boolean getVBool() { - return vBool_; - } - - // optional double v_double = 5; - public static final int V_DOUBLE_FIELD_NUMBER = 5; - private double vDouble_; - public boolean hasVDouble() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - public double getVDouble() { - return vDouble_; - } - - // optional bytes v_binary = 6; - public static final int V_BINARY_FIELD_NUMBER = 6; - private com.google.protobuf.ByteString vBinary_; - public boolean hasVBinary() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - public com.google.protobuf.ByteString getVBinary() { - return vBinary_; - } - - private void initFields() { - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - vInt_ = 0L; - vString_ = ""; - vBool_ = false; - vDouble_ = 0D; - vBinary_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasType()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt64(2, vInt_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, getVStringBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBool(4, vBool_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeDouble(5, vDouble_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(6, vBinary_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, vInt_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, getVStringBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(4, vBool_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(5, vDouble_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(6, vBinary_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - bitField0_ = (bitField0_ & ~0x00000001); - vInt_ = 0L; - bitField0_ = (bitField0_ & ~0x00000002); - vString_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - vBool_ = false; - bitField0_ = (bitField0_ & ~0x00000008); - vDouble_ = 0D; - bitField0_ = (bitField0_ & ~0x00000010); - vBinary_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000020); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.vInt_ = vInt_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.vString_ = vString_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.vBool_ = vBool_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.vDouble_ = vDouble_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.vBinary_ = vBinary_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance()) return this; - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasVInt()) { - setVInt(other.getVInt()); - } - if (other.hasVString()) { - setVString(other.getVString()); - } - if (other.hasVBool()) { - setVBool(other.getVBool()); - } - if (other.hasVDouble()) { - setVDouble(other.getVDouble()); - } - if (other.hasVBinary()) { - setVBinary(other.getVBinary()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasType()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType value = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = value; - } - break; - } - case 16: { - bitField0_ |= 0x00000002; - vInt_ = input.readInt64(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - vString_ = input.readBytes(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - vBool_ = input.readBool(); - break; - } - case 41: { - bitField0_ |= 0x00000010; - vDouble_ = input.readDouble(); - break; - } - case 50: { - bitField0_ |= 0x00000020; - vBinary_ = input.readBytes(); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ColumnType type = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType getType() { - return type_; - } - public Builder setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - type_ = value; - onChanged(); - return this; - } - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000001); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN; - onChanged(); - return this; - } - - // optional int64 v_int = 2; - private long vInt_ ; - public boolean hasVInt() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public long getVInt() { - return vInt_; - } - public Builder setVInt(long value) { - bitField0_ |= 0x00000002; - vInt_ = value; - onChanged(); - return this; - } - public Builder clearVInt() { - bitField0_ = (bitField0_ & ~0x00000002); - vInt_ = 0L; - onChanged(); - return this; - } - - // optional string v_string = 3; - private java.lang.Object vString_ = ""; - public boolean hasVString() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public String getVString() { - java.lang.Object ref = vString_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - vString_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setVString(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - vString_ = value; - onChanged(); - return this; - } - public Builder clearVString() { - bitField0_ = (bitField0_ & ~0x00000004); - vString_ = getDefaultInstance().getVString(); - onChanged(); - return this; - } - void setVString(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000004; - vString_ = value; - onChanged(); - } - - // optional bool v_bool = 4; - private boolean vBool_ ; - public boolean hasVBool() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public boolean getVBool() { - return vBool_; - } - public Builder setVBool(boolean value) { - bitField0_ |= 0x00000008; - vBool_ = value; - onChanged(); - return this; - } - public Builder clearVBool() { - bitField0_ = (bitField0_ & ~0x00000008); - vBool_ = false; - onChanged(); - return this; - } - - // optional double v_double = 5; - private double vDouble_ ; - public boolean hasVDouble() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - public double getVDouble() { - return vDouble_; - } - public Builder setVDouble(double value) { - bitField0_ |= 0x00000010; - vDouble_ = value; - onChanged(); - return this; - } - public Builder clearVDouble() { - bitField0_ = (bitField0_ & ~0x00000010); - vDouble_ = 0D; - onChanged(); - return this; - } - - // optional bytes v_binary = 6; - private com.google.protobuf.ByteString vBinary_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasVBinary() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - public com.google.protobuf.ByteString getVBinary() { - return vBinary_; - } - public Builder setVBinary(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - vBinary_ = value; - onChanged(); - return this; - } - public Builder clearVBinary() { - bitField0_ = (bitField0_ & ~0x00000020); - vBinary_ = getDefaultInstance().getVBinary(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ColumnValue) - } - - static { - defaultInstance = new ColumnValue(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ColumnValue) - } - - public interface ColumnOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string name = 1; - boolean hasName(); - String getName(); - - // required .com.aliyun.openservices.ots.protocol.ColumnValue value = 2; - boolean hasValue(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getValue(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getValueOrBuilder(); - } - public static final class Column extends - com.google.protobuf.GeneratedMessage - implements ColumnOrBuilder { - // Use Column.newBuilder() to construct. - private Column(Builder builder) { - super(builder); - } - private Column(boolean noInit) {} - - private static final Column defaultInstance; - public static Column getDefaultInstance() { - return defaultInstance; - } - - public Column getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Column_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Column_fieldAccessorTable; - } - - private int bitField0_; - // required string name = 1; - public static final int NAME_FIELD_NUMBER = 1; - private java.lang.Object name_; - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getName() { - java.lang.Object ref = name_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - name_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.ColumnValue value = 2; - public static final int VALUE_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getValue() { - return value_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getValueOrBuilder() { - return value_; - } - - private void initFields() { - name_ = ""; - value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasValue()) { - memoizedIsInitialized = 0; - return false; - } - if (!getValue().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, value_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Column parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Column_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Column_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getValueFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (valueBuilder_ == null) { - value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - } else { - valueBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Column buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.Column(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (valueBuilder_ == null) { - result.value_ = value_; - } else { - result.value_ = valueBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.Column) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.Column)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()) return this; - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasValue()) { - mergeValue(other.getValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasName()) { - - return false; - } - if (!hasValue()) { - - return false; - } - if (!getValue().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - name_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(); - if (hasValue()) { - subBuilder.mergeFrom(getValue()); - } - input.readMessage(subBuilder, extensionRegistry); - setValue(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string name = 1; - private java.lang.Object name_ = ""; - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - name_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - void setName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.ColumnValue value = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder> valueBuilder_; - public boolean hasValue() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getValue() { - if (valueBuilder_ == null) { - return value_; - } else { - return valueBuilder_.getMessage(); - } - } - public Builder setValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - if (valueBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - value_ = value; - onChanged(); - } else { - valueBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setValue( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder builderForValue) { - if (valueBuilder_ == null) { - value_ = builderForValue.build(); - onChanged(); - } else { - valueBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - if (valueBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - value_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance()) { - value_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(value_).mergeFrom(value).buildPartial(); - } else { - value_ = value; - } - onChanged(); - } else { - valueBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearValue() { - if (valueBuilder_ == null) { - value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - onChanged(); - } else { - valueBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder getValueBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getValueFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getValueOrBuilder() { - if (valueBuilder_ != null) { - return valueBuilder_.getMessageOrBuilder(); - } else { - return value_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder> - getValueFieldBuilder() { - if (valueBuilder_ == null) { - valueBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder>( - value_, - getParentForChildren(), - isClean()); - value_ = null; - } - return valueBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.Column) - } - - static { - defaultInstance = new Column(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.Column) - } - - public interface RowOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key_columns = 1; - java.util.List - getPrimaryKeyColumnsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKeyColumns(int index); - int getPrimaryKeyColumnsCount(); - java.util.List - getPrimaryKeyColumnsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyColumnsOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 2; - java.util.List - getAttributeColumnsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index); - int getAttributeColumnsCount(); - java.util.List - getAttributeColumnsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index); - } - public static final class Row extends - com.google.protobuf.GeneratedMessage - implements RowOrBuilder { - // Use Row.newBuilder() to construct. - private Row(Builder builder) { - super(builder); - } - private Row(boolean noInit) {} - - private static final Row defaultInstance; - public static Row getDefaultInstance() { - return defaultInstance; - } - - public Row getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Row_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Row_fieldAccessorTable; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key_columns = 1; - public static final int PRIMARY_KEY_COLUMNS_FIELD_NUMBER = 1; - private java.util.List primaryKeyColumns_; - public java.util.List getPrimaryKeyColumnsList() { - return primaryKeyColumns_; - } - public java.util.List - getPrimaryKeyColumnsOrBuilderList() { - return primaryKeyColumns_; - } - public int getPrimaryKeyColumnsCount() { - return primaryKeyColumns_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKeyColumns(int index) { - return primaryKeyColumns_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyColumnsOrBuilder( - int index) { - return primaryKeyColumns_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 2; - public static final int ATTRIBUTE_COLUMNS_FIELD_NUMBER = 2; - private java.util.List attributeColumns_; - public java.util.List getAttributeColumnsList() { - return attributeColumns_; - } - public java.util.List - getAttributeColumnsOrBuilderList() { - return attributeColumns_; - } - public int getAttributeColumnsCount() { - return attributeColumns_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index) { - return attributeColumns_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index) { - return attributeColumns_.get(index); - } - - private void initFields() { - primaryKeyColumns_ = java.util.Collections.emptyList(); - attributeColumns_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getPrimaryKeyColumnsCount(); i++) { - if (!getPrimaryKeyColumns(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < primaryKeyColumns_.size(); i++) { - output.writeMessage(1, primaryKeyColumns_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - output.writeMessage(2, attributeColumns_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < primaryKeyColumns_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, primaryKeyColumns_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, attributeColumns_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Row parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Row_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Row_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getPrimaryKeyColumnsFieldBuilder(); - getAttributeColumnsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (primaryKeyColumnsBuilder_ == null) { - primaryKeyColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - primaryKeyColumnsBuilder_.clear(); - } - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Row buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.Row(this); - int from_bitField0_ = bitField0_; - if (primaryKeyColumnsBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - primaryKeyColumns_ = java.util.Collections.unmodifiableList(primaryKeyColumns_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.primaryKeyColumns_ = primaryKeyColumns_; - } else { - result.primaryKeyColumns_ = primaryKeyColumnsBuilder_.build(); - } - if (attributeColumnsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - attributeColumns_ = java.util.Collections.unmodifiableList(attributeColumns_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.attributeColumns_ = attributeColumns_; - } else { - result.attributeColumns_ = attributeColumnsBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.Row) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.Row)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance()) return this; - if (primaryKeyColumnsBuilder_ == null) { - if (!other.primaryKeyColumns_.isEmpty()) { - if (primaryKeyColumns_.isEmpty()) { - primaryKeyColumns_ = other.primaryKeyColumns_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.addAll(other.primaryKeyColumns_); - } - onChanged(); - } - } else { - if (!other.primaryKeyColumns_.isEmpty()) { - if (primaryKeyColumnsBuilder_.isEmpty()) { - primaryKeyColumnsBuilder_.dispose(); - primaryKeyColumnsBuilder_ = null; - primaryKeyColumns_ = other.primaryKeyColumns_; - bitField0_ = (bitField0_ & ~0x00000001); - primaryKeyColumnsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyColumnsFieldBuilder() : null; - } else { - primaryKeyColumnsBuilder_.addAllMessages(other.primaryKeyColumns_); - } - } - } - if (attributeColumnsBuilder_ == null) { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumns_.isEmpty()) { - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureAttributeColumnsIsMutable(); - attributeColumns_.addAll(other.attributeColumns_); - } - onChanged(); - } - } else { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumnsBuilder_.isEmpty()) { - attributeColumnsBuilder_.dispose(); - attributeColumnsBuilder_ = null; - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000002); - attributeColumnsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getAttributeColumnsFieldBuilder() : null; - } else { - attributeColumnsBuilder_.addAllMessages(other.attributeColumns_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getPrimaryKeyColumnsCount(); i++) { - if (!getPrimaryKeyColumns(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKeyColumns(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAttributeColumns(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key_columns = 1; - private java.util.List primaryKeyColumns_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyColumnsIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - primaryKeyColumns_ = new java.util.ArrayList(primaryKeyColumns_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyColumnsBuilder_; - - public java.util.List getPrimaryKeyColumnsList() { - if (primaryKeyColumnsBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKeyColumns_); - } else { - return primaryKeyColumnsBuilder_.getMessageList(); - } - } - public int getPrimaryKeyColumnsCount() { - if (primaryKeyColumnsBuilder_ == null) { - return primaryKeyColumns_.size(); - } else { - return primaryKeyColumnsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKeyColumns(int index) { - if (primaryKeyColumnsBuilder_ == null) { - return primaryKeyColumns_.get(index); - } else { - return primaryKeyColumnsBuilder_.getMessage(index); - } - } - public Builder setPrimaryKeyColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.set(index, value); - onChanged(); - } else { - primaryKeyColumnsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKeyColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyColumnsBuilder_ == null) { - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyColumnsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKeyColumns(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.add(value); - onChanged(); - } else { - primaryKeyColumnsBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKeyColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.add(index, value); - onChanged(); - } else { - primaryKeyColumnsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKeyColumns( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyColumnsBuilder_ == null) { - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyColumnsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKeyColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyColumnsBuilder_ == null) { - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyColumnsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKeyColumns( - java.lang.Iterable values) { - if (primaryKeyColumnsBuilder_ == null) { - ensurePrimaryKeyColumnsIsMutable(); - super.addAll(values, primaryKeyColumns_); - onChanged(); - } else { - primaryKeyColumnsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKeyColumns() { - if (primaryKeyColumnsBuilder_ == null) { - primaryKeyColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - primaryKeyColumnsBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKeyColumns(int index) { - if (primaryKeyColumnsBuilder_ == null) { - ensurePrimaryKeyColumnsIsMutable(); - primaryKeyColumns_.remove(index); - onChanged(); - } else { - primaryKeyColumnsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyColumnsBuilder( - int index) { - return getPrimaryKeyColumnsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyColumnsOrBuilder( - int index) { - if (primaryKeyColumnsBuilder_ == null) { - return primaryKeyColumns_.get(index); } else { - return primaryKeyColumnsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyColumnsOrBuilderList() { - if (primaryKeyColumnsBuilder_ != null) { - return primaryKeyColumnsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKeyColumns_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyColumnsBuilder() { - return getPrimaryKeyColumnsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyColumnsBuilder( - int index) { - return getPrimaryKeyColumnsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyColumnsBuilderList() { - return getPrimaryKeyColumnsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyColumnsFieldBuilder() { - if (primaryKeyColumnsBuilder_ == null) { - primaryKeyColumnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKeyColumns_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - primaryKeyColumns_ = null; - } - return primaryKeyColumnsBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 2; - private java.util.List attributeColumns_ = - java.util.Collections.emptyList(); - private void ensureAttributeColumnsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - attributeColumns_ = new java.util.ArrayList(attributeColumns_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> attributeColumnsBuilder_; - - public java.util.List getAttributeColumnsList() { - if (attributeColumnsBuilder_ == null) { - return java.util.Collections.unmodifiableList(attributeColumns_); - } else { - return attributeColumnsBuilder_.getMessageList(); - } - } - public int getAttributeColumnsCount() { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.size(); - } else { - return attributeColumnsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); - } else { - return attributeColumnsBuilder_.getMessage(index); - } - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(value); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addAttributeColumns( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllAttributeColumns( - java.lang.Iterable values) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - super.addAll(values, attributeColumns_); - onChanged(); - } else { - attributeColumnsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearAttributeColumns() { - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - public Builder removeAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.remove(index); - onChanged(); - } else { - attributeColumnsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); } else { - return attributeColumnsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getAttributeColumnsOrBuilderList() { - if (attributeColumnsBuilder_ != null) { - return attributeColumnsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(attributeColumns_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addAttributeColumnsBuilder() { - return getAttributeColumnsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getAttributeColumnsBuilderList() { - return getAttributeColumnsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getAttributeColumnsFieldBuilder() { - if (attributeColumnsBuilder_ == null) { - attributeColumnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - attributeColumns_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - attributeColumns_ = null; - } - return attributeColumnsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.Row) - } - - static { - defaultInstance = new Row(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.Row) - } - - public interface TableMetaOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // repeated .com.aliyun.openservices.ots.protocol.ColumnSchema primary_key = 2; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchemaOrBuilder getPrimaryKeyOrBuilder( - int index); - } - public static final class TableMeta extends - com.google.protobuf.GeneratedMessage - implements TableMetaOrBuilder { - // Use TableMeta.newBuilder() to construct. - private TableMeta(Builder builder) { - super(builder); - } - private TableMeta(boolean noInit) {} - - private static final TableMeta defaultInstance; - public static TableMeta getDefaultInstance() { - return defaultInstance; - } - - public TableMeta getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableMeta_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableMeta_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnSchema primary_key = 2; - public static final int PRIMARY_KEY_FIELD_NUMBER = 2; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchemaOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - private void initFields() { - tableName_ = ""; - primaryKey_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(2, primaryKey_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, primaryKey_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableMeta_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableMeta_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getPrimaryKeyFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnSchema primary_key = 2; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchemaOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchemaOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchemaOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchemaOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.TableMeta) - } - - static { - defaultInstance = new TableMeta(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.TableMeta) - } - - public interface RelationConditionOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ComparatorType comparator = 1; - boolean hasComparator(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType getComparator(); - - // required string column_name = 2; - boolean hasColumnName(); - String getColumnName(); - - // required .com.aliyun.openservices.ots.protocol.ColumnValue column_value = 3; - boolean hasColumnValue(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getColumnValue(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getColumnValueOrBuilder(); - - // required bool pass_if_missing = 4; - boolean hasPassIfMissing(); - boolean getPassIfMissing(); - } - public static final class RelationCondition extends - com.google.protobuf.GeneratedMessage - implements RelationConditionOrBuilder { - // Use RelationCondition.newBuilder() to construct. - private RelationCondition(Builder builder) { - super(builder); - } - private RelationCondition(boolean noInit) {} - - private static final RelationCondition defaultInstance; - public static RelationCondition getDefaultInstance() { - return defaultInstance; - } - - public RelationCondition getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ComparatorType comparator = 1; - public static final int COMPARATOR_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType comparator_; - public boolean hasComparator() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType getComparator() { - return comparator_; - } - - // required string column_name = 2; - public static final int COLUMN_NAME_FIELD_NUMBER = 2; - private java.lang.Object columnName_; - public boolean hasColumnName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getColumnName() { - java.lang.Object ref = columnName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - columnName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getColumnNameBytes() { - java.lang.Object ref = columnName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - columnName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.ColumnValue column_value = 3; - public static final int COLUMN_VALUE_FIELD_NUMBER = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue columnValue_; - public boolean hasColumnValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getColumnValue() { - return columnValue_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getColumnValueOrBuilder() { - return columnValue_; - } - - // required bool pass_if_missing = 4; - public static final int PASS_IF_MISSING_FIELD_NUMBER = 4; - private boolean passIfMissing_; - public boolean hasPassIfMissing() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public boolean getPassIfMissing() { - return passIfMissing_; - } - - private void initFields() { - comparator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType.CT_EQUAL; - columnName_ = ""; - columnValue_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - passIfMissing_ = false; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasComparator()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasColumnName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasColumnValue()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasPassIfMissing()) { - memoizedIsInitialized = 0; - return false; - } - if (!getColumnValue().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, comparator_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getColumnNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(3, columnValue_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBool(4, passIfMissing_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, comparator_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getColumnNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, columnValue_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(4, passIfMissing_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationConditionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getColumnValueFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - comparator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType.CT_EQUAL; - bitField0_ = (bitField0_ & ~0x00000001); - columnName_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - if (columnValueBuilder_ == null) { - columnValue_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - } else { - columnValueBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - passIfMissing_ = false; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.comparator_ = comparator_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.columnName_ = columnName_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - if (columnValueBuilder_ == null) { - result.columnValue_ = columnValue_; - } else { - result.columnValue_ = columnValueBuilder_.build(); - } - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.passIfMissing_ = passIfMissing_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition.getDefaultInstance()) return this; - if (other.hasComparator()) { - setComparator(other.getComparator()); - } - if (other.hasColumnName()) { - setColumnName(other.getColumnName()); - } - if (other.hasColumnValue()) { - mergeColumnValue(other.getColumnValue()); - } - if (other.hasPassIfMissing()) { - setPassIfMissing(other.getPassIfMissing()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasComparator()) { - - return false; - } - if (!hasColumnName()) { - - return false; - } - if (!hasColumnValue()) { - - return false; - } - if (!hasPassIfMissing()) { - - return false; - } - if (!getColumnValue().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType value = com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - comparator_ = value; - } - break; - } - case 18: { - bitField0_ |= 0x00000002; - columnName_ = input.readBytes(); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(); - if (hasColumnValue()) { - subBuilder.mergeFrom(getColumnValue()); - } - input.readMessage(subBuilder, extensionRegistry); - setColumnValue(subBuilder.buildPartial()); - break; - } - case 32: { - bitField0_ |= 0x00000008; - passIfMissing_ = input.readBool(); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ComparatorType comparator = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType comparator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType.CT_EQUAL; - public boolean hasComparator() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType getComparator() { - return comparator_; - } - public Builder setComparator(com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - comparator_ = value; - onChanged(); - return this; - } - public Builder clearComparator() { - bitField0_ = (bitField0_ & ~0x00000001); - comparator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ComparatorType.CT_EQUAL; - onChanged(); - return this; - } - - // required string column_name = 2; - private java.lang.Object columnName_ = ""; - public boolean hasColumnName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getColumnName() { - java.lang.Object ref = columnName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - columnName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setColumnName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - columnName_ = value; - onChanged(); - return this; - } - public Builder clearColumnName() { - bitField0_ = (bitField0_ & ~0x00000002); - columnName_ = getDefaultInstance().getColumnName(); - onChanged(); - return this; - } - void setColumnName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - columnName_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.ColumnValue column_value = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue columnValue_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder> columnValueBuilder_; - public boolean hasColumnValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getColumnValue() { - if (columnValueBuilder_ == null) { - return columnValue_; - } else { - return columnValueBuilder_.getMessage(); - } - } - public Builder setColumnValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - if (columnValueBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - columnValue_ = value; - onChanged(); - } else { - columnValueBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder setColumnValue( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder builderForValue) { - if (columnValueBuilder_ == null) { - columnValue_ = builderForValue.build(); - onChanged(); - } else { - columnValueBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder mergeColumnValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - if (columnValueBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - columnValue_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance()) { - columnValue_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(columnValue_).mergeFrom(value).buildPartial(); - } else { - columnValue_ = value; - } - onChanged(); - } else { - columnValueBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder clearColumnValue() { - if (columnValueBuilder_ == null) { - columnValue_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - onChanged(); - } else { - columnValueBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder getColumnValueBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getColumnValueFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getColumnValueOrBuilder() { - if (columnValueBuilder_ != null) { - return columnValueBuilder_.getMessageOrBuilder(); - } else { - return columnValue_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder> - getColumnValueFieldBuilder() { - if (columnValueBuilder_ == null) { - columnValueBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder>( - columnValue_, - getParentForChildren(), - isClean()); - columnValue_ = null; - } - return columnValueBuilder_; - } - - // required bool pass_if_missing = 4; - private boolean passIfMissing_ ; - public boolean hasPassIfMissing() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public boolean getPassIfMissing() { - return passIfMissing_; - } - public Builder setPassIfMissing(boolean value) { - bitField0_ |= 0x00000008; - passIfMissing_ = value; - onChanged(); - return this; - } - public Builder clearPassIfMissing() { - bitField0_ = (bitField0_ & ~0x00000008); - passIfMissing_ = false; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.RelationCondition) - } - - static { - defaultInstance = new RelationCondition(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.RelationCondition) - } - - public interface CompositeConditionOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.LogicalOperator combinator = 1; - boolean hasCombinator(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator getCombinator(); - - // repeated .com.aliyun.openservices.ots.protocol.ColumnCondition sub_conditions = 2; - java.util.List - getSubConditionsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getSubConditions(int index); - int getSubConditionsCount(); - java.util.List - getSubConditionsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getSubConditionsOrBuilder( - int index); - } - public static final class CompositeCondition extends - com.google.protobuf.GeneratedMessage - implements CompositeConditionOrBuilder { - // Use CompositeCondition.newBuilder() to construct. - private CompositeCondition(Builder builder) { - super(builder); - } - private CompositeCondition(boolean noInit) {} - - private static final CompositeCondition defaultInstance; - public static CompositeCondition getDefaultInstance() { - return defaultInstance; - } - - public CompositeCondition getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.LogicalOperator combinator = 1; - public static final int COMBINATOR_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator combinator_; - public boolean hasCombinator() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator getCombinator() { - return combinator_; - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnCondition sub_conditions = 2; - public static final int SUB_CONDITIONS_FIELD_NUMBER = 2; - private java.util.List subConditions_; - public java.util.List getSubConditionsList() { - return subConditions_; - } - public java.util.List - getSubConditionsOrBuilderList() { - return subConditions_; - } - public int getSubConditionsCount() { - return subConditions_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getSubConditions(int index) { - return subConditions_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getSubConditionsOrBuilder( - int index) { - return subConditions_.get(index); - } - - private void initFields() { - combinator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator.LO_NOT; - subConditions_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCombinator()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getSubConditionsCount(); i++) { - if (!getSubConditions(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, combinator_.getNumber()); - } - for (int i = 0; i < subConditions_.size(); i++) { - output.writeMessage(2, subConditions_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, combinator_.getNumber()); - } - for (int i = 0; i < subConditions_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, subConditions_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeConditionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getSubConditionsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - combinator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator.LO_NOT; - bitField0_ = (bitField0_ & ~0x00000001); - if (subConditionsBuilder_ == null) { - subConditions_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - subConditionsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.combinator_ = combinator_; - if (subConditionsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subConditions_ = java.util.Collections.unmodifiableList(subConditions_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.subConditions_ = subConditions_; - } else { - result.subConditions_ = subConditionsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition.getDefaultInstance()) return this; - if (other.hasCombinator()) { - setCombinator(other.getCombinator()); - } - if (subConditionsBuilder_ == null) { - if (!other.subConditions_.isEmpty()) { - if (subConditions_.isEmpty()) { - subConditions_ = other.subConditions_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureSubConditionsIsMutable(); - subConditions_.addAll(other.subConditions_); - } - onChanged(); - } - } else { - if (!other.subConditions_.isEmpty()) { - if (subConditionsBuilder_.isEmpty()) { - subConditionsBuilder_.dispose(); - subConditionsBuilder_ = null; - subConditions_ = other.subConditions_; - bitField0_ = (bitField0_ & ~0x00000002); - subConditionsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getSubConditionsFieldBuilder() : null; - } else { - subConditionsBuilder_.addAllMessages(other.subConditions_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCombinator()) { - - return false; - } - for (int i = 0; i < getSubConditionsCount(); i++) { - if (!getSubConditions(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator value = com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - combinator_ = value; - } - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addSubConditions(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.LogicalOperator combinator = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator combinator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator.LO_NOT; - public boolean hasCombinator() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator getCombinator() { - return combinator_; - } - public Builder setCombinator(com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - combinator_ = value; - onChanged(); - return this; - } - public Builder clearCombinator() { - bitField0_ = (bitField0_ & ~0x00000001); - combinator_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.LogicalOperator.LO_NOT; - onChanged(); - return this; - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnCondition sub_conditions = 2; - private java.util.List subConditions_ = - java.util.Collections.emptyList(); - private void ensureSubConditionsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - subConditions_ = new java.util.ArrayList(subConditions_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> subConditionsBuilder_; - - public java.util.List getSubConditionsList() { - if (subConditionsBuilder_ == null) { - return java.util.Collections.unmodifiableList(subConditions_); - } else { - return subConditionsBuilder_.getMessageList(); - } - } - public int getSubConditionsCount() { - if (subConditionsBuilder_ == null) { - return subConditions_.size(); - } else { - return subConditionsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getSubConditions(int index) { - if (subConditionsBuilder_ == null) { - return subConditions_.get(index); - } else { - return subConditionsBuilder_.getMessage(index); - } - } - public Builder setSubConditions( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (subConditionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSubConditionsIsMutable(); - subConditions_.set(index, value); - onChanged(); - } else { - subConditionsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setSubConditions( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder builderForValue) { - if (subConditionsBuilder_ == null) { - ensureSubConditionsIsMutable(); - subConditions_.set(index, builderForValue.build()); - onChanged(); - } else { - subConditionsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addSubConditions(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (subConditionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSubConditionsIsMutable(); - subConditions_.add(value); - onChanged(); - } else { - subConditionsBuilder_.addMessage(value); - } - return this; - } - public Builder addSubConditions( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (subConditionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSubConditionsIsMutable(); - subConditions_.add(index, value); - onChanged(); - } else { - subConditionsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addSubConditions( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder builderForValue) { - if (subConditionsBuilder_ == null) { - ensureSubConditionsIsMutable(); - subConditions_.add(builderForValue.build()); - onChanged(); - } else { - subConditionsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addSubConditions( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder builderForValue) { - if (subConditionsBuilder_ == null) { - ensureSubConditionsIsMutable(); - subConditions_.add(index, builderForValue.build()); - onChanged(); - } else { - subConditionsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllSubConditions( - java.lang.Iterable values) { - if (subConditionsBuilder_ == null) { - ensureSubConditionsIsMutable(); - super.addAll(values, subConditions_); - onChanged(); - } else { - subConditionsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearSubConditions() { - if (subConditionsBuilder_ == null) { - subConditions_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - subConditionsBuilder_.clear(); - } - return this; - } - public Builder removeSubConditions(int index) { - if (subConditionsBuilder_ == null) { - ensureSubConditionsIsMutable(); - subConditions_.remove(index); - onChanged(); - } else { - subConditionsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder getSubConditionsBuilder( - int index) { - return getSubConditionsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getSubConditionsOrBuilder( - int index) { - if (subConditionsBuilder_ == null) { - return subConditions_.get(index); } else { - return subConditionsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getSubConditionsOrBuilderList() { - if (subConditionsBuilder_ != null) { - return subConditionsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(subConditions_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder addSubConditionsBuilder() { - return getSubConditionsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder addSubConditionsBuilder( - int index) { - return getSubConditionsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance()); - } - public java.util.List - getSubConditionsBuilderList() { - return getSubConditionsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> - getSubConditionsFieldBuilder() { - if (subConditionsBuilder_ == null) { - subConditionsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder>( - subConditions_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - subConditions_ = null; - } - return subConditionsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.CompositeCondition) - } - - static { - defaultInstance = new CompositeCondition(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.CompositeCondition) - } - - public interface ColumnConditionOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ColumnConditionType type = 1; - boolean hasType(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType getType(); - - // required bytes condition = 2; - boolean hasCondition(); - com.google.protobuf.ByteString getCondition(); - } - public static final class ColumnCondition extends - com.google.protobuf.GeneratedMessage - implements ColumnConditionOrBuilder { - // Use ColumnCondition.newBuilder() to construct. - private ColumnCondition(Builder builder) { - super(builder); - } - private ColumnCondition(boolean noInit) {} - - private static final ColumnCondition defaultInstance; - public static ColumnCondition getDefaultInstance() { - return defaultInstance; - } - - public ColumnCondition getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ColumnConditionType type = 1; - public static final int TYPE_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType type_; - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType getType() { - return type_; - } - - // required bytes condition = 2; - public static final int CONDITION_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString condition_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.google.protobuf.ByteString getCondition() { - return condition_; - } - - private void initFields() { - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType.CCT_RELATION; - condition_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasType()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasCondition()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, condition_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, condition_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType.CCT_RELATION; - bitField0_ = (bitField0_ & ~0x00000001); - condition_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.condition_ = condition_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance()) return this; - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasCondition()) { - setCondition(other.getCondition()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasType()) { - - return false; - } - if (!hasCondition()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType value = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = value; - } - break; - } - case 18: { - bitField0_ |= 0x00000002; - condition_ = input.readBytes(); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ColumnConditionType type = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType.CCT_RELATION; - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType getType() { - return type_; - } - public Builder setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - type_ = value; - onChanged(); - return this; - } - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000001); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionType.CCT_RELATION; - onChanged(); - return this; - } - - // required bytes condition = 2; - private com.google.protobuf.ByteString condition_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.google.protobuf.ByteString getCondition() { - return condition_; - } - public Builder setCondition(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - condition_ = value; - onChanged(); - return this; - } - public Builder clearCondition() { - bitField0_ = (bitField0_ & ~0x00000002); - condition_ = getDefaultInstance().getCondition(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ColumnCondition) - } - - static { - defaultInstance = new ColumnCondition(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ColumnCondition) - } - - public interface ConditionOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.RowExistenceExpectation row_existence = 1; - boolean hasRowExistence(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation getRowExistence(); - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition column_condition = 2; - boolean hasColumnCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getColumnCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getColumnConditionOrBuilder(); - } - public static final class Condition extends - com.google.protobuf.GeneratedMessage - implements ConditionOrBuilder { - // Use Condition.newBuilder() to construct. - private Condition(Builder builder) { - super(builder); - } - private Condition(boolean noInit) {} - - private static final Condition defaultInstance; - public static Condition getDefaultInstance() { - return defaultInstance; - } - - public Condition getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Condition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Condition_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.RowExistenceExpectation row_existence = 1; - public static final int ROW_EXISTENCE_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation rowExistence_; - public boolean hasRowExistence() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation getRowExistence() { - return rowExistence_; - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition column_condition = 2; - public static final int COLUMN_CONDITION_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition columnCondition_; - public boolean hasColumnCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getColumnCondition() { - return columnCondition_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getColumnConditionOrBuilder() { - return columnCondition_; - } - - private void initFields() { - rowExistence_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.IGNORE; - columnCondition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasRowExistence()) { - memoizedIsInitialized = 0; - return false; - } - if (hasColumnCondition()) { - if (!getColumnCondition().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, rowExistence_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, columnCondition_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, rowExistence_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, columnCondition_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Condition_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_Condition_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getColumnConditionFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - rowExistence_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.IGNORE; - bitField0_ = (bitField0_ & ~0x00000001); - if (columnConditionBuilder_ == null) { - columnCondition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } else { - columnConditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.rowExistence_ = rowExistence_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (columnConditionBuilder_ == null) { - result.columnCondition_ = columnCondition_; - } else { - result.columnCondition_ = columnConditionBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance()) return this; - if (other.hasRowExistence()) { - setRowExistence(other.getRowExistence()); - } - if (other.hasColumnCondition()) { - mergeColumnCondition(other.getColumnCondition()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasRowExistence()) { - - return false; - } - if (hasColumnCondition()) { - if (!getColumnCondition().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation value = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - rowExistence_ = value; - } - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(); - if (hasColumnCondition()) { - subBuilder.mergeFrom(getColumnCondition()); - } - input.readMessage(subBuilder, extensionRegistry); - setColumnCondition(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.RowExistenceExpectation row_existence = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation rowExistence_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.IGNORE; - public boolean hasRowExistence() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation getRowExistence() { - return rowExistence_; - } - public Builder setRowExistence(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - rowExistence_ = value; - onChanged(); - return this; - } - public Builder clearRowExistence() { - bitField0_ = (bitField0_ & ~0x00000001); - rowExistence_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.IGNORE; - onChanged(); - return this; - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition column_condition = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition columnCondition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> columnConditionBuilder_; - public boolean hasColumnCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getColumnCondition() { - if (columnConditionBuilder_ == null) { - return columnCondition_; - } else { - return columnConditionBuilder_.getMessage(); - } - } - public Builder setColumnCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (columnConditionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - columnCondition_ = value; - onChanged(); - } else { - columnConditionBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setColumnCondition( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder builderForValue) { - if (columnConditionBuilder_ == null) { - columnCondition_ = builderForValue.build(); - onChanged(); - } else { - columnConditionBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeColumnCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (columnConditionBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - columnCondition_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance()) { - columnCondition_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(columnCondition_).mergeFrom(value).buildPartial(); - } else { - columnCondition_ = value; - } - onChanged(); - } else { - columnConditionBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearColumnCondition() { - if (columnConditionBuilder_ == null) { - columnCondition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - onChanged(); - } else { - columnConditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder getColumnConditionBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getColumnConditionFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getColumnConditionOrBuilder() { - if (columnConditionBuilder_ != null) { - return columnConditionBuilder_.getMessageOrBuilder(); - } else { - return columnCondition_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> - getColumnConditionFieldBuilder() { - if (columnConditionBuilder_ == null) { - columnConditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder>( - columnCondition_, - getParentForChildren(), - isClean()); - columnCondition_ = null; - } - return columnConditionBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.Condition) - } - - static { - defaultInstance = new Condition(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.Condition) - } - - public interface CapacityUnitOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional int32 read = 1; - boolean hasRead(); - int getRead(); - - // optional int32 write = 2; - boolean hasWrite(); - int getWrite(); - } - public static final class CapacityUnit extends - com.google.protobuf.GeneratedMessage - implements CapacityUnitOrBuilder { - // Use CapacityUnit.newBuilder() to construct. - private CapacityUnit(Builder builder) { - super(builder); - } - private CapacityUnit(boolean noInit) {} - - private static final CapacityUnit defaultInstance; - public static CapacityUnit getDefaultInstance() { - return defaultInstance; - } - - public CapacityUnit getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_fieldAccessorTable; - } - - private int bitField0_; - // optional int32 read = 1; - public static final int READ_FIELD_NUMBER = 1; - private int read_; - public boolean hasRead() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getRead() { - return read_; - } - - // optional int32 write = 2; - public static final int WRITE_FIELD_NUMBER = 2; - private int write_; - public boolean hasWrite() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public int getWrite() { - return write_; - } - - private void initFields() { - read_ = 0; - write_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, read_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, write_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(1, read_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(2, write_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - read_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - write_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.read_ = read_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.write_ = write_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance()) return this; - if (other.hasRead()) { - setRead(other.getRead()); - } - if (other.hasWrite()) { - setWrite(other.getWrite()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - read_ = input.readInt32(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - write_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // optional int32 read = 1; - private int read_ ; - public boolean hasRead() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public int getRead() { - return read_; - } - public Builder setRead(int value) { - bitField0_ |= 0x00000001; - read_ = value; - onChanged(); - return this; - } - public Builder clearRead() { - bitField0_ = (bitField0_ & ~0x00000001); - read_ = 0; - onChanged(); - return this; - } - - // optional int32 write = 2; - private int write_ ; - public boolean hasWrite() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public int getWrite() { - return write_; - } - public Builder setWrite(int value) { - bitField0_ |= 0x00000002; - write_ = value; - onChanged(); - return this; - } - public Builder clearWrite() { - bitField0_ = (bitField0_ & ~0x00000002); - write_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.CapacityUnit) - } - - static { - defaultInstance = new CapacityUnit(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.CapacityUnit) - } - - public interface ReservedThroughputDetailsOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - boolean hasCapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder(); - - // required int64 last_increase_time = 2; - boolean hasLastIncreaseTime(); - long getLastIncreaseTime(); - - // optional int64 last_decrease_time = 3; - boolean hasLastDecreaseTime(); - long getLastDecreaseTime(); - - // required int32 number_of_decreases_today = 4; - boolean hasNumberOfDecreasesToday(); - int getNumberOfDecreasesToday(); - } - public static final class ReservedThroughputDetails extends - com.google.protobuf.GeneratedMessage - implements ReservedThroughputDetailsOrBuilder { - // Use ReservedThroughputDetails.newBuilder() to construct. - private ReservedThroughputDetails(Builder builder) { - super(builder); - } - private ReservedThroughputDetails(boolean noInit) {} - - private static final ReservedThroughputDetails defaultInstance; - public static ReservedThroughputDetails getDefaultInstance() { - return defaultInstance; - } - - public ReservedThroughputDetails getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - public static final int CAPACITY_UNIT_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit capacityUnit_; - public boolean hasCapacityUnit() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit() { - return capacityUnit_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { - return capacityUnit_; - } - - // required int64 last_increase_time = 2; - public static final int LAST_INCREASE_TIME_FIELD_NUMBER = 2; - private long lastIncreaseTime_; - public boolean hasLastIncreaseTime() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public long getLastIncreaseTime() { - return lastIncreaseTime_; - } - - // optional int64 last_decrease_time = 3; - public static final int LAST_DECREASE_TIME_FIELD_NUMBER = 3; - private long lastDecreaseTime_; - public boolean hasLastDecreaseTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getLastDecreaseTime() { - return lastDecreaseTime_; - } - - // required int32 number_of_decreases_today = 4; - public static final int NUMBER_OF_DECREASES_TODAY_FIELD_NUMBER = 4; - private int numberOfDecreasesToday_; - public boolean hasNumberOfDecreasesToday() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getNumberOfDecreasesToday() { - return numberOfDecreasesToday_; - } - - private void initFields() { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - lastIncreaseTime_ = 0L; - lastDecreaseTime_ = 0L; - numberOfDecreasesToday_ = 0; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCapacityUnit()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasLastIncreaseTime()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasNumberOfDecreasesToday()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, capacityUnit_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt64(2, lastIncreaseTime_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, lastDecreaseTime_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(4, numberOfDecreasesToday_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, capacityUnit_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(2, lastIncreaseTime_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(3, lastDecreaseTime_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, numberOfDecreasesToday_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getCapacityUnitFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (capacityUnitBuilder_ == null) { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - } else { - capacityUnitBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - lastIncreaseTime_ = 0L; - bitField0_ = (bitField0_ & ~0x00000002); - lastDecreaseTime_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - numberOfDecreasesToday_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (capacityUnitBuilder_ == null) { - result.capacityUnit_ = capacityUnit_; - } else { - result.capacityUnit_ = capacityUnitBuilder_.build(); - } - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.lastIncreaseTime_ = lastIncreaseTime_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.lastDecreaseTime_ = lastDecreaseTime_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.numberOfDecreasesToday_ = numberOfDecreasesToday_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance()) return this; - if (other.hasCapacityUnit()) { - mergeCapacityUnit(other.getCapacityUnit()); - } - if (other.hasLastIncreaseTime()) { - setLastIncreaseTime(other.getLastIncreaseTime()); - } - if (other.hasLastDecreaseTime()) { - setLastDecreaseTime(other.getLastDecreaseTime()); - } - if (other.hasNumberOfDecreasesToday()) { - setNumberOfDecreasesToday(other.getNumberOfDecreasesToday()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCapacityUnit()) { - - return false; - } - if (!hasLastIncreaseTime()) { - - return false; - } - if (!hasNumberOfDecreasesToday()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(); - if (hasCapacityUnit()) { - subBuilder.mergeFrom(getCapacityUnit()); - } - input.readMessage(subBuilder, extensionRegistry); - setCapacityUnit(subBuilder.buildPartial()); - break; - } - case 16: { - bitField0_ |= 0x00000002; - lastIncreaseTime_ = input.readInt64(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - lastDecreaseTime_ = input.readInt64(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - numberOfDecreasesToday_ = input.readInt32(); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder> capacityUnitBuilder_; - public boolean hasCapacityUnit() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit() { - if (capacityUnitBuilder_ == null) { - return capacityUnit_; - } else { - return capacityUnitBuilder_.getMessage(); - } - } - public Builder setCapacityUnit(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit value) { - if (capacityUnitBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - capacityUnit_ = value; - onChanged(); - } else { - capacityUnitBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setCapacityUnit( - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder builderForValue) { - if (capacityUnitBuilder_ == null) { - capacityUnit_ = builderForValue.build(); - onChanged(); - } else { - capacityUnitBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeCapacityUnit(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit value) { - if (capacityUnitBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - capacityUnit_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance()) { - capacityUnit_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(capacityUnit_).mergeFrom(value).buildPartial(); - } else { - capacityUnit_ = value; - } - onChanged(); - } else { - capacityUnitBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearCapacityUnit() { - if (capacityUnitBuilder_ == null) { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - onChanged(); - } else { - capacityUnitBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder getCapacityUnitBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getCapacityUnitFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { - if (capacityUnitBuilder_ != null) { - return capacityUnitBuilder_.getMessageOrBuilder(); - } else { - return capacityUnit_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder> - getCapacityUnitFieldBuilder() { - if (capacityUnitBuilder_ == null) { - capacityUnitBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder>( - capacityUnit_, - getParentForChildren(), - isClean()); - capacityUnit_ = null; - } - return capacityUnitBuilder_; - } - - // required int64 last_increase_time = 2; - private long lastIncreaseTime_ ; - public boolean hasLastIncreaseTime() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public long getLastIncreaseTime() { - return lastIncreaseTime_; - } - public Builder setLastIncreaseTime(long value) { - bitField0_ |= 0x00000002; - lastIncreaseTime_ = value; - onChanged(); - return this; - } - public Builder clearLastIncreaseTime() { - bitField0_ = (bitField0_ & ~0x00000002); - lastIncreaseTime_ = 0L; - onChanged(); - return this; - } - - // optional int64 last_decrease_time = 3; - private long lastDecreaseTime_ ; - public boolean hasLastDecreaseTime() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public long getLastDecreaseTime() { - return lastDecreaseTime_; - } - public Builder setLastDecreaseTime(long value) { - bitField0_ |= 0x00000004; - lastDecreaseTime_ = value; - onChanged(); - return this; - } - public Builder clearLastDecreaseTime() { - bitField0_ = (bitField0_ & ~0x00000004); - lastDecreaseTime_ = 0L; - onChanged(); - return this; - } - - // required int32 number_of_decreases_today = 4; - private int numberOfDecreasesToday_ ; - public boolean hasNumberOfDecreasesToday() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getNumberOfDecreasesToday() { - return numberOfDecreasesToday_; - } - public Builder setNumberOfDecreasesToday(int value) { - bitField0_ |= 0x00000008; - numberOfDecreasesToday_ = value; - onChanged(); - return this; - } - public Builder clearNumberOfDecreasesToday() { - bitField0_ = (bitField0_ & ~0x00000008); - numberOfDecreasesToday_ = 0; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ReservedThroughputDetails) - } - - static { - defaultInstance = new ReservedThroughputDetails(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ReservedThroughputDetails) - } - - public interface ReservedThroughputOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - boolean hasCapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder(); - } - public static final class ReservedThroughput extends - com.google.protobuf.GeneratedMessage - implements ReservedThroughputOrBuilder { - // Use ReservedThroughput.newBuilder() to construct. - private ReservedThroughput(Builder builder) { - super(builder); - } - private ReservedThroughput(boolean noInit) {} - - private static final ReservedThroughput defaultInstance; - public static ReservedThroughput getDefaultInstance() { - return defaultInstance; - } - - public ReservedThroughput getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - public static final int CAPACITY_UNIT_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit capacityUnit_; - public boolean hasCapacityUnit() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit() { - return capacityUnit_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { - return capacityUnit_; - } - - private void initFields() { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCapacityUnit()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, capacityUnit_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, capacityUnit_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getCapacityUnitFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (capacityUnitBuilder_ == null) { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - } else { - capacityUnitBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (capacityUnitBuilder_ == null) { - result.capacityUnit_ = capacityUnit_; - } else { - result.capacityUnit_ = capacityUnitBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance()) return this; - if (other.hasCapacityUnit()) { - mergeCapacityUnit(other.getCapacityUnit()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCapacityUnit()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(); - if (hasCapacityUnit()) { - subBuilder.mergeFrom(getCapacityUnit()); - } - input.readMessage(subBuilder, extensionRegistry); - setCapacityUnit(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder> capacityUnitBuilder_; - public boolean hasCapacityUnit() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit() { - if (capacityUnitBuilder_ == null) { - return capacityUnit_; - } else { - return capacityUnitBuilder_.getMessage(); - } - } - public Builder setCapacityUnit(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit value) { - if (capacityUnitBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - capacityUnit_ = value; - onChanged(); - } else { - capacityUnitBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setCapacityUnit( - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder builderForValue) { - if (capacityUnitBuilder_ == null) { - capacityUnit_ = builderForValue.build(); - onChanged(); - } else { - capacityUnitBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeCapacityUnit(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit value) { - if (capacityUnitBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - capacityUnit_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance()) { - capacityUnit_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(capacityUnit_).mergeFrom(value).buildPartial(); - } else { - capacityUnit_ = value; - } - onChanged(); - } else { - capacityUnitBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearCapacityUnit() { - if (capacityUnitBuilder_ == null) { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - onChanged(); - } else { - capacityUnitBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder getCapacityUnitBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getCapacityUnitFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { - if (capacityUnitBuilder_ != null) { - return capacityUnitBuilder_.getMessageOrBuilder(); - } else { - return capacityUnit_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder> - getCapacityUnitFieldBuilder() { - if (capacityUnitBuilder_ == null) { - capacityUnitBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder>( - capacityUnit_, - getParentForChildren(), - isClean()); - capacityUnit_ = null; - } - return capacityUnitBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ReservedThroughput) - } - - static { - defaultInstance = new ReservedThroughput(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ReservedThroughput) - } - - public interface ConsumedCapacityOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - boolean hasCapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder(); - } - public static final class ConsumedCapacity extends - com.google.protobuf.GeneratedMessage - implements ConsumedCapacityOrBuilder { - // Use ConsumedCapacity.newBuilder() to construct. - private ConsumedCapacity(Builder builder) { - super(builder); - } - private ConsumedCapacity(boolean noInit) {} - - private static final ConsumedCapacity defaultInstance; - public static ConsumedCapacity getDefaultInstance() { - return defaultInstance; - } - - public ConsumedCapacity getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - public static final int CAPACITY_UNIT_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit capacityUnit_; - public boolean hasCapacityUnit() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit() { - return capacityUnit_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { - return capacityUnit_; - } - - private void initFields() { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCapacityUnit()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, capacityUnit_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, capacityUnit_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getCapacityUnitFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (capacityUnitBuilder_ == null) { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - } else { - capacityUnitBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (capacityUnitBuilder_ == null) { - result.capacityUnit_ = capacityUnit_; - } else { - result.capacityUnit_ = capacityUnitBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) return this; - if (other.hasCapacityUnit()) { - mergeCapacityUnit(other.getCapacityUnit()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCapacityUnit()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(); - if (hasCapacityUnit()) { - subBuilder.mergeFrom(getCapacityUnit()); - } - input.readMessage(subBuilder, extensionRegistry); - setCapacityUnit(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.CapacityUnit capacity_unit = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder> capacityUnitBuilder_; - public boolean hasCapacityUnit() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit getCapacityUnit() { - if (capacityUnitBuilder_ == null) { - return capacityUnit_; - } else { - return capacityUnitBuilder_.getMessage(); - } - } - public Builder setCapacityUnit(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit value) { - if (capacityUnitBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - capacityUnit_ = value; - onChanged(); - } else { - capacityUnitBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setCapacityUnit( - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder builderForValue) { - if (capacityUnitBuilder_ == null) { - capacityUnit_ = builderForValue.build(); - onChanged(); - } else { - capacityUnitBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeCapacityUnit(com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit value) { - if (capacityUnitBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - capacityUnit_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance()) { - capacityUnit_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.newBuilder(capacityUnit_).mergeFrom(value).buildPartial(); - } else { - capacityUnit_ = value; - } - onChanged(); - } else { - capacityUnitBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearCapacityUnit() { - if (capacityUnitBuilder_ == null) { - capacityUnit_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.getDefaultInstance(); - onChanged(); - } else { - capacityUnitBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder getCapacityUnitBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getCapacityUnitFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder getCapacityUnitOrBuilder() { - if (capacityUnitBuilder_ != null) { - return capacityUnitBuilder_.getMessageOrBuilder(); - } else { - return capacityUnit_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder> - getCapacityUnitFieldBuilder() { - if (capacityUnitBuilder_ == null) { - capacityUnitBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnitOrBuilder>( - capacityUnit_, - getParentForChildren(), - isClean()); - capacityUnit_ = null; - } - return capacityUnitBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ConsumedCapacity) - } - - static { - defaultInstance = new ConsumedCapacity(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ConsumedCapacity) - } - - public interface CreateTableRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.TableMeta table_meta = 1; - boolean hasTableMeta(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta getTableMeta(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder getTableMetaOrBuilder(); - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughput reserved_throughput = 2; - boolean hasReservedThroughput(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput getReservedThroughput(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder getReservedThroughputOrBuilder(); - } - public static final class CreateTableRequest extends - com.google.protobuf.GeneratedMessage - implements CreateTableRequestOrBuilder { - // Use CreateTableRequest.newBuilder() to construct. - private CreateTableRequest(Builder builder) { - super(builder); - } - private CreateTableRequest(boolean noInit) {} - - private static final CreateTableRequest defaultInstance; - public static CreateTableRequest getDefaultInstance() { - return defaultInstance; - } - - public CreateTableRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.TableMeta table_meta = 1; - public static final int TABLE_META_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta tableMeta_; - public boolean hasTableMeta() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta getTableMeta() { - return tableMeta_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder getTableMetaOrBuilder() { - return tableMeta_; - } - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughput reserved_throughput = 2; - public static final int RESERVED_THROUGHPUT_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput reservedThroughput_; - public boolean hasReservedThroughput() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput getReservedThroughput() { - return reservedThroughput_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { - return reservedThroughput_; - } - - private void initFields() { - tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableMeta()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasReservedThroughput()) { - memoizedIsInitialized = 0; - return false; - } - if (!getTableMeta().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - if (!getReservedThroughput().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, tableMeta_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, reservedThroughput_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, tableMeta_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, reservedThroughput_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getTableMetaFieldBuilder(); - getReservedThroughputFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (tableMetaBuilder_ == null) { - tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - } else { - tableMetaBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (reservedThroughputBuilder_ == null) { - reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - } else { - reservedThroughputBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (tableMetaBuilder_ == null) { - result.tableMeta_ = tableMeta_; - } else { - result.tableMeta_ = tableMetaBuilder_.build(); - } - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (reservedThroughputBuilder_ == null) { - result.reservedThroughput_ = reservedThroughput_; - } else { - result.reservedThroughput_ = reservedThroughputBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.getDefaultInstance()) return this; - if (other.hasTableMeta()) { - mergeTableMeta(other.getTableMeta()); - } - if (other.hasReservedThroughput()) { - mergeReservedThroughput(other.getReservedThroughput()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableMeta()) { - - return false; - } - if (!hasReservedThroughput()) { - - return false; - } - if (!getTableMeta().isInitialized()) { - - return false; - } - if (!getReservedThroughput().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.newBuilder(); - if (hasTableMeta()) { - subBuilder.mergeFrom(getTableMeta()); - } - input.readMessage(subBuilder, extensionRegistry); - setTableMeta(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.newBuilder(); - if (hasReservedThroughput()) { - subBuilder.mergeFrom(getReservedThroughput()); - } - input.readMessage(subBuilder, extensionRegistry); - setReservedThroughput(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.TableMeta table_meta = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder> tableMetaBuilder_; - public boolean hasTableMeta() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta getTableMeta() { - if (tableMetaBuilder_ == null) { - return tableMeta_; - } else { - return tableMetaBuilder_.getMessage(); - } - } - public Builder setTableMeta(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta value) { - if (tableMetaBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - tableMeta_ = value; - onChanged(); - } else { - tableMetaBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setTableMeta( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder builderForValue) { - if (tableMetaBuilder_ == null) { - tableMeta_ = builderForValue.build(); - onChanged(); - } else { - tableMetaBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeTableMeta(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta value) { - if (tableMetaBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - tableMeta_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance()) { - tableMeta_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.newBuilder(tableMeta_).mergeFrom(value).buildPartial(); - } else { - tableMeta_ = value; - } - onChanged(); - } else { - tableMetaBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearTableMeta() { - if (tableMetaBuilder_ == null) { - tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - onChanged(); - } else { - tableMetaBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder getTableMetaBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getTableMetaFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder getTableMetaOrBuilder() { - if (tableMetaBuilder_ != null) { - return tableMetaBuilder_.getMessageOrBuilder(); - } else { - return tableMeta_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder> - getTableMetaFieldBuilder() { - if (tableMetaBuilder_ == null) { - tableMetaBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder>( - tableMeta_, - getParentForChildren(), - isClean()); - tableMeta_ = null; - } - return tableMetaBuilder_; - } - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughput reserved_throughput = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder> reservedThroughputBuilder_; - public boolean hasReservedThroughput() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput getReservedThroughput() { - if (reservedThroughputBuilder_ == null) { - return reservedThroughput_; - } else { - return reservedThroughputBuilder_.getMessage(); - } - } - public Builder setReservedThroughput(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput value) { - if (reservedThroughputBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - reservedThroughput_ = value; - onChanged(); - } else { - reservedThroughputBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setReservedThroughput( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder builderForValue) { - if (reservedThroughputBuilder_ == null) { - reservedThroughput_ = builderForValue.build(); - onChanged(); - } else { - reservedThroughputBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeReservedThroughput(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput value) { - if (reservedThroughputBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - reservedThroughput_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance()) { - reservedThroughput_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.newBuilder(reservedThroughput_).mergeFrom(value).buildPartial(); - } else { - reservedThroughput_ = value; - } - onChanged(); - } else { - reservedThroughputBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearReservedThroughput() { - if (reservedThroughputBuilder_ == null) { - reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - onChanged(); - } else { - reservedThroughputBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder getReservedThroughputBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getReservedThroughputFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { - if (reservedThroughputBuilder_ != null) { - return reservedThroughputBuilder_.getMessageOrBuilder(); - } else { - return reservedThroughput_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder> - getReservedThroughputFieldBuilder() { - if (reservedThroughputBuilder_ == null) { - reservedThroughputBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder>( - reservedThroughput_, - getParentForChildren(), - isClean()); - reservedThroughput_ = null; - } - return reservedThroughputBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.CreateTableRequest) - } - - static { - defaultInstance = new CreateTableRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.CreateTableRequest) - } - - public interface CreateTableResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - } - public static final class CreateTableResponse extends - com.google.protobuf.GeneratedMessage - implements CreateTableResponseOrBuilder { - // Use CreateTableResponse.newBuilder() to construct. - private CreateTableResponse(Builder builder) { - super(builder); - } - private CreateTableResponse(boolean noInit) {} - - private static final CreateTableResponse defaultInstance; - public static CreateTableResponse getDefaultInstance() { - return defaultInstance; - } - - public CreateTableResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_fieldAccessorTable; - } - - private void initFields() { - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse(this); - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse.getDefaultInstance()) return this; - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - } - } - } - - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.CreateTableResponse) - } - - static { - defaultInstance = new CreateTableResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.CreateTableResponse) - } - - public interface UpdateTableRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughput reserved_throughput = 2; - boolean hasReservedThroughput(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput getReservedThroughput(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder getReservedThroughputOrBuilder(); - } - public static final class UpdateTableRequest extends - com.google.protobuf.GeneratedMessage - implements UpdateTableRequestOrBuilder { - // Use UpdateTableRequest.newBuilder() to construct. - private UpdateTableRequest(Builder builder) { - super(builder); - } - private UpdateTableRequest(boolean noInit) {} - - private static final UpdateTableRequest defaultInstance; - public static UpdateTableRequest getDefaultInstance() { - return defaultInstance; - } - - public UpdateTableRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughput reserved_throughput = 2; - public static final int RESERVED_THROUGHPUT_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput reservedThroughput_; - public boolean hasReservedThroughput() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput getReservedThroughput() { - return reservedThroughput_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { - return reservedThroughput_; - } - - private void initFields() { - tableName_ = ""; - reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasReservedThroughput()) { - memoizedIsInitialized = 0; - return false; - } - if (!getReservedThroughput().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, reservedThroughput_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, reservedThroughput_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getReservedThroughputFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (reservedThroughputBuilder_ == null) { - reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - } else { - reservedThroughputBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (reservedThroughputBuilder_ == null) { - result.reservedThroughput_ = reservedThroughput_; - } else { - result.reservedThroughput_ = reservedThroughputBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (other.hasReservedThroughput()) { - mergeReservedThroughput(other.getReservedThroughput()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - if (!hasReservedThroughput()) { - - return false; - } - if (!getReservedThroughput().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.newBuilder(); - if (hasReservedThroughput()) { - subBuilder.mergeFrom(getReservedThroughput()); - } - input.readMessage(subBuilder, extensionRegistry); - setReservedThroughput(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughput reserved_throughput = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder> reservedThroughputBuilder_; - public boolean hasReservedThroughput() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput getReservedThroughput() { - if (reservedThroughputBuilder_ == null) { - return reservedThroughput_; - } else { - return reservedThroughputBuilder_.getMessage(); - } - } - public Builder setReservedThroughput(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput value) { - if (reservedThroughputBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - reservedThroughput_ = value; - onChanged(); - } else { - reservedThroughputBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setReservedThroughput( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder builderForValue) { - if (reservedThroughputBuilder_ == null) { - reservedThroughput_ = builderForValue.build(); - onChanged(); - } else { - reservedThroughputBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeReservedThroughput(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput value) { - if (reservedThroughputBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - reservedThroughput_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance()) { - reservedThroughput_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.newBuilder(reservedThroughput_).mergeFrom(value).buildPartial(); - } else { - reservedThroughput_ = value; - } - onChanged(); - } else { - reservedThroughputBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearReservedThroughput() { - if (reservedThroughputBuilder_ == null) { - reservedThroughput_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.getDefaultInstance(); - onChanged(); - } else { - reservedThroughputBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder getReservedThroughputBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getReservedThroughputFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder getReservedThroughputOrBuilder() { - if (reservedThroughputBuilder_ != null) { - return reservedThroughputBuilder_.getMessageOrBuilder(); - } else { - return reservedThroughput_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder> - getReservedThroughputFieldBuilder() { - if (reservedThroughputBuilder_ == null) { - reservedThroughputBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputOrBuilder>( - reservedThroughput_, - getParentForChildren(), - isClean()); - reservedThroughput_ = null; - } - return reservedThroughputBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.UpdateTableRequest) - } - - static { - defaultInstance = new UpdateTableRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.UpdateTableRequest) - } - - public interface UpdateTableResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughputDetails reserved_throughput_details = 1; - boolean hasReservedThroughputDetails(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails getReservedThroughputDetails(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder(); - } - public static final class UpdateTableResponse extends - com.google.protobuf.GeneratedMessage - implements UpdateTableResponseOrBuilder { - // Use UpdateTableResponse.newBuilder() to construct. - private UpdateTableResponse(Builder builder) { - super(builder); - } - private UpdateTableResponse(boolean noInit) {} - - private static final UpdateTableResponse defaultInstance; - public static UpdateTableResponse getDefaultInstance() { - return defaultInstance; - } - - public UpdateTableResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ReservedThroughputDetails reserved_throughput_details = 1; - public static final int RESERVED_THROUGHPUT_DETAILS_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails reservedThroughputDetails_; - public boolean hasReservedThroughputDetails() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails getReservedThroughputDetails() { - return reservedThroughputDetails_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { - return reservedThroughputDetails_; - } - - private void initFields() { - reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasReservedThroughputDetails()) { - memoizedIsInitialized = 0; - return false; - } - if (!getReservedThroughputDetails().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, reservedThroughputDetails_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, reservedThroughputDetails_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getReservedThroughputDetailsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - } else { - reservedThroughputDetailsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (reservedThroughputDetailsBuilder_ == null) { - result.reservedThroughputDetails_ = reservedThroughputDetails_; - } else { - result.reservedThroughputDetails_ = reservedThroughputDetailsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse.getDefaultInstance()) return this; - if (other.hasReservedThroughputDetails()) { - mergeReservedThroughputDetails(other.getReservedThroughputDetails()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasReservedThroughputDetails()) { - - return false; - } - if (!getReservedThroughputDetails().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.newBuilder(); - if (hasReservedThroughputDetails()) { - subBuilder.mergeFrom(getReservedThroughputDetails()); - } - input.readMessage(subBuilder, extensionRegistry); - setReservedThroughputDetails(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughputDetails reserved_throughput_details = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder> reservedThroughputDetailsBuilder_; - public boolean hasReservedThroughputDetails() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails getReservedThroughputDetails() { - if (reservedThroughputDetailsBuilder_ == null) { - return reservedThroughputDetails_; - } else { - return reservedThroughputDetailsBuilder_.getMessage(); - } - } - public Builder setReservedThroughputDetails(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails value) { - if (reservedThroughputDetailsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - reservedThroughputDetails_ = value; - onChanged(); - } else { - reservedThroughputDetailsBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setReservedThroughputDetails( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder builderForValue) { - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetails_ = builderForValue.build(); - onChanged(); - } else { - reservedThroughputDetailsBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeReservedThroughputDetails(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails value) { - if (reservedThroughputDetailsBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - reservedThroughputDetails_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance()) { - reservedThroughputDetails_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.newBuilder(reservedThroughputDetails_).mergeFrom(value).buildPartial(); - } else { - reservedThroughputDetails_ = value; - } - onChanged(); - } else { - reservedThroughputDetailsBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearReservedThroughputDetails() { - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - onChanged(); - } else { - reservedThroughputDetailsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder getReservedThroughputDetailsBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getReservedThroughputDetailsFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { - if (reservedThroughputDetailsBuilder_ != null) { - return reservedThroughputDetailsBuilder_.getMessageOrBuilder(); - } else { - return reservedThroughputDetails_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder> - getReservedThroughputDetailsFieldBuilder() { - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetailsBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder>( - reservedThroughputDetails_, - getParentForChildren(), - isClean()); - reservedThroughputDetails_ = null; - } - return reservedThroughputDetailsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.UpdateTableResponse) - } - - static { - defaultInstance = new UpdateTableResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.UpdateTableResponse) - } - - public interface DescribeTableRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - } - public static final class DescribeTableRequest extends - com.google.protobuf.GeneratedMessage - implements DescribeTableRequestOrBuilder { - // Use DescribeTableRequest.newBuilder() to construct. - private DescribeTableRequest(Builder builder) { - super(builder); - } - private DescribeTableRequest(boolean noInit) {} - - private static final DescribeTableRequest defaultInstance; - public static DescribeTableRequest getDefaultInstance() { - return defaultInstance; - } - - public DescribeTableRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - tableName_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.DescribeTableRequest) - } - - static { - defaultInstance = new DescribeTableRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.DescribeTableRequest) - } - - public interface DescribeTableResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.TableMeta table_meta = 1; - boolean hasTableMeta(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta getTableMeta(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder getTableMetaOrBuilder(); - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughputDetails reserved_throughput_details = 2; - boolean hasReservedThroughputDetails(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails getReservedThroughputDetails(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder(); - } - public static final class DescribeTableResponse extends - com.google.protobuf.GeneratedMessage - implements DescribeTableResponseOrBuilder { - // Use DescribeTableResponse.newBuilder() to construct. - private DescribeTableResponse(Builder builder) { - super(builder); - } - private DescribeTableResponse(boolean noInit) {} - - private static final DescribeTableResponse defaultInstance; - public static DescribeTableResponse getDefaultInstance() { - return defaultInstance; - } - - public DescribeTableResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.TableMeta table_meta = 1; - public static final int TABLE_META_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta tableMeta_; - public boolean hasTableMeta() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta getTableMeta() { - return tableMeta_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder getTableMetaOrBuilder() { - return tableMeta_; - } - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughputDetails reserved_throughput_details = 2; - public static final int RESERVED_THROUGHPUT_DETAILS_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails reservedThroughputDetails_; - public boolean hasReservedThroughputDetails() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails getReservedThroughputDetails() { - return reservedThroughputDetails_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { - return reservedThroughputDetails_; - } - - private void initFields() { - tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableMeta()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasReservedThroughputDetails()) { - memoizedIsInitialized = 0; - return false; - } - if (!getTableMeta().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - if (!getReservedThroughputDetails().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, tableMeta_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, reservedThroughputDetails_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, tableMeta_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, reservedThroughputDetails_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getTableMetaFieldBuilder(); - getReservedThroughputDetailsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (tableMetaBuilder_ == null) { - tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - } else { - tableMetaBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - } else { - reservedThroughputDetailsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (tableMetaBuilder_ == null) { - result.tableMeta_ = tableMeta_; - } else { - result.tableMeta_ = tableMetaBuilder_.build(); - } - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (reservedThroughputDetailsBuilder_ == null) { - result.reservedThroughputDetails_ = reservedThroughputDetails_; - } else { - result.reservedThroughputDetails_ = reservedThroughputDetailsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse.getDefaultInstance()) return this; - if (other.hasTableMeta()) { - mergeTableMeta(other.getTableMeta()); - } - if (other.hasReservedThroughputDetails()) { - mergeReservedThroughputDetails(other.getReservedThroughputDetails()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableMeta()) { - - return false; - } - if (!hasReservedThroughputDetails()) { - - return false; - } - if (!getTableMeta().isInitialized()) { - - return false; - } - if (!getReservedThroughputDetails().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.newBuilder(); - if (hasTableMeta()) { - subBuilder.mergeFrom(getTableMeta()); - } - input.readMessage(subBuilder, extensionRegistry); - setTableMeta(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.newBuilder(); - if (hasReservedThroughputDetails()) { - subBuilder.mergeFrom(getReservedThroughputDetails()); - } - input.readMessage(subBuilder, extensionRegistry); - setReservedThroughputDetails(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.TableMeta table_meta = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder> tableMetaBuilder_; - public boolean hasTableMeta() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta getTableMeta() { - if (tableMetaBuilder_ == null) { - return tableMeta_; - } else { - return tableMetaBuilder_.getMessage(); - } - } - public Builder setTableMeta(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta value) { - if (tableMetaBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - tableMeta_ = value; - onChanged(); - } else { - tableMetaBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setTableMeta( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder builderForValue) { - if (tableMetaBuilder_ == null) { - tableMeta_ = builderForValue.build(); - onChanged(); - } else { - tableMetaBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeTableMeta(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta value) { - if (tableMetaBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - tableMeta_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance()) { - tableMeta_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.newBuilder(tableMeta_).mergeFrom(value).buildPartial(); - } else { - tableMeta_ = value; - } - onChanged(); - } else { - tableMetaBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearTableMeta() { - if (tableMetaBuilder_ == null) { - tableMeta_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.getDefaultInstance(); - onChanged(); - } else { - tableMetaBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder getTableMetaBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getTableMetaFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder getTableMetaOrBuilder() { - if (tableMetaBuilder_ != null) { - return tableMetaBuilder_.getMessageOrBuilder(); - } else { - return tableMeta_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder> - getTableMetaFieldBuilder() { - if (tableMetaBuilder_ == null) { - tableMetaBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMetaOrBuilder>( - tableMeta_, - getParentForChildren(), - isClean()); - tableMeta_ = null; - } - return tableMetaBuilder_; - } - - // required .com.aliyun.openservices.ots.protocol.ReservedThroughputDetails reserved_throughput_details = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder> reservedThroughputDetailsBuilder_; - public boolean hasReservedThroughputDetails() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails getReservedThroughputDetails() { - if (reservedThroughputDetailsBuilder_ == null) { - return reservedThroughputDetails_; - } else { - return reservedThroughputDetailsBuilder_.getMessage(); - } - } - public Builder setReservedThroughputDetails(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails value) { - if (reservedThroughputDetailsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - reservedThroughputDetails_ = value; - onChanged(); - } else { - reservedThroughputDetailsBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setReservedThroughputDetails( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder builderForValue) { - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetails_ = builderForValue.build(); - onChanged(); - } else { - reservedThroughputDetailsBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeReservedThroughputDetails(com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails value) { - if (reservedThroughputDetailsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - reservedThroughputDetails_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance()) { - reservedThroughputDetails_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.newBuilder(reservedThroughputDetails_).mergeFrom(value).buildPartial(); - } else { - reservedThroughputDetails_ = value; - } - onChanged(); - } else { - reservedThroughputDetailsBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearReservedThroughputDetails() { - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetails_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.getDefaultInstance(); - onChanged(); - } else { - reservedThroughputDetailsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder getReservedThroughputDetailsBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getReservedThroughputDetailsFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder getReservedThroughputDetailsOrBuilder() { - if (reservedThroughputDetailsBuilder_ != null) { - return reservedThroughputDetailsBuilder_.getMessageOrBuilder(); - } else { - return reservedThroughputDetails_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder> - getReservedThroughputDetailsFieldBuilder() { - if (reservedThroughputDetailsBuilder_ == null) { - reservedThroughputDetailsBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetailsOrBuilder>( - reservedThroughputDetails_, - getParentForChildren(), - isClean()); - reservedThroughputDetails_ = null; - } - return reservedThroughputDetailsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.DescribeTableResponse) - } - - static { - defaultInstance = new DescribeTableResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.DescribeTableResponse) - } - - public interface ListTableRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - } - public static final class ListTableRequest extends - com.google.protobuf.GeneratedMessage - implements ListTableRequestOrBuilder { - // Use ListTableRequest.newBuilder() to construct. - private ListTableRequest(Builder builder) { - super(builder); - } - private ListTableRequest(boolean noInit) {} - - private static final ListTableRequest defaultInstance; - public static ListTableRequest getDefaultInstance() { - return defaultInstance; - } - - public ListTableRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_fieldAccessorTable; - } - - private void initFields() { - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest(this); - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.getDefaultInstance()) return this; - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - } - } - } - - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ListTableRequest) - } - - static { - defaultInstance = new ListTableRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ListTableRequest) - } - - public interface ListTableResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // repeated string table_names = 1; - java.util.List getTableNamesList(); - int getTableNamesCount(); - String getTableNames(int index); - } - public static final class ListTableResponse extends - com.google.protobuf.GeneratedMessage - implements ListTableResponseOrBuilder { - // Use ListTableResponse.newBuilder() to construct. - private ListTableResponse(Builder builder) { - super(builder); - } - private ListTableResponse(boolean noInit) {} - - private static final ListTableResponse defaultInstance; - public static ListTableResponse getDefaultInstance() { - return defaultInstance; - } - - public ListTableResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_fieldAccessorTable; - } - - // repeated string table_names = 1; - public static final int TABLE_NAMES_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList tableNames_; - public java.util.List - getTableNamesList() { - return tableNames_; - } - public int getTableNamesCount() { - return tableNames_.size(); - } - public String getTableNames(int index) { - return tableNames_.get(index); - } - - private void initFields() { - tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < tableNames_.size(); i++) { - output.writeBytes(1, tableNames_.getByteString(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - { - int dataSize = 0; - for (int i = 0; i < tableNames_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(tableNames_.getByteString(i)); - } - size += dataSize; - size += 1 * getTableNamesList().size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse(this); - int from_bitField0_ = bitField0_; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - tableNames_ = new com.google.protobuf.UnmodifiableLazyStringList( - tableNames_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.tableNames_ = tableNames_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse.getDefaultInstance()) return this; - if (!other.tableNames_.isEmpty()) { - if (tableNames_.isEmpty()) { - tableNames_ = other.tableNames_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureTableNamesIsMutable(); - tableNames_.addAll(other.tableNames_); - } - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - ensureTableNamesIsMutable(); - tableNames_.add(input.readBytes()); - break; - } - } - } - } - - private int bitField0_; - - // repeated string table_names = 1; - private com.google.protobuf.LazyStringList tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureTableNamesIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - tableNames_ = new com.google.protobuf.LazyStringArrayList(tableNames_); - bitField0_ |= 0x00000001; - } - } - public java.util.List - getTableNamesList() { - return java.util.Collections.unmodifiableList(tableNames_); - } - public int getTableNamesCount() { - return tableNames_.size(); - } - public String getTableNames(int index) { - return tableNames_.get(index); - } - public Builder setTableNames( - int index, String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureTableNamesIsMutable(); - tableNames_.set(index, value); - onChanged(); - return this; - } - public Builder addTableNames(String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureTableNamesIsMutable(); - tableNames_.add(value); - onChanged(); - return this; - } - public Builder addAllTableNames( - java.lang.Iterable values) { - ensureTableNamesIsMutable(); - super.addAll(values, tableNames_); - onChanged(); - return this; - } - public Builder clearTableNames() { - tableNames_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - void addTableNames(com.google.protobuf.ByteString value) { - ensureTableNamesIsMutable(); - tableNames_.add(value); - onChanged(); - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ListTableResponse) - } - - static { - defaultInstance = new ListTableResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ListTableResponse) - } - - public interface DeleteTableRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - } - public static final class DeleteTableRequest extends - com.google.protobuf.GeneratedMessage - implements DeleteTableRequestOrBuilder { - // Use DeleteTableRequest.newBuilder() to construct. - private DeleteTableRequest(Builder builder) { - super(builder); - } - private DeleteTableRequest(boolean noInit) {} - - private static final DeleteTableRequest defaultInstance; - public static DeleteTableRequest getDefaultInstance() { - return defaultInstance; - } - - public DeleteTableRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private void initFields() { - tableName_ = ""; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.DeleteTableRequest) - } - - static { - defaultInstance = new DeleteTableRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.DeleteTableRequest) - } - - public interface DeleteTableResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - } - public static final class DeleteTableResponse extends - com.google.protobuf.GeneratedMessage - implements DeleteTableResponseOrBuilder { - // Use DeleteTableResponse.newBuilder() to construct. - private DeleteTableResponse(Builder builder) { - super(builder); - } - private DeleteTableResponse(boolean noInit) {} - - private static final DeleteTableResponse defaultInstance; - public static DeleteTableResponse getDefaultInstance() { - return defaultInstance; - } - - public DeleteTableResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_fieldAccessorTable; - } - - private void initFields() { - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse(this); - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse.getDefaultInstance()) return this; - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - } - } - } - - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.DeleteTableResponse) - } - - static { - defaultInstance = new DeleteTableResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.DeleteTableResponse) - } - - public interface GetRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - - // repeated string columns_to_get = 3; - java.util.List getColumnsToGetList(); - int getColumnsToGetCount(); - String getColumnsToGet(int index); - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 4; - boolean hasFilter(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder(); - } - public static final class GetRowRequest extends - com.google.protobuf.GeneratedMessage - implements GetRowRequestOrBuilder { - // Use GetRowRequest.newBuilder() to construct. - private GetRowRequest(Builder builder) { - super(builder); - } - private GetRowRequest(boolean noInit) {} - - private static final GetRowRequest defaultInstance; - public static GetRowRequest getDefaultInstance() { - return defaultInstance; - } - - public GetRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - public static final int PRIMARY_KEY_FIELD_NUMBER = 2; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - // repeated string columns_to_get = 3; - public static final int COLUMNS_TO_GET_FIELD_NUMBER = 3; - private com.google.protobuf.LazyStringList columnsToGet_; - public java.util.List - getColumnsToGetList() { - return columnsToGet_; - } - public int getColumnsToGetCount() { - return columnsToGet_.size(); - } - public String getColumnsToGet(int index) { - return columnsToGet_.get(index); - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 4; - public static final int FILTER_FIELD_NUMBER = 4; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition filter_; - public boolean hasFilter() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter() { - return filter_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder() { - return filter_; - } - - private void initFields() { - tableName_ = ""; - primaryKey_ = java.util.Collections.emptyList(); - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasFilter()) { - if (!getFilter().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(2, primaryKey_.get(i)); - } - for (int i = 0; i < columnsToGet_.size(); i++) { - output.writeBytes(3, columnsToGet_.getByteString(i)); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(4, filter_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, primaryKey_.get(i)); - } - { - int dataSize = 0; - for (int i = 0; i < columnsToGet_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(columnsToGet_.getByteString(i)); - } - size += dataSize; - size += 1 * getColumnsToGetList().size(); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, filter_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getPrimaryKeyFieldBuilder(); - getFilterFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - primaryKeyBuilder_.clear(); - } - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - if (filterBuilder_ == null) { - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } else { - filterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - columnsToGet_ = new com.google.protobuf.UnmodifiableLazyStringList( - columnsToGet_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.columnsToGet_ = columnsToGet_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000002; - } - if (filterBuilder_ == null) { - result.filter_ = filter_; - } else { - result.filter_ = filterBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - if (!other.columnsToGet_.isEmpty()) { - if (columnsToGet_.isEmpty()) { - columnsToGet_ = other.columnsToGet_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureColumnsToGetIsMutable(); - columnsToGet_.addAll(other.columnsToGet_); - } - onChanged(); - } - if (other.hasFilter()) { - mergeFilter(other.getFilter()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - if (hasFilter()) { - if (!getFilter().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - case 26: { - ensureColumnsToGetIsMutable(); - columnsToGet_.add(input.readBytes()); - break; - } - case 34: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(); - if (hasFilter()) { - subBuilder.mergeFrom(getFilter()); - } - input.readMessage(subBuilder, extensionRegistry); - setFilter(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // repeated string columns_to_get = 3; - private com.google.protobuf.LazyStringList columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureColumnsToGetIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - columnsToGet_ = new com.google.protobuf.LazyStringArrayList(columnsToGet_); - bitField0_ |= 0x00000004; - } - } - public java.util.List - getColumnsToGetList() { - return java.util.Collections.unmodifiableList(columnsToGet_); - } - public int getColumnsToGetCount() { - return columnsToGet_.size(); - } - public String getColumnsToGet(int index) { - return columnsToGet_.get(index); - } - public Builder setColumnsToGet( - int index, String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsToGetIsMutable(); - columnsToGet_.set(index, value); - onChanged(); - return this; - } - public Builder addColumnsToGet(String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsToGetIsMutable(); - columnsToGet_.add(value); - onChanged(); - return this; - } - public Builder addAllColumnsToGet( - java.lang.Iterable values) { - ensureColumnsToGetIsMutable(); - super.addAll(values, columnsToGet_); - onChanged(); - return this; - } - public Builder clearColumnsToGet() { - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - void addColumnsToGet(com.google.protobuf.ByteString value) { - ensureColumnsToGetIsMutable(); - columnsToGet_.add(value); - onChanged(); - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 4; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> filterBuilder_; - public boolean hasFilter() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter() { - if (filterBuilder_ == null) { - return filter_; - } else { - return filterBuilder_.getMessage(); - } - } - public Builder setFilter(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (filterBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - filter_ = value; - onChanged(); - } else { - filterBuilder_.setMessage(value); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder setFilter( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder builderForValue) { - if (filterBuilder_ == null) { - filter_ = builderForValue.build(); - onChanged(); - } else { - filterBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder mergeFilter(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (filterBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008) && - filter_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance()) { - filter_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(filter_).mergeFrom(value).buildPartial(); - } else { - filter_ = value; - } - onChanged(); - } else { - filterBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder clearFilter() { - if (filterBuilder_ == null) { - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - onChanged(); - } else { - filterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder getFilterBuilder() { - bitField0_ |= 0x00000008; - onChanged(); - return getFilterFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder() { - if (filterBuilder_ != null) { - return filterBuilder_.getMessageOrBuilder(); - } else { - return filter_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> - getFilterFieldBuilder() { - if (filterBuilder_ == null) { - filterBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder>( - filter_, - getParentForChildren(), - isClean()); - filter_ = null; - } - return filterBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.GetRowRequest) - } - - static { - defaultInstance = new GetRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.GetRowRequest) - } - - public interface GetRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - boolean hasConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder(); - - // required .com.aliyun.openservices.ots.protocol.Row row = 2; - boolean hasRow(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRow(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowOrBuilder(); - } - public static final class GetRowResponse extends - com.google.protobuf.GeneratedMessage - implements GetRowResponseOrBuilder { - // Use GetRowResponse.newBuilder() to construct. - private GetRowResponse(Builder builder) { - super(builder); - } - private GetRowResponse(boolean noInit) {} - - private static final GetRowResponse defaultInstance; - public static GetRowResponse getDefaultInstance() { - return defaultInstance; - } - - public GetRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - public static final int CONSUMED_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - return consumed_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - return consumed_; - } - - // required .com.aliyun.openservices.ots.protocol.Row row = 2; - public static final int ROW_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Row row_; - public boolean hasRow() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRow() { - return row_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowOrBuilder() { - return row_; - } - - private void initFields() { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasConsumed()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasRow()) { - memoizedIsInitialized = 0; - return false; - } - if (!getConsumed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - if (!getRow().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, consumed_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, row_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, consumed_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, row_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConsumedFieldBuilder(); - getRowFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (rowBuilder_ == null) { - row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - } else { - rowBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (consumedBuilder_ == null) { - result.consumed_ = consumed_; - } else { - result.consumed_ = consumedBuilder_.build(); - } - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (rowBuilder_ == null) { - result.row_ = row_; - } else { - result.row_ = rowBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse.getDefaultInstance()) return this; - if (other.hasConsumed()) { - mergeConsumed(other.getConsumed()); - } - if (other.hasRow()) { - mergeRow(other.getRow()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasConsumed()) { - - return false; - } - if (!hasRow()) { - - return false; - } - if (!getConsumed().isInitialized()) { - - return false; - } - if (!getRow().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(); - if (hasConsumed()) { - subBuilder.mergeFrom(getConsumed()); - } - input.readMessage(subBuilder, extensionRegistry); - setConsumed(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.newBuilder(); - if (hasRow()) { - subBuilder.mergeFrom(getRow()); - } - input.readMessage(subBuilder, extensionRegistry); - setRow(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> consumedBuilder_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - if (consumedBuilder_ == null) { - return consumed_; - } else { - return consumedBuilder_.getMessage(); - } - } - public Builder setConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - consumed_ = value; - onChanged(); - } else { - consumedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setConsumed( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder builderForValue) { - if (consumedBuilder_ == null) { - consumed_ = builderForValue.build(); - onChanged(); - } else { - consumedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - consumed_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) { - consumed_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); - } else { - consumed_ = value; - } - onChanged(); - } else { - consumedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearConsumed() { - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - onChanged(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder getConsumedBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConsumedFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - if (consumedBuilder_ != null) { - return consumedBuilder_.getMessageOrBuilder(); - } else { - return consumed_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> - getConsumedFieldBuilder() { - if (consumedBuilder_ == null) { - consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder>( - consumed_, - getParentForChildren(), - isClean()); - consumed_ = null; - } - return consumedBuilder_; - } - - // required .com.aliyun.openservices.ots.protocol.Row row = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Row row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder> rowBuilder_; - public boolean hasRow() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRow() { - if (rowBuilder_ == null) { - return row_; - } else { - return rowBuilder_.getMessage(); - } - } - public Builder setRow(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row value) { - if (rowBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - row_ = value; - onChanged(); - } else { - rowBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setRow( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder builderForValue) { - if (rowBuilder_ == null) { - row_ = builderForValue.build(); - onChanged(); - } else { - rowBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeRow(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row value) { - if (rowBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - row_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance()) { - row_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.newBuilder(row_).mergeFrom(value).buildPartial(); - } else { - row_ = value; - } - onChanged(); - } else { - rowBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearRow() { - if (rowBuilder_ == null) { - row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - onChanged(); - } else { - rowBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder getRowBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getRowFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowOrBuilder() { - if (rowBuilder_ != null) { - return rowBuilder_.getMessageOrBuilder(); - } else { - return row_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder> - getRowFieldBuilder() { - if (rowBuilder_ == null) { - rowBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder>( - row_, - getParentForChildren(), - isClean()); - row_ = null; - } - return rowBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.GetRowResponse) - } - - static { - defaultInstance = new GetRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.GetRowResponse) - } - - public interface ColumnUpdateOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.OperationType type = 1; - boolean hasType(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType getType(); - - // required string name = 2; - boolean hasName(); - String getName(); - - // optional .com.aliyun.openservices.ots.protocol.ColumnValue value = 3; - boolean hasValue(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getValue(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getValueOrBuilder(); - } - public static final class ColumnUpdate extends - com.google.protobuf.GeneratedMessage - implements ColumnUpdateOrBuilder { - // Use ColumnUpdate.newBuilder() to construct. - private ColumnUpdate(Builder builder) { - super(builder); - } - private ColumnUpdate(boolean noInit) {} - - private static final ColumnUpdate defaultInstance; - public static ColumnUpdate getDefaultInstance() { - return defaultInstance; - } - - public ColumnUpdate getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.OperationType type = 1; - public static final int TYPE_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType type_; - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType getType() { - return type_; - } - - // required string name = 2; - public static final int NAME_FIELD_NUMBER = 2; - private java.lang.Object name_; - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getName() { - java.lang.Object ref = name_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - name_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnValue value = 3; - public static final int VALUE_FIELD_NUMBER = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value_; - public boolean hasValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getValue() { - return value_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getValueOrBuilder() { - return value_; - } - - private void initFields() { - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType.PUT; - name_ = ""; - value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasType()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasName()) { - memoizedIsInitialized = 0; - return false; - } - if (hasValue()) { - if (!getValue().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeEnum(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(3, value_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, type_.getNumber()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, getNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, value_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getValueFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType.PUT; - bitField0_ = (bitField0_ & ~0x00000001); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - if (valueBuilder_ == null) { - value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - } else { - valueBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - if (valueBuilder_ == null) { - result.value_ = value_; - } else { - result.value_ = valueBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.getDefaultInstance()) return this; - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasValue()) { - mergeValue(other.getValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasType()) { - - return false; - } - if (!hasName()) { - - return false; - } - if (hasValue()) { - if (!getValue().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType value = com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = value; - } - break; - } - case 18: { - bitField0_ |= 0x00000002; - name_ = input.readBytes(); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(); - if (hasValue()) { - subBuilder.mergeFrom(getValue()); - } - input.readMessage(subBuilder, extensionRegistry); - setValue(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.OperationType type = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType.PUT; - public boolean hasType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType getType() { - return type_; - } - public Builder setType(com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - type_ = value; - onChanged(); - return this; - } - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000001); - type_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.OperationType.PUT; - onChanged(); - return this; - } - - // required string name = 2; - private java.lang.Object name_ = ""; - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - name_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - name_ = value; - onChanged(); - return this; - } - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000002); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - void setName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - name_ = value; - onChanged(); - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnValue value = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder> valueBuilder_; - public boolean hasValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue getValue() { - if (valueBuilder_ == null) { - return value_; - } else { - return valueBuilder_.getMessage(); - } - } - public Builder setValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - if (valueBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - value_ = value; - onChanged(); - } else { - valueBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder setValue( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder builderForValue) { - if (valueBuilder_ == null) { - value_ = builderForValue.build(); - onChanged(); - } else { - valueBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder mergeValue(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue value) { - if (valueBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - value_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance()) { - value_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.newBuilder(value_).mergeFrom(value).buildPartial(); - } else { - value_ = value; - } - onChanged(); - } else { - valueBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder clearValue() { - if (valueBuilder_ == null) { - value_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.getDefaultInstance(); - onChanged(); - } else { - valueBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder getValueBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getValueFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder getValueOrBuilder() { - if (valueBuilder_ != null) { - return valueBuilder_.getMessageOrBuilder(); - } else { - return value_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder> - getValueFieldBuilder() { - if (valueBuilder_ == null) { - valueBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValueOrBuilder>( - value_, - getParentForChildren(), - isClean()); - value_ = null; - } - return valueBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.ColumnUpdate) - } - - static { - defaultInstance = new ColumnUpdate(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.ColumnUpdate) - } - - public interface UpdateRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - boolean hasCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder(); - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.ColumnUpdate attribute_columns = 4; - java.util.List - getAttributeColumnsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate getAttributeColumns(int index); - int getAttributeColumnsCount(); - java.util.List - getAttributeColumnsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder getAttributeColumnsOrBuilder( - int index); - } - public static final class UpdateRowRequest extends - com.google.protobuf.GeneratedMessage - implements UpdateRowRequestOrBuilder { - // Use UpdateRowRequest.newBuilder() to construct. - private UpdateRowRequest(Builder builder) { - super(builder); - } - private UpdateRowRequest(boolean noInit) {} - - private static final UpdateRowRequest defaultInstance; - public static UpdateRowRequest getDefaultInstance() { - return defaultInstance; - } - - public UpdateRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - public static final int CONDITION_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - return condition_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - return condition_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - public static final int PRIMARY_KEY_FIELD_NUMBER = 3; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnUpdate attribute_columns = 4; - public static final int ATTRIBUTE_COLUMNS_FIELD_NUMBER = 4; - private java.util.List attributeColumns_; - public java.util.List getAttributeColumnsList() { - return attributeColumns_; - } - public java.util.List - getAttributeColumnsOrBuilderList() { - return attributeColumns_; - } - public int getAttributeColumnsCount() { - return attributeColumns_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate getAttributeColumns(int index) { - return attributeColumns_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder getAttributeColumnsOrBuilder( - int index) { - return attributeColumns_.get(index); - } - - private void initFields() { - tableName_ = ""; - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - primaryKey_ = java.util.Collections.emptyList(); - attributeColumns_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasCondition()) { - memoizedIsInitialized = 0; - return false; - } - if (!getCondition().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(3, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - output.writeMessage(4, attributeColumns_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, attributeColumns_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConditionFieldBuilder(); - getPrimaryKeyFieldBuilder(); - getAttributeColumnsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - primaryKeyBuilder_.clear(); - } - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (conditionBuilder_ == null) { - result.condition_ = condition_; - } else { - result.condition_ = conditionBuilder_.build(); - } - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - if (attributeColumnsBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - attributeColumns_ = java.util.Collections.unmodifiableList(attributeColumns_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.attributeColumns_ = attributeColumns_; - } else { - result.attributeColumns_ = attributeColumnsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (other.hasCondition()) { - mergeCondition(other.getCondition()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000004); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - if (attributeColumnsBuilder_ == null) { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumns_.isEmpty()) { - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureAttributeColumnsIsMutable(); - attributeColumns_.addAll(other.attributeColumns_); - } - onChanged(); - } - } else { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumnsBuilder_.isEmpty()) { - attributeColumnsBuilder_.dispose(); - attributeColumnsBuilder_ = null; - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000008); - attributeColumnsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getAttributeColumnsFieldBuilder() : null; - } else { - attributeColumnsBuilder_.addAllMessages(other.attributeColumns_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - if (!hasCondition()) { - - return false; - } - if (!getCondition().isInitialized()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(); - if (hasCondition()) { - subBuilder.mergeFrom(getCondition()); - } - input.readMessage(subBuilder, extensionRegistry); - setCondition(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - case 34: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAttributeColumns(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> conditionBuilder_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - if (conditionBuilder_ == null) { - return condition_; - } else { - return conditionBuilder_.getMessage(); - } - } - public Builder setCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - condition_ = value; - onChanged(); - } else { - conditionBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setCondition( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder builderForValue) { - if (conditionBuilder_ == null) { - condition_ = builderForValue.build(); - onChanged(); - } else { - conditionBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - condition_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance()) { - condition_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); - } else { - condition_ = value; - } - onChanged(); - } else { - conditionBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearCondition() { - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - onChanged(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder getConditionBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getConditionFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - if (conditionBuilder_ != null) { - return conditionBuilder_.getMessageOrBuilder(); - } else { - return condition_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> - getConditionFieldBuilder() { - if (conditionBuilder_ == null) { - conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder>( - condition_, - getParentForChildren(), - isClean()); - condition_ = null; - } - return conditionBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnUpdate attribute_columns = 4; - private java.util.List attributeColumns_ = - java.util.Collections.emptyList(); - private void ensureAttributeColumnsIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - attributeColumns_ = new java.util.ArrayList(attributeColumns_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder> attributeColumnsBuilder_; - - public java.util.List getAttributeColumnsList() { - if (attributeColumnsBuilder_ == null) { - return java.util.Collections.unmodifiableList(attributeColumns_); - } else { - return attributeColumnsBuilder_.getMessageList(); - } - } - public int getAttributeColumnsCount() { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.size(); - } else { - return attributeColumnsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate getAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); - } else { - return attributeColumnsBuilder_.getMessage(index); - } - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(value); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addAttributeColumns( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllAttributeColumns( - java.lang.Iterable values) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - super.addAll(values, attributeColumns_); - onChanged(); - } else { - attributeColumnsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearAttributeColumns() { - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - public Builder removeAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.remove(index); - onChanged(); - } else { - attributeColumnsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder getAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder getAttributeColumnsOrBuilder( - int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); } else { - return attributeColumnsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getAttributeColumnsOrBuilderList() { - if (attributeColumnsBuilder_ != null) { - return attributeColumnsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(attributeColumns_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder addAttributeColumnsBuilder() { - return getAttributeColumnsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder addAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.getDefaultInstance()); - } - public java.util.List - getAttributeColumnsBuilderList() { - return getAttributeColumnsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder> - getAttributeColumnsFieldBuilder() { - if (attributeColumnsBuilder_ == null) { - attributeColumnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder>( - attributeColumns_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - attributeColumns_ = null; - } - return attributeColumnsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.UpdateRowRequest) - } - - static { - defaultInstance = new UpdateRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.UpdateRowRequest) - } - - public interface UpdateRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - boolean hasConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder(); - } - public static final class UpdateRowResponse extends - com.google.protobuf.GeneratedMessage - implements UpdateRowResponseOrBuilder { - // Use UpdateRowResponse.newBuilder() to construct. - private UpdateRowResponse(Builder builder) { - super(builder); - } - private UpdateRowResponse(boolean noInit) {} - - private static final UpdateRowResponse defaultInstance; - public static UpdateRowResponse getDefaultInstance() { - return defaultInstance; - } - - public UpdateRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - public static final int CONSUMED_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - return consumed_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - return consumed_; - } - - private void initFields() { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasConsumed()) { - memoizedIsInitialized = 0; - return false; - } - if (!getConsumed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, consumed_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, consumed_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConsumedFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (consumedBuilder_ == null) { - result.consumed_ = consumed_; - } else { - result.consumed_ = consumedBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse.getDefaultInstance()) return this; - if (other.hasConsumed()) { - mergeConsumed(other.getConsumed()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasConsumed()) { - - return false; - } - if (!getConsumed().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(); - if (hasConsumed()) { - subBuilder.mergeFrom(getConsumed()); - } - input.readMessage(subBuilder, extensionRegistry); - setConsumed(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> consumedBuilder_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - if (consumedBuilder_ == null) { - return consumed_; - } else { - return consumedBuilder_.getMessage(); - } - } - public Builder setConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - consumed_ = value; - onChanged(); - } else { - consumedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setConsumed( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder builderForValue) { - if (consumedBuilder_ == null) { - consumed_ = builderForValue.build(); - onChanged(); - } else { - consumedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - consumed_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) { - consumed_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); - } else { - consumed_ = value; - } - onChanged(); - } else { - consumedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearConsumed() { - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - onChanged(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder getConsumedBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConsumedFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - if (consumedBuilder_ != null) { - return consumedBuilder_.getMessageOrBuilder(); - } else { - return consumed_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> - getConsumedFieldBuilder() { - if (consumedBuilder_ == null) { - consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder>( - consumed_, - getParentForChildren(), - isClean()); - consumed_ = null; - } - return consumedBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.UpdateRowResponse) - } - - static { - defaultInstance = new UpdateRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.UpdateRowResponse) - } - - public interface PutRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - boolean hasCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder(); - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 4; - java.util.List - getAttributeColumnsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index); - int getAttributeColumnsCount(); - java.util.List - getAttributeColumnsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index); - } - public static final class PutRowRequest extends - com.google.protobuf.GeneratedMessage - implements PutRowRequestOrBuilder { - // Use PutRowRequest.newBuilder() to construct. - private PutRowRequest(Builder builder) { - super(builder); - } - private PutRowRequest(boolean noInit) {} - - private static final PutRowRequest defaultInstance; - public static PutRowRequest getDefaultInstance() { - return defaultInstance; - } - - public PutRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - public static final int CONDITION_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - return condition_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - return condition_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - public static final int PRIMARY_KEY_FIELD_NUMBER = 3; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 4; - public static final int ATTRIBUTE_COLUMNS_FIELD_NUMBER = 4; - private java.util.List attributeColumns_; - public java.util.List getAttributeColumnsList() { - return attributeColumns_; - } - public java.util.List - getAttributeColumnsOrBuilderList() { - return attributeColumns_; - } - public int getAttributeColumnsCount() { - return attributeColumns_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index) { - return attributeColumns_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index) { - return attributeColumns_.get(index); - } - - private void initFields() { - tableName_ = ""; - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - primaryKey_ = java.util.Collections.emptyList(); - attributeColumns_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasCondition()) { - memoizedIsInitialized = 0; - return false; - } - if (!getCondition().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(3, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - output.writeMessage(4, attributeColumns_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, attributeColumns_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConditionFieldBuilder(); - getPrimaryKeyFieldBuilder(); - getAttributeColumnsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - primaryKeyBuilder_.clear(); - } - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (conditionBuilder_ == null) { - result.condition_ = condition_; - } else { - result.condition_ = conditionBuilder_.build(); - } - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - if (attributeColumnsBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - attributeColumns_ = java.util.Collections.unmodifiableList(attributeColumns_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.attributeColumns_ = attributeColumns_; - } else { - result.attributeColumns_ = attributeColumnsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (other.hasCondition()) { - mergeCondition(other.getCondition()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000004); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - if (attributeColumnsBuilder_ == null) { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumns_.isEmpty()) { - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureAttributeColumnsIsMutable(); - attributeColumns_.addAll(other.attributeColumns_); - } - onChanged(); - } - } else { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumnsBuilder_.isEmpty()) { - attributeColumnsBuilder_.dispose(); - attributeColumnsBuilder_ = null; - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000008); - attributeColumnsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getAttributeColumnsFieldBuilder() : null; - } else { - attributeColumnsBuilder_.addAllMessages(other.attributeColumns_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - if (!hasCondition()) { - - return false; - } - if (!getCondition().isInitialized()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(); - if (hasCondition()) { - subBuilder.mergeFrom(getCondition()); - } - input.readMessage(subBuilder, extensionRegistry); - setCondition(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - case 34: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAttributeColumns(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> conditionBuilder_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - if (conditionBuilder_ == null) { - return condition_; - } else { - return conditionBuilder_.getMessage(); - } - } - public Builder setCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - condition_ = value; - onChanged(); - } else { - conditionBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setCondition( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder builderForValue) { - if (conditionBuilder_ == null) { - condition_ = builderForValue.build(); - onChanged(); - } else { - conditionBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - condition_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance()) { - condition_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); - } else { - condition_ = value; - } - onChanged(); - } else { - conditionBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearCondition() { - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - onChanged(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder getConditionBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getConditionFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - if (conditionBuilder_ != null) { - return conditionBuilder_.getMessageOrBuilder(); - } else { - return condition_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> - getConditionFieldBuilder() { - if (conditionBuilder_ == null) { - conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder>( - condition_, - getParentForChildren(), - isClean()); - condition_ = null; - } - return conditionBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 4; - private java.util.List attributeColumns_ = - java.util.Collections.emptyList(); - private void ensureAttributeColumnsIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - attributeColumns_ = new java.util.ArrayList(attributeColumns_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> attributeColumnsBuilder_; - - public java.util.List getAttributeColumnsList() { - if (attributeColumnsBuilder_ == null) { - return java.util.Collections.unmodifiableList(attributeColumns_); - } else { - return attributeColumnsBuilder_.getMessageList(); - } - } - public int getAttributeColumnsCount() { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.size(); - } else { - return attributeColumnsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); - } else { - return attributeColumnsBuilder_.getMessage(index); - } - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(value); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addAttributeColumns( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllAttributeColumns( - java.lang.Iterable values) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - super.addAll(values, attributeColumns_); - onChanged(); - } else { - attributeColumnsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearAttributeColumns() { - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - public Builder removeAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.remove(index); - onChanged(); - } else { - attributeColumnsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); } else { - return attributeColumnsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getAttributeColumnsOrBuilderList() { - if (attributeColumnsBuilder_ != null) { - return attributeColumnsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(attributeColumns_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addAttributeColumnsBuilder() { - return getAttributeColumnsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getAttributeColumnsBuilderList() { - return getAttributeColumnsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getAttributeColumnsFieldBuilder() { - if (attributeColumnsBuilder_ == null) { - attributeColumnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - attributeColumns_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - attributeColumns_ = null; - } - return attributeColumnsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.PutRowRequest) - } - - static { - defaultInstance = new PutRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.PutRowRequest) - } - - public interface PutRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - boolean hasConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder(); - } - public static final class PutRowResponse extends - com.google.protobuf.GeneratedMessage - implements PutRowResponseOrBuilder { - // Use PutRowResponse.newBuilder() to construct. - private PutRowResponse(Builder builder) { - super(builder); - } - private PutRowResponse(boolean noInit) {} - - private static final PutRowResponse defaultInstance; - public static PutRowResponse getDefaultInstance() { - return defaultInstance; - } - - public PutRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - public static final int CONSUMED_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - return consumed_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - return consumed_; - } - - private void initFields() { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasConsumed()) { - memoizedIsInitialized = 0; - return false; - } - if (!getConsumed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, consumed_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, consumed_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConsumedFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (consumedBuilder_ == null) { - result.consumed_ = consumed_; - } else { - result.consumed_ = consumedBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse.getDefaultInstance()) return this; - if (other.hasConsumed()) { - mergeConsumed(other.getConsumed()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasConsumed()) { - - return false; - } - if (!getConsumed().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(); - if (hasConsumed()) { - subBuilder.mergeFrom(getConsumed()); - } - input.readMessage(subBuilder, extensionRegistry); - setConsumed(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> consumedBuilder_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - if (consumedBuilder_ == null) { - return consumed_; - } else { - return consumedBuilder_.getMessage(); - } - } - public Builder setConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - consumed_ = value; - onChanged(); - } else { - consumedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setConsumed( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder builderForValue) { - if (consumedBuilder_ == null) { - consumed_ = builderForValue.build(); - onChanged(); - } else { - consumedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - consumed_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) { - consumed_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); - } else { - consumed_ = value; - } - onChanged(); - } else { - consumedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearConsumed() { - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - onChanged(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder getConsumedBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConsumedFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - if (consumedBuilder_ != null) { - return consumedBuilder_.getMessageOrBuilder(); - } else { - return consumed_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> - getConsumedFieldBuilder() { - if (consumedBuilder_ == null) { - consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder>( - consumed_, - getParentForChildren(), - isClean()); - consumed_ = null; - } - return consumedBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.PutRowResponse) - } - - static { - defaultInstance = new PutRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.PutRowResponse) - } - - public interface DeleteRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - boolean hasCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder(); - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - } - public static final class DeleteRowRequest extends - com.google.protobuf.GeneratedMessage - implements DeleteRowRequestOrBuilder { - // Use DeleteRowRequest.newBuilder() to construct. - private DeleteRowRequest(Builder builder) { - super(builder); - } - private DeleteRowRequest(boolean noInit) {} - - private static final DeleteRowRequest defaultInstance; - public static DeleteRowRequest getDefaultInstance() { - return defaultInstance; - } - - public DeleteRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - public static final int CONDITION_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - return condition_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - return condition_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - public static final int PRIMARY_KEY_FIELD_NUMBER = 3; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - private void initFields() { - tableName_ = ""; - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - primaryKey_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasCondition()) { - memoizedIsInitialized = 0; - return false; - } - if (!getCondition().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(3, primaryKey_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, primaryKey_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConditionFieldBuilder(); - getPrimaryKeyFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (conditionBuilder_ == null) { - result.condition_ = condition_; - } else { - result.condition_ = conditionBuilder_.build(); - } - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (other.hasCondition()) { - mergeCondition(other.getCondition()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000004); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - if (!hasCondition()) { - - return false; - } - if (!getCondition().isInitialized()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(); - if (hasCondition()) { - subBuilder.mergeFrom(getCondition()); - } - input.readMessage(subBuilder, extensionRegistry); - setCondition(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> conditionBuilder_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - if (conditionBuilder_ == null) { - return condition_; - } else { - return conditionBuilder_.getMessage(); - } - } - public Builder setCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - condition_ = value; - onChanged(); - } else { - conditionBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setCondition( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder builderForValue) { - if (conditionBuilder_ == null) { - condition_ = builderForValue.build(); - onChanged(); - } else { - conditionBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - condition_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance()) { - condition_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); - } else { - condition_ = value; - } - onChanged(); - } else { - conditionBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearCondition() { - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - onChanged(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder getConditionBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getConditionFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - if (conditionBuilder_ != null) { - return conditionBuilder_.getMessageOrBuilder(); - } else { - return condition_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> - getConditionFieldBuilder() { - if (conditionBuilder_ == null) { - conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder>( - condition_, - getParentForChildren(), - isClean()); - condition_ = null; - } - return conditionBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 3; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.DeleteRowRequest) - } - - static { - defaultInstance = new DeleteRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.DeleteRowRequest) - } - - public interface DeleteRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - boolean hasConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder(); - } - public static final class DeleteRowResponse extends - com.google.protobuf.GeneratedMessage - implements DeleteRowResponseOrBuilder { - // Use DeleteRowResponse.newBuilder() to construct. - private DeleteRowResponse(Builder builder) { - super(builder); - } - private DeleteRowResponse(boolean noInit) {} - - private static final DeleteRowResponse defaultInstance; - public static DeleteRowResponse getDefaultInstance() { - return defaultInstance; - } - - public DeleteRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - public static final int CONSUMED_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - return consumed_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - return consumed_; - } - - private void initFields() { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasConsumed()) { - memoizedIsInitialized = 0; - return false; - } - if (!getConsumed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, consumed_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, consumed_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConsumedFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (consumedBuilder_ == null) { - result.consumed_ = consumed_; - } else { - result.consumed_ = consumedBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse.getDefaultInstance()) return this; - if (other.hasConsumed()) { - mergeConsumed(other.getConsumed()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasConsumed()) { - - return false; - } - if (!getConsumed().isInitialized()) { - - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(); - if (hasConsumed()) { - subBuilder.mergeFrom(getConsumed()); - } - input.readMessage(subBuilder, extensionRegistry); - setConsumed(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> consumedBuilder_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - if (consumedBuilder_ == null) { - return consumed_; - } else { - return consumedBuilder_.getMessage(); - } - } - public Builder setConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - consumed_ = value; - onChanged(); - } else { - consumedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setConsumed( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder builderForValue) { - if (consumedBuilder_ == null) { - consumed_ = builderForValue.build(); - onChanged(); - } else { - consumedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - consumed_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) { - consumed_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); - } else { - consumed_ = value; - } - onChanged(); - } else { - consumedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearConsumed() { - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - onChanged(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder getConsumedBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConsumedFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - if (consumedBuilder_ != null) { - return consumedBuilder_.getMessageOrBuilder(); - } else { - return consumed_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> - getConsumedFieldBuilder() { - if (consumedBuilder_ == null) { - consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder>( - consumed_, - getParentForChildren(), - isClean()); - consumed_ = null; - } - return consumedBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.DeleteRowResponse) - } - - static { - defaultInstance = new DeleteRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.DeleteRowResponse) - } - - public interface RowInBatchGetRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 1; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - } - public static final class RowInBatchGetRowRequest extends - com.google.protobuf.GeneratedMessage - implements RowInBatchGetRowRequestOrBuilder { - // Use RowInBatchGetRowRequest.newBuilder() to construct. - private RowInBatchGetRowRequest(Builder builder) { - super(builder); - } - private RowInBatchGetRowRequest(boolean noInit) {} - - private static final RowInBatchGetRowRequest defaultInstance; - public static RowInBatchGetRowRequest getDefaultInstance() { - return defaultInstance; - } - - public RowInBatchGetRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_fieldAccessorTable; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 1; - public static final int PRIMARY_KEY_FIELD_NUMBER = 1; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - private void initFields() { - primaryKey_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(1, primaryKey_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, primaryKey_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getPrimaryKeyFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest(this); - int from_bitField0_ = bitField0_; - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.getDefaultInstance()) return this; - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000001); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 1; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.RowInBatchGetRowRequest) - } - - static { - defaultInstance = new RowInBatchGetRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.RowInBatchGetRowRequest) - } - - public interface TableInBatchGetRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchGetRowRequest rows = 2; - java.util.List - getRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest getRows(int index); - int getRowsCount(); - java.util.List - getRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequestOrBuilder getRowsOrBuilder( - int index); - - // repeated string columns_to_get = 3; - java.util.List getColumnsToGetList(); - int getColumnsToGetCount(); - String getColumnsToGet(int index); - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 4; - boolean hasFilter(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder(); - } - public static final class TableInBatchGetRowRequest extends - com.google.protobuf.GeneratedMessage - implements TableInBatchGetRowRequestOrBuilder { - // Use TableInBatchGetRowRequest.newBuilder() to construct. - private TableInBatchGetRowRequest(Builder builder) { - super(builder); - } - private TableInBatchGetRowRequest(boolean noInit) {} - - private static final TableInBatchGetRowRequest defaultInstance; - public static TableInBatchGetRowRequest getDefaultInstance() { - return defaultInstance; - } - - public TableInBatchGetRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchGetRowRequest rows = 2; - public static final int ROWS_FIELD_NUMBER = 2; - private java.util.List rows_; - public java.util.List getRowsList() { - return rows_; - } - public java.util.List - getRowsOrBuilderList() { - return rows_; - } - public int getRowsCount() { - return rows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest getRows(int index) { - return rows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequestOrBuilder getRowsOrBuilder( - int index) { - return rows_.get(index); - } - - // repeated string columns_to_get = 3; - public static final int COLUMNS_TO_GET_FIELD_NUMBER = 3; - private com.google.protobuf.LazyStringList columnsToGet_; - public java.util.List - getColumnsToGetList() { - return columnsToGet_; - } - public int getColumnsToGetCount() { - return columnsToGet_.size(); - } - public String getColumnsToGet(int index) { - return columnsToGet_.get(index); - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 4; - public static final int FILTER_FIELD_NUMBER = 4; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition filter_; - public boolean hasFilter() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter() { - return filter_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder() { - return filter_; - } - - private void initFields() { - tableName_ = ""; - rows_ = java.util.Collections.emptyList(); - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getRowsCount(); i++) { - if (!getRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasFilter()) { - if (!getFilter().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - for (int i = 0; i < rows_.size(); i++) { - output.writeMessage(2, rows_.get(i)); - } - for (int i = 0; i < columnsToGet_.size(); i++) { - output.writeBytes(3, columnsToGet_.getByteString(i)); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(4, filter_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - for (int i = 0; i < rows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, rows_.get(i)); - } - { - int dataSize = 0; - for (int i = 0; i < columnsToGet_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(columnsToGet_.getByteString(i)); - } - size += dataSize; - size += 1 * getColumnsToGetList().size(); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, filter_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getRowsFieldBuilder(); - getFilterFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - rowsBuilder_.clear(); - } - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - if (filterBuilder_ == null) { - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } else { - filterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (rowsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - rows_ = java.util.Collections.unmodifiableList(rows_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.rows_ = rows_; - } else { - result.rows_ = rowsBuilder_.build(); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - columnsToGet_ = new com.google.protobuf.UnmodifiableLazyStringList( - columnsToGet_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.columnsToGet_ = columnsToGet_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000002; - } - if (filterBuilder_ == null) { - result.filter_ = filter_; - } else { - result.filter_ = filterBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (rowsBuilder_ == null) { - if (!other.rows_.isEmpty()) { - if (rows_.isEmpty()) { - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureRowsIsMutable(); - rows_.addAll(other.rows_); - } - onChanged(); - } - } else { - if (!other.rows_.isEmpty()) { - if (rowsBuilder_.isEmpty()) { - rowsBuilder_.dispose(); - rowsBuilder_ = null; - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000002); - rowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getRowsFieldBuilder() : null; - } else { - rowsBuilder_.addAllMessages(other.rows_); - } - } - } - if (!other.columnsToGet_.isEmpty()) { - if (columnsToGet_.isEmpty()) { - columnsToGet_ = other.columnsToGet_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureColumnsToGetIsMutable(); - columnsToGet_.addAll(other.columnsToGet_); - } - onChanged(); - } - if (other.hasFilter()) { - mergeFilter(other.getFilter()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - for (int i = 0; i < getRowsCount(); i++) { - if (!getRows(i).isInitialized()) { - - return false; - } - } - if (hasFilter()) { - if (!getFilter().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addRows(subBuilder.buildPartial()); - break; - } - case 26: { - ensureColumnsToGetIsMutable(); - columnsToGet_.add(input.readBytes()); - break; - } - case 34: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(); - if (hasFilter()) { - subBuilder.mergeFrom(getFilter()); - } - input.readMessage(subBuilder, extensionRegistry); - setFilter(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchGetRowRequest rows = 2; - private java.util.List rows_ = - java.util.Collections.emptyList(); - private void ensureRowsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - rows_ = new java.util.ArrayList(rows_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequestOrBuilder> rowsBuilder_; - - public java.util.List getRowsList() { - if (rowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(rows_); - } else { - return rowsBuilder_.getMessageList(); - } - } - public int getRowsCount() { - if (rowsBuilder_ == null) { - return rows_.size(); - } else { - return rowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest getRows(int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); - } else { - return rowsBuilder_.getMessage(index); - } - } - public Builder setRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.set(index, value); - onChanged(); - } else { - rowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.set(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(value); - onChanged(); - } else { - rowsBuilder_.addMessage(value); - } - return this; - } - public Builder addRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(index, value); - onChanged(); - } else { - rowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllRows( - java.lang.Iterable values) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - super.addAll(values, rows_); - onChanged(); - } else { - rowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearRows() { - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - rowsBuilder_.clear(); - } - return this; - } - public Builder removeRows(int index) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.remove(index); - onChanged(); - } else { - rowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder getRowsBuilder( - int index) { - return getRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequestOrBuilder getRowsOrBuilder( - int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); } else { - return rowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getRowsOrBuilderList() { - if (rowsBuilder_ != null) { - return rowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(rows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder addRowsBuilder() { - return getRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder addRowsBuilder( - int index) { - return getRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.getDefaultInstance()); - } - public java.util.List - getRowsBuilderList() { - return getRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequestOrBuilder> - getRowsFieldBuilder() { - if (rowsBuilder_ == null) { - rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequestOrBuilder>( - rows_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - rows_ = null; - } - return rowsBuilder_; - } - - // repeated string columns_to_get = 3; - private com.google.protobuf.LazyStringList columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureColumnsToGetIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - columnsToGet_ = new com.google.protobuf.LazyStringArrayList(columnsToGet_); - bitField0_ |= 0x00000004; - } - } - public java.util.List - getColumnsToGetList() { - return java.util.Collections.unmodifiableList(columnsToGet_); - } - public int getColumnsToGetCount() { - return columnsToGet_.size(); - } - public String getColumnsToGet(int index) { - return columnsToGet_.get(index); - } - public Builder setColumnsToGet( - int index, String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsToGetIsMutable(); - columnsToGet_.set(index, value); - onChanged(); - return this; - } - public Builder addColumnsToGet(String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsToGetIsMutable(); - columnsToGet_.add(value); - onChanged(); - return this; - } - public Builder addAllColumnsToGet( - java.lang.Iterable values) { - ensureColumnsToGetIsMutable(); - super.addAll(values, columnsToGet_); - onChanged(); - return this; - } - public Builder clearColumnsToGet() { - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - void addColumnsToGet(com.google.protobuf.ByteString value) { - ensureColumnsToGetIsMutable(); - columnsToGet_.add(value); - onChanged(); - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 4; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> filterBuilder_; - public boolean hasFilter() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter() { - if (filterBuilder_ == null) { - return filter_; - } else { - return filterBuilder_.getMessage(); - } - } - public Builder setFilter(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (filterBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - filter_ = value; - onChanged(); - } else { - filterBuilder_.setMessage(value); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder setFilter( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder builderForValue) { - if (filterBuilder_ == null) { - filter_ = builderForValue.build(); - onChanged(); - } else { - filterBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder mergeFilter(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (filterBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008) && - filter_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance()) { - filter_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(filter_).mergeFrom(value).buildPartial(); - } else { - filter_ = value; - } - onChanged(); - } else { - filterBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder clearFilter() { - if (filterBuilder_ == null) { - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - onChanged(); - } else { - filterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder getFilterBuilder() { - bitField0_ |= 0x00000008; - onChanged(); - return getFilterFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder() { - if (filterBuilder_ != null) { - return filterBuilder_.getMessageOrBuilder(); - } else { - return filter_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> - getFilterFieldBuilder() { - if (filterBuilder_ == null) { - filterBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder>( - filter_, - getParentForChildren(), - isClean()); - filter_ = null; - } - return filterBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.TableInBatchGetRowRequest) - } - - static { - defaultInstance = new TableInBatchGetRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.TableInBatchGetRowRequest) - } - - public interface BatchGetRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchGetRowRequest tables = 1; - java.util.List - getTablesList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest getTables(int index); - int getTablesCount(); - java.util.List - getTablesOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequestOrBuilder getTablesOrBuilder( - int index); - } - public static final class BatchGetRowRequest extends - com.google.protobuf.GeneratedMessage - implements BatchGetRowRequestOrBuilder { - // Use BatchGetRowRequest.newBuilder() to construct. - private BatchGetRowRequest(Builder builder) { - super(builder); - } - private BatchGetRowRequest(boolean noInit) {} - - private static final BatchGetRowRequest defaultInstance; - public static BatchGetRowRequest getDefaultInstance() { - return defaultInstance; - } - - public BatchGetRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_fieldAccessorTable; - } - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchGetRowRequest tables = 1; - public static final int TABLES_FIELD_NUMBER = 1; - private java.util.List tables_; - public java.util.List getTablesList() { - return tables_; - } - public java.util.List - getTablesOrBuilderList() { - return tables_; - } - public int getTablesCount() { - return tables_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest getTables(int index) { - return tables_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequestOrBuilder getTablesOrBuilder( - int index) { - return tables_.get(index); - } - - private void initFields() { - tables_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < tables_.size(); i++) { - output.writeMessage(1, tables_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < tables_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, tables_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getTablesFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - tablesBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest(this); - int from_bitField0_ = bitField0_; - if (tablesBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = java.util.Collections.unmodifiableList(tables_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.tables_ = tables_; - } else { - result.tables_ = tablesBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.getDefaultInstance()) return this; - if (tablesBuilder_ == null) { - if (!other.tables_.isEmpty()) { - if (tables_.isEmpty()) { - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureTablesIsMutable(); - tables_.addAll(other.tables_); - } - onChanged(); - } - } else { - if (!other.tables_.isEmpty()) { - if (tablesBuilder_.isEmpty()) { - tablesBuilder_.dispose(); - tablesBuilder_ = null; - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - tablesBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getTablesFieldBuilder() : null; - } else { - tablesBuilder_.addAllMessages(other.tables_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addTables(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchGetRowRequest tables = 1; - private java.util.List tables_ = - java.util.Collections.emptyList(); - private void ensureTablesIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = new java.util.ArrayList(tables_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequestOrBuilder> tablesBuilder_; - - public java.util.List getTablesList() { - if (tablesBuilder_ == null) { - return java.util.Collections.unmodifiableList(tables_); - } else { - return tablesBuilder_.getMessageList(); - } - } - public int getTablesCount() { - if (tablesBuilder_ == null) { - return tables_.size(); - } else { - return tablesBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest getTables(int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); - } else { - return tablesBuilder_.getMessage(index); - } - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.set(index, value); - onChanged(); - } else { - tablesBuilder_.setMessage(index, value); - } - return this; - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.set(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addTables(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(value); - onChanged(); - } else { - tablesBuilder_.addMessage(value); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(index, value); - onChanged(); - } else { - tablesBuilder_.addMessage(index, value); - } - return this; - } - public Builder addTables( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllTables( - java.lang.Iterable values) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - super.addAll(values, tables_); - onChanged(); - } else { - tablesBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearTables() { - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - tablesBuilder_.clear(); - } - return this; - } - public Builder removeTables(int index) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.remove(index); - onChanged(); - } else { - tablesBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder getTablesBuilder( - int index) { - return getTablesFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequestOrBuilder getTablesOrBuilder( - int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); } else { - return tablesBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getTablesOrBuilderList() { - if (tablesBuilder_ != null) { - return tablesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(tables_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder addTablesBuilder() { - return getTablesFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder addTablesBuilder( - int index) { - return getTablesFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.getDefaultInstance()); - } - public java.util.List - getTablesBuilderList() { - return getTablesFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequestOrBuilder> - getTablesFieldBuilder() { - if (tablesBuilder_ == null) { - tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequestOrBuilder>( - tables_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - tables_ = null; - } - return tablesBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.BatchGetRowRequest) - } - - static { - defaultInstance = new BatchGetRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.BatchGetRowRequest) - } - - public interface RowInBatchGetRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required bool is_ok = 1 [default = true]; - boolean hasIsOk(); - boolean getIsOk(); - - // optional .com.aliyun.openservices.ots.protocol.Error error = 2; - boolean hasError(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error getError(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder getErrorOrBuilder(); - - // optional .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 3; - boolean hasConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder(); - - // optional .com.aliyun.openservices.ots.protocol.Row row = 4; - boolean hasRow(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRow(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowOrBuilder(); - } - public static final class RowInBatchGetRowResponse extends - com.google.protobuf.GeneratedMessage - implements RowInBatchGetRowResponseOrBuilder { - // Use RowInBatchGetRowResponse.newBuilder() to construct. - private RowInBatchGetRowResponse(Builder builder) { - super(builder); - } - private RowInBatchGetRowResponse(boolean noInit) {} - - private static final RowInBatchGetRowResponse defaultInstance; - public static RowInBatchGetRowResponse getDefaultInstance() { - return defaultInstance; - } - - public RowInBatchGetRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required bool is_ok = 1 [default = true]; - public static final int IS_OK_FIELD_NUMBER = 1; - private boolean isOk_; - public boolean hasIsOk() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public boolean getIsOk() { - return isOk_; - } - - // optional .com.aliyun.openservices.ots.protocol.Error error = 2; - public static final int ERROR_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Error error_; - public boolean hasError() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error getError() { - return error_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder getErrorOrBuilder() { - return error_; - } - - // optional .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 3; - public static final int CONSUMED_FIELD_NUMBER = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - return consumed_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - return consumed_; - } - - // optional .com.aliyun.openservices.ots.protocol.Row row = 4; - public static final int ROW_FIELD_NUMBER = 4; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Row row_; - public boolean hasRow() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRow() { - return row_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowOrBuilder() { - return row_; - } - - private void initFields() { - isOk_ = true; - error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasIsOk()) { - memoizedIsInitialized = 0; - return false; - } - if (hasError()) { - if (!getError().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasConsumed()) { - if (!getConsumed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasRow()) { - if (!getRow().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBool(1, isOk_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, error_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(3, consumed_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeMessage(4, row_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(1, isOk_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, error_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, consumed_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, row_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getErrorFieldBuilder(); - getConsumedFieldBuilder(); - getRowFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - isOk_ = true; - bitField0_ = (bitField0_ & ~0x00000001); - if (errorBuilder_ == null) { - error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - } else { - errorBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - if (rowBuilder_ == null) { - row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - } else { - rowBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.isOk_ = isOk_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (errorBuilder_ == null) { - result.error_ = error_; - } else { - result.error_ = errorBuilder_.build(); - } - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - if (consumedBuilder_ == null) { - result.consumed_ = consumed_; - } else { - result.consumed_ = consumedBuilder_.build(); - } - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - if (rowBuilder_ == null) { - result.row_ = row_; - } else { - result.row_ = rowBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.getDefaultInstance()) return this; - if (other.hasIsOk()) { - setIsOk(other.getIsOk()); - } - if (other.hasError()) { - mergeError(other.getError()); - } - if (other.hasConsumed()) { - mergeConsumed(other.getConsumed()); - } - if (other.hasRow()) { - mergeRow(other.getRow()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasIsOk()) { - - return false; - } - if (hasError()) { - if (!getError().isInitialized()) { - - return false; - } - } - if (hasConsumed()) { - if (!getConsumed().isInitialized()) { - - return false; - } - } - if (hasRow()) { - if (!getRow().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - isOk_ = input.readBool(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.newBuilder(); - if (hasError()) { - subBuilder.mergeFrom(getError()); - } - input.readMessage(subBuilder, extensionRegistry); - setError(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(); - if (hasConsumed()) { - subBuilder.mergeFrom(getConsumed()); - } - input.readMessage(subBuilder, extensionRegistry); - setConsumed(subBuilder.buildPartial()); - break; - } - case 34: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.newBuilder(); - if (hasRow()) { - subBuilder.mergeFrom(getRow()); - } - input.readMessage(subBuilder, extensionRegistry); - setRow(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required bool is_ok = 1 [default = true]; - private boolean isOk_ = true; - public boolean hasIsOk() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public boolean getIsOk() { - return isOk_; - } - public Builder setIsOk(boolean value) { - bitField0_ |= 0x00000001; - isOk_ = value; - onChanged(); - return this; - } - public Builder clearIsOk() { - bitField0_ = (bitField0_ & ~0x00000001); - isOk_ = true; - onChanged(); - return this; - } - - // optional .com.aliyun.openservices.ots.protocol.Error error = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Error error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error, com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder> errorBuilder_; - public boolean hasError() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error getError() { - if (errorBuilder_ == null) { - return error_; - } else { - return errorBuilder_.getMessage(); - } - } - public Builder setError(com.aliyun.openservices.ots.protocol.OtsProtocol2.Error value) { - if (errorBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - error_ = value; - onChanged(); - } else { - errorBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setError( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder builderForValue) { - if (errorBuilder_ == null) { - error_ = builderForValue.build(); - onChanged(); - } else { - errorBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeError(com.aliyun.openservices.ots.protocol.OtsProtocol2.Error value) { - if (errorBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - error_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance()) { - error_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.newBuilder(error_).mergeFrom(value).buildPartial(); - } else { - error_ = value; - } - onChanged(); - } else { - errorBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearError() { - if (errorBuilder_ == null) { - error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - onChanged(); - } else { - errorBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder getErrorBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getErrorFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder getErrorOrBuilder() { - if (errorBuilder_ != null) { - return errorBuilder_.getMessageOrBuilder(); - } else { - return error_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error, com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder> - getErrorFieldBuilder() { - if (errorBuilder_ == null) { - errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error, com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder>( - error_, - getParentForChildren(), - isClean()); - error_ = null; - } - return errorBuilder_; - } - - // optional .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> consumedBuilder_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - if (consumedBuilder_ == null) { - return consumed_; - } else { - return consumedBuilder_.getMessage(); - } - } - public Builder setConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - consumed_ = value; - onChanged(); - } else { - consumedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder setConsumed( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder builderForValue) { - if (consumedBuilder_ == null) { - consumed_ = builderForValue.build(); - onChanged(); - } else { - consumedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder mergeConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - consumed_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) { - consumed_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); - } else { - consumed_ = value; - } - onChanged(); - } else { - consumedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder clearConsumed() { - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - onChanged(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder getConsumedBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getConsumedFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - if (consumedBuilder_ != null) { - return consumedBuilder_.getMessageOrBuilder(); - } else { - return consumed_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> - getConsumedFieldBuilder() { - if (consumedBuilder_ == null) { - consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder>( - consumed_, - getParentForChildren(), - isClean()); - consumed_ = null; - } - return consumedBuilder_; - } - - // optional .com.aliyun.openservices.ots.protocol.Row row = 4; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Row row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder> rowBuilder_; - public boolean hasRow() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRow() { - if (rowBuilder_ == null) { - return row_; - } else { - return rowBuilder_.getMessage(); - } - } - public Builder setRow(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row value) { - if (rowBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - row_ = value; - onChanged(); - } else { - rowBuilder_.setMessage(value); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder setRow( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder builderForValue) { - if (rowBuilder_ == null) { - row_ = builderForValue.build(); - onChanged(); - } else { - rowBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder mergeRow(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row value) { - if (rowBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008) && - row_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance()) { - row_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.newBuilder(row_).mergeFrom(value).buildPartial(); - } else { - row_ = value; - } - onChanged(); - } else { - rowBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000008; - return this; - } - public Builder clearRow() { - if (rowBuilder_ == null) { - row_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance(); - onChanged(); - } else { - rowBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder getRowBuilder() { - bitField0_ |= 0x00000008; - onChanged(); - return getRowFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowOrBuilder() { - if (rowBuilder_ != null) { - return rowBuilder_.getMessageOrBuilder(); - } else { - return row_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder> - getRowFieldBuilder() { - if (rowBuilder_ == null) { - rowBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder>( - row_, - getParentForChildren(), - isClean()); - row_ = null; - } - return rowBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.RowInBatchGetRowResponse) - } - - static { - defaultInstance = new RowInBatchGetRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.RowInBatchGetRowResponse) - } - - public interface TableInBatchGetRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchGetRowResponse rows = 2; - java.util.List - getRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse getRows(int index); - int getRowsCount(); - java.util.List - getRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponseOrBuilder getRowsOrBuilder( - int index); - } - public static final class TableInBatchGetRowResponse extends - com.google.protobuf.GeneratedMessage - implements TableInBatchGetRowResponseOrBuilder { - // Use TableInBatchGetRowResponse.newBuilder() to construct. - private TableInBatchGetRowResponse(Builder builder) { - super(builder); - } - private TableInBatchGetRowResponse(boolean noInit) {} - - private static final TableInBatchGetRowResponse defaultInstance; - public static TableInBatchGetRowResponse getDefaultInstance() { - return defaultInstance; - } - - public TableInBatchGetRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchGetRowResponse rows = 2; - public static final int ROWS_FIELD_NUMBER = 2; - private java.util.List rows_; - public java.util.List getRowsList() { - return rows_; - } - public java.util.List - getRowsOrBuilderList() { - return rows_; - } - public int getRowsCount() { - return rows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse getRows(int index) { - return rows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponseOrBuilder getRowsOrBuilder( - int index) { - return rows_.get(index); - } - - private void initFields() { - tableName_ = ""; - rows_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getRowsCount(); i++) { - if (!getRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - for (int i = 0; i < rows_.size(); i++) { - output.writeMessage(2, rows_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - for (int i = 0; i < rows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, rows_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getRowsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - rowsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (rowsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - rows_ = java.util.Collections.unmodifiableList(rows_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.rows_ = rows_; - } else { - result.rows_ = rowsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (rowsBuilder_ == null) { - if (!other.rows_.isEmpty()) { - if (rows_.isEmpty()) { - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureRowsIsMutable(); - rows_.addAll(other.rows_); - } - onChanged(); - } - } else { - if (!other.rows_.isEmpty()) { - if (rowsBuilder_.isEmpty()) { - rowsBuilder_.dispose(); - rowsBuilder_ = null; - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000002); - rowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getRowsFieldBuilder() : null; - } else { - rowsBuilder_.addAllMessages(other.rows_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - for (int i = 0; i < getRowsCount(); i++) { - if (!getRows(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addRows(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchGetRowResponse rows = 2; - private java.util.List rows_ = - java.util.Collections.emptyList(); - private void ensureRowsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - rows_ = new java.util.ArrayList(rows_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponseOrBuilder> rowsBuilder_; - - public java.util.List getRowsList() { - if (rowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(rows_); - } else { - return rowsBuilder_.getMessageList(); - } - } - public int getRowsCount() { - if (rowsBuilder_ == null) { - return rows_.size(); - } else { - return rowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse getRows(int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); - } else { - return rowsBuilder_.getMessage(index); - } - } - public Builder setRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.set(index, value); - onChanged(); - } else { - rowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.set(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(value); - onChanged(); - } else { - rowsBuilder_.addMessage(value); - } - return this; - } - public Builder addRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(index, value); - onChanged(); - } else { - rowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllRows( - java.lang.Iterable values) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - super.addAll(values, rows_); - onChanged(); - } else { - rowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearRows() { - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - rowsBuilder_.clear(); - } - return this; - } - public Builder removeRows(int index) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.remove(index); - onChanged(); - } else { - rowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder getRowsBuilder( - int index) { - return getRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponseOrBuilder getRowsOrBuilder( - int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); } else { - return rowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getRowsOrBuilderList() { - if (rowsBuilder_ != null) { - return rowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(rows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder addRowsBuilder() { - return getRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder addRowsBuilder( - int index) { - return getRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.getDefaultInstance()); - } - public java.util.List - getRowsBuilderList() { - return getRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponseOrBuilder> - getRowsFieldBuilder() { - if (rowsBuilder_ == null) { - rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponseOrBuilder>( - rows_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - rows_ = null; - } - return rowsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.TableInBatchGetRowResponse) - } - - static { - defaultInstance = new TableInBatchGetRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.TableInBatchGetRowResponse) - } - - public interface BatchGetRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchGetRowResponse tables = 1; - java.util.List - getTablesList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse getTables(int index); - int getTablesCount(); - java.util.List - getTablesOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponseOrBuilder getTablesOrBuilder( - int index); - } - public static final class BatchGetRowResponse extends - com.google.protobuf.GeneratedMessage - implements BatchGetRowResponseOrBuilder { - // Use BatchGetRowResponse.newBuilder() to construct. - private BatchGetRowResponse(Builder builder) { - super(builder); - } - private BatchGetRowResponse(boolean noInit) {} - - private static final BatchGetRowResponse defaultInstance; - public static BatchGetRowResponse getDefaultInstance() { - return defaultInstance; - } - - public BatchGetRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_fieldAccessorTable; - } - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchGetRowResponse tables = 1; - public static final int TABLES_FIELD_NUMBER = 1; - private java.util.List tables_; - public java.util.List getTablesList() { - return tables_; - } - public java.util.List - getTablesOrBuilderList() { - return tables_; - } - public int getTablesCount() { - return tables_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse getTables(int index) { - return tables_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponseOrBuilder getTablesOrBuilder( - int index) { - return tables_.get(index); - } - - private void initFields() { - tables_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < tables_.size(); i++) { - output.writeMessage(1, tables_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < tables_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, tables_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getTablesFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - tablesBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse(this); - int from_bitField0_ = bitField0_; - if (tablesBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = java.util.Collections.unmodifiableList(tables_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.tables_ = tables_; - } else { - result.tables_ = tablesBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse.getDefaultInstance()) return this; - if (tablesBuilder_ == null) { - if (!other.tables_.isEmpty()) { - if (tables_.isEmpty()) { - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureTablesIsMutable(); - tables_.addAll(other.tables_); - } - onChanged(); - } - } else { - if (!other.tables_.isEmpty()) { - if (tablesBuilder_.isEmpty()) { - tablesBuilder_.dispose(); - tablesBuilder_ = null; - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - tablesBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getTablesFieldBuilder() : null; - } else { - tablesBuilder_.addAllMessages(other.tables_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addTables(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchGetRowResponse tables = 1; - private java.util.List tables_ = - java.util.Collections.emptyList(); - private void ensureTablesIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = new java.util.ArrayList(tables_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponseOrBuilder> tablesBuilder_; - - public java.util.List getTablesList() { - if (tablesBuilder_ == null) { - return java.util.Collections.unmodifiableList(tables_); - } else { - return tablesBuilder_.getMessageList(); - } - } - public int getTablesCount() { - if (tablesBuilder_ == null) { - return tables_.size(); - } else { - return tablesBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse getTables(int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); - } else { - return tablesBuilder_.getMessage(index); - } - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.set(index, value); - onChanged(); - } else { - tablesBuilder_.setMessage(index, value); - } - return this; - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.set(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addTables(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(value); - onChanged(); - } else { - tablesBuilder_.addMessage(value); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(index, value); - onChanged(); - } else { - tablesBuilder_.addMessage(index, value); - } - return this; - } - public Builder addTables( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllTables( - java.lang.Iterable values) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - super.addAll(values, tables_); - onChanged(); - } else { - tablesBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearTables() { - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - tablesBuilder_.clear(); - } - return this; - } - public Builder removeTables(int index) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.remove(index); - onChanged(); - } else { - tablesBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder getTablesBuilder( - int index) { - return getTablesFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponseOrBuilder getTablesOrBuilder( - int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); } else { - return tablesBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getTablesOrBuilderList() { - if (tablesBuilder_ != null) { - return tablesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(tables_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder addTablesBuilder() { - return getTablesFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder addTablesBuilder( - int index) { - return getTablesFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.getDefaultInstance()); - } - public java.util.List - getTablesBuilderList() { - return getTablesFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponseOrBuilder> - getTablesFieldBuilder() { - if (tablesBuilder_ == null) { - tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponseOrBuilder>( - tables_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - tables_ = null; - } - return tablesBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.BatchGetRowResponse) - } - - static { - defaultInstance = new BatchGetRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.BatchGetRowResponse) - } - - public interface PutRowInBatchWriteRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - boolean hasCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder(); - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 3; - java.util.List - getAttributeColumnsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index); - int getAttributeColumnsCount(); - java.util.List - getAttributeColumnsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index); - } - public static final class PutRowInBatchWriteRowRequest extends - com.google.protobuf.GeneratedMessage - implements PutRowInBatchWriteRowRequestOrBuilder { - // Use PutRowInBatchWriteRowRequest.newBuilder() to construct. - private PutRowInBatchWriteRowRequest(Builder builder) { - super(builder); - } - private PutRowInBatchWriteRowRequest(boolean noInit) {} - - private static final PutRowInBatchWriteRowRequest defaultInstance; - public static PutRowInBatchWriteRowRequest getDefaultInstance() { - return defaultInstance; - } - - public PutRowInBatchWriteRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - public static final int CONDITION_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - return condition_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - return condition_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - public static final int PRIMARY_KEY_FIELD_NUMBER = 2; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 3; - public static final int ATTRIBUTE_COLUMNS_FIELD_NUMBER = 3; - private java.util.List attributeColumns_; - public java.util.List getAttributeColumnsList() { - return attributeColumns_; - } - public java.util.List - getAttributeColumnsOrBuilderList() { - return attributeColumns_; - } - public int getAttributeColumnsCount() { - return attributeColumns_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index) { - return attributeColumns_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index) { - return attributeColumns_.get(index); - } - - private void initFields() { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - primaryKey_ = java.util.Collections.emptyList(); - attributeColumns_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCondition()) { - memoizedIsInitialized = 0; - return false; - } - if (!getCondition().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(2, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - output.writeMessage(3, attributeColumns_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, attributeColumns_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConditionFieldBuilder(); - getPrimaryKeyFieldBuilder(); - getAttributeColumnsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - primaryKeyBuilder_.clear(); - } - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (conditionBuilder_ == null) { - result.condition_ = condition_; - } else { - result.condition_ = conditionBuilder_.build(); - } - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - if (attributeColumnsBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - attributeColumns_ = java.util.Collections.unmodifiableList(attributeColumns_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.attributeColumns_ = attributeColumns_; - } else { - result.attributeColumns_ = attributeColumnsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.getDefaultInstance()) return this; - if (other.hasCondition()) { - mergeCondition(other.getCondition()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - if (attributeColumnsBuilder_ == null) { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumns_.isEmpty()) { - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureAttributeColumnsIsMutable(); - attributeColumns_.addAll(other.attributeColumns_); - } - onChanged(); - } - } else { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumnsBuilder_.isEmpty()) { - attributeColumnsBuilder_.dispose(); - attributeColumnsBuilder_ = null; - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000004); - attributeColumnsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getAttributeColumnsFieldBuilder() : null; - } else { - attributeColumnsBuilder_.addAllMessages(other.attributeColumns_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCondition()) { - - return false; - } - if (!getCondition().isInitialized()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(); - if (hasCondition()) { - subBuilder.mergeFrom(getCondition()); - } - input.readMessage(subBuilder, extensionRegistry); - setCondition(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAttributeColumns(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> conditionBuilder_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - if (conditionBuilder_ == null) { - return condition_; - } else { - return conditionBuilder_.getMessage(); - } - } - public Builder setCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - condition_ = value; - onChanged(); - } else { - conditionBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setCondition( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder builderForValue) { - if (conditionBuilder_ == null) { - condition_ = builderForValue.build(); - onChanged(); - } else { - conditionBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - condition_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance()) { - condition_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); - } else { - condition_ = value; - } - onChanged(); - } else { - conditionBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearCondition() { - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - onChanged(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder getConditionBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConditionFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - if (conditionBuilder_ != null) { - return conditionBuilder_.getMessageOrBuilder(); - } else { - return condition_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> - getConditionFieldBuilder() { - if (conditionBuilder_ == null) { - conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder>( - condition_, - getParentForChildren(), - isClean()); - condition_ = null; - } - return conditionBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column attribute_columns = 3; - private java.util.List attributeColumns_ = - java.util.Collections.emptyList(); - private void ensureAttributeColumnsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - attributeColumns_ = new java.util.ArrayList(attributeColumns_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> attributeColumnsBuilder_; - - public java.util.List getAttributeColumnsList() { - if (attributeColumnsBuilder_ == null) { - return java.util.Collections.unmodifiableList(attributeColumns_); - } else { - return attributeColumnsBuilder_.getMessageList(); - } - } - public int getAttributeColumnsCount() { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.size(); - } else { - return attributeColumnsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); - } else { - return attributeColumnsBuilder_.getMessage(index); - } - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(value); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addAttributeColumns( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllAttributeColumns( - java.lang.Iterable values) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - super.addAll(values, attributeColumns_); - onChanged(); - } else { - attributeColumnsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearAttributeColumns() { - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - public Builder removeAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.remove(index); - onChanged(); - } else { - attributeColumnsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getAttributeColumnsOrBuilder( - int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); } else { - return attributeColumnsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getAttributeColumnsOrBuilderList() { - if (attributeColumnsBuilder_ != null) { - return attributeColumnsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(attributeColumns_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addAttributeColumnsBuilder() { - return getAttributeColumnsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getAttributeColumnsBuilderList() { - return getAttributeColumnsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getAttributeColumnsFieldBuilder() { - if (attributeColumnsBuilder_ == null) { - attributeColumnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - attributeColumns_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - attributeColumns_ = null; - } - return attributeColumnsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.PutRowInBatchWriteRowRequest) - } - - static { - defaultInstance = new PutRowInBatchWriteRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.PutRowInBatchWriteRowRequest) - } - - public interface UpdateRowInBatchWriteRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - boolean hasCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder(); - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.ColumnUpdate attribute_columns = 3; - java.util.List - getAttributeColumnsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate getAttributeColumns(int index); - int getAttributeColumnsCount(); - java.util.List - getAttributeColumnsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder getAttributeColumnsOrBuilder( - int index); - } - public static final class UpdateRowInBatchWriteRowRequest extends - com.google.protobuf.GeneratedMessage - implements UpdateRowInBatchWriteRowRequestOrBuilder { - // Use UpdateRowInBatchWriteRowRequest.newBuilder() to construct. - private UpdateRowInBatchWriteRowRequest(Builder builder) { - super(builder); - } - private UpdateRowInBatchWriteRowRequest(boolean noInit) {} - - private static final UpdateRowInBatchWriteRowRequest defaultInstance; - public static UpdateRowInBatchWriteRowRequest getDefaultInstance() { - return defaultInstance; - } - - public UpdateRowInBatchWriteRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - public static final int CONDITION_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - return condition_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - return condition_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - public static final int PRIMARY_KEY_FIELD_NUMBER = 2; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnUpdate attribute_columns = 3; - public static final int ATTRIBUTE_COLUMNS_FIELD_NUMBER = 3; - private java.util.List attributeColumns_; - public java.util.List getAttributeColumnsList() { - return attributeColumns_; - } - public java.util.List - getAttributeColumnsOrBuilderList() { - return attributeColumns_; - } - public int getAttributeColumnsCount() { - return attributeColumns_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate getAttributeColumns(int index) { - return attributeColumns_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder getAttributeColumnsOrBuilder( - int index) { - return attributeColumns_.get(index); - } - - private void initFields() { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - primaryKey_ = java.util.Collections.emptyList(); - attributeColumns_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCondition()) { - memoizedIsInitialized = 0; - return false; - } - if (!getCondition().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(2, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - output.writeMessage(3, attributeColumns_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, primaryKey_.get(i)); - } - for (int i = 0; i < attributeColumns_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, attributeColumns_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConditionFieldBuilder(); - getPrimaryKeyFieldBuilder(); - getAttributeColumnsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - primaryKeyBuilder_.clear(); - } - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (conditionBuilder_ == null) { - result.condition_ = condition_; - } else { - result.condition_ = conditionBuilder_.build(); - } - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - if (attributeColumnsBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - attributeColumns_ = java.util.Collections.unmodifiableList(attributeColumns_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.attributeColumns_ = attributeColumns_; - } else { - result.attributeColumns_ = attributeColumnsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.getDefaultInstance()) return this; - if (other.hasCondition()) { - mergeCondition(other.getCondition()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - if (attributeColumnsBuilder_ == null) { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumns_.isEmpty()) { - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureAttributeColumnsIsMutable(); - attributeColumns_.addAll(other.attributeColumns_); - } - onChanged(); - } - } else { - if (!other.attributeColumns_.isEmpty()) { - if (attributeColumnsBuilder_.isEmpty()) { - attributeColumnsBuilder_.dispose(); - attributeColumnsBuilder_ = null; - attributeColumns_ = other.attributeColumns_; - bitField0_ = (bitField0_ & ~0x00000004); - attributeColumnsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getAttributeColumnsFieldBuilder() : null; - } else { - attributeColumnsBuilder_.addAllMessages(other.attributeColumns_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCondition()) { - - return false; - } - if (!getCondition().isInitialized()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getAttributeColumnsCount(); i++) { - if (!getAttributeColumns(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(); - if (hasCondition()) { - subBuilder.mergeFrom(getCondition()); - } - input.readMessage(subBuilder, extensionRegistry); - setCondition(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAttributeColumns(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> conditionBuilder_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - if (conditionBuilder_ == null) { - return condition_; - } else { - return conditionBuilder_.getMessage(); - } - } - public Builder setCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - condition_ = value; - onChanged(); - } else { - conditionBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setCondition( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder builderForValue) { - if (conditionBuilder_ == null) { - condition_ = builderForValue.build(); - onChanged(); - } else { - conditionBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - condition_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance()) { - condition_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); - } else { - condition_ = value; - } - onChanged(); - } else { - conditionBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearCondition() { - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - onChanged(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder getConditionBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConditionFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - if (conditionBuilder_ != null) { - return conditionBuilder_.getMessageOrBuilder(); - } else { - return condition_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> - getConditionFieldBuilder() { - if (conditionBuilder_ == null) { - conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder>( - condition_, - getParentForChildren(), - isClean()); - condition_ = null; - } - return conditionBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.ColumnUpdate attribute_columns = 3; - private java.util.List attributeColumns_ = - java.util.Collections.emptyList(); - private void ensureAttributeColumnsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - attributeColumns_ = new java.util.ArrayList(attributeColumns_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder> attributeColumnsBuilder_; - - public java.util.List getAttributeColumnsList() { - if (attributeColumnsBuilder_ == null) { - return java.util.Collections.unmodifiableList(attributeColumns_); - } else { - return attributeColumnsBuilder_.getMessageList(); - } - } - public int getAttributeColumnsCount() { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.size(); - } else { - return attributeColumnsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate getAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); - } else { - return attributeColumnsBuilder_.getMessage(index); - } - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.set(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(value); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate value) { - if (attributeColumnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, value); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addAttributeColumns( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addAttributeColumns( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder builderForValue) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.add(index, builderForValue.build()); - onChanged(); - } else { - attributeColumnsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllAttributeColumns( - java.lang.Iterable values) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - super.addAll(values, attributeColumns_); - onChanged(); - } else { - attributeColumnsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearAttributeColumns() { - if (attributeColumnsBuilder_ == null) { - attributeColumns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - attributeColumnsBuilder_.clear(); - } - return this; - } - public Builder removeAttributeColumns(int index) { - if (attributeColumnsBuilder_ == null) { - ensureAttributeColumnsIsMutable(); - attributeColumns_.remove(index); - onChanged(); - } else { - attributeColumnsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder getAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder getAttributeColumnsOrBuilder( - int index) { - if (attributeColumnsBuilder_ == null) { - return attributeColumns_.get(index); } else { - return attributeColumnsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getAttributeColumnsOrBuilderList() { - if (attributeColumnsBuilder_ != null) { - return attributeColumnsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(attributeColumns_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder addAttributeColumnsBuilder() { - return getAttributeColumnsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder addAttributeColumnsBuilder( - int index) { - return getAttributeColumnsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.getDefaultInstance()); - } - public java.util.List - getAttributeColumnsBuilderList() { - return getAttributeColumnsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder> - getAttributeColumnsFieldBuilder() { - if (attributeColumnsBuilder_ == null) { - attributeColumnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdateOrBuilder>( - attributeColumns_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - attributeColumns_ = null; - } - return attributeColumnsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.UpdateRowInBatchWriteRowRequest) - } - - static { - defaultInstance = new UpdateRowInBatchWriteRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.UpdateRowInBatchWriteRowRequest) - } - - public interface DeleteRowInBatchWriteRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - boolean hasCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder(); - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - java.util.List - getPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index); - int getPrimaryKeyCount(); - java.util.List - getPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index); - } - public static final class DeleteRowInBatchWriteRowRequest extends - com.google.protobuf.GeneratedMessage - implements DeleteRowInBatchWriteRowRequestOrBuilder { - // Use DeleteRowInBatchWriteRowRequest.newBuilder() to construct. - private DeleteRowInBatchWriteRowRequest(Builder builder) { - super(builder); - } - private DeleteRowInBatchWriteRowRequest(boolean noInit) {} - - private static final DeleteRowInBatchWriteRowRequest defaultInstance; - public static DeleteRowInBatchWriteRowRequest getDefaultInstance() { - return defaultInstance; - } - - public DeleteRowInBatchWriteRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - public static final int CONDITION_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - return condition_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - return condition_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - public static final int PRIMARY_KEY_FIELD_NUMBER = 2; - private java.util.List primaryKey_; - public java.util.List getPrimaryKeyList() { - return primaryKey_; - } - public java.util.List - getPrimaryKeyOrBuilderList() { - return primaryKey_; - } - public int getPrimaryKeyCount() { - return primaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - return primaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - return primaryKey_.get(index); - } - - private void initFields() { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - primaryKey_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasCondition()) { - memoizedIsInitialized = 0; - return false; - } - if (!getCondition().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - output.writeMessage(2, primaryKey_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, condition_); - } - for (int i = 0; i < primaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, primaryKey_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConditionFieldBuilder(); - getPrimaryKeyFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (conditionBuilder_ == null) { - result.condition_ = condition_; - } else { - result.condition_ = conditionBuilder_.build(); - } - if (primaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = java.util.Collections.unmodifiableList(primaryKey_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.primaryKey_ = primaryKey_; - } else { - result.primaryKey_ = primaryKeyBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.getDefaultInstance()) return this; - if (other.hasCondition()) { - mergeCondition(other.getCondition()); - } - if (primaryKeyBuilder_ == null) { - if (!other.primaryKey_.isEmpty()) { - if (primaryKey_.isEmpty()) { - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensurePrimaryKeyIsMutable(); - primaryKey_.addAll(other.primaryKey_); - } - onChanged(); - } - } else { - if (!other.primaryKey_.isEmpty()) { - if (primaryKeyBuilder_.isEmpty()) { - primaryKeyBuilder_.dispose(); - primaryKeyBuilder_ = null; - primaryKey_ = other.primaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - primaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPrimaryKeyFieldBuilder() : null; - } else { - primaryKeyBuilder_.addAllMessages(other.primaryKey_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasCondition()) { - - return false; - } - if (!getCondition().isInitialized()) { - - return false; - } - for (int i = 0; i < getPrimaryKeyCount(); i++) { - if (!getPrimaryKey(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(); - if (hasCondition()) { - subBuilder.mergeFrom(getCondition()); - } - input.readMessage(subBuilder, extensionRegistry); - setCondition(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPrimaryKey(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.Condition condition = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> conditionBuilder_; - public boolean hasCondition() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition getCondition() { - if (conditionBuilder_ == null) { - return condition_; - } else { - return conditionBuilder_.getMessage(); - } - } - public Builder setCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - condition_ = value; - onChanged(); - } else { - conditionBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setCondition( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder builderForValue) { - if (conditionBuilder_ == null) { - condition_ = builderForValue.build(); - onChanged(); - } else { - conditionBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeCondition(com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition value) { - if (conditionBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - condition_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance()) { - condition_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.newBuilder(condition_).mergeFrom(value).buildPartial(); - } else { - condition_ = value; - } - onChanged(); - } else { - conditionBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearCondition() { - if (conditionBuilder_ == null) { - condition_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.getDefaultInstance(); - onChanged(); - } else { - conditionBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder getConditionBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConditionFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder getConditionOrBuilder() { - if (conditionBuilder_ != null) { - return conditionBuilder_.getMessageOrBuilder(); - } else { - return condition_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder> - getConditionFieldBuilder() { - if (conditionBuilder_ == null) { - conditionBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition, com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConditionOrBuilder>( - condition_, - getParentForChildren(), - isClean()); - condition_ = null; - } - return conditionBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column primary_key = 2; - private java.util.List primaryKey_ = - java.util.Collections.emptyList(); - private void ensurePrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - primaryKey_ = new java.util.ArrayList(primaryKey_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> primaryKeyBuilder_; - - public java.util.List getPrimaryKeyList() { - if (primaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(primaryKey_); - } else { - return primaryKeyBuilder_.getMessageList(); - } - } - public int getPrimaryKeyCount() { - if (primaryKeyBuilder_ == null) { - return primaryKey_.size(); - } else { - return primaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getPrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); - } else { - return primaryKeyBuilder_.getMessage(index); - } - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, value); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (primaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, value); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - primaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPrimaryKey( - java.lang.Iterable values) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - super.addAll(values, primaryKey_); - onChanged(); - } else { - primaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPrimaryKey() { - if (primaryKeyBuilder_ == null) { - primaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - primaryKeyBuilder_.clear(); - } - return this; - } - public Builder removePrimaryKey(int index) { - if (primaryKeyBuilder_ == null) { - ensurePrimaryKeyIsMutable(); - primaryKey_.remove(index); - onChanged(); - } else { - primaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getPrimaryKeyOrBuilder( - int index) { - if (primaryKeyBuilder_ == null) { - return primaryKey_.get(index); } else { - return primaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPrimaryKeyOrBuilderList() { - if (primaryKeyBuilder_ != null) { - return primaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(primaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder() { - return getPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addPrimaryKeyBuilder( - int index) { - return getPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getPrimaryKeyBuilderList() { - return getPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getPrimaryKeyFieldBuilder() { - if (primaryKeyBuilder_ == null) { - primaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - primaryKey_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - primaryKey_ = null; - } - return primaryKeyBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.DeleteRowInBatchWriteRowRequest) - } - - static { - defaultInstance = new DeleteRowInBatchWriteRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.DeleteRowInBatchWriteRowRequest) - } - - public interface TableInBatchWriteRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // repeated .com.aliyun.openservices.ots.protocol.PutRowInBatchWriteRowRequest put_rows = 2; - java.util.List - getPutRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest getPutRows(int index); - int getPutRowsCount(); - java.util.List - getPutRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequestOrBuilder getPutRowsOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.UpdateRowInBatchWriteRowRequest update_rows = 3; - java.util.List - getUpdateRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest getUpdateRows(int index); - int getUpdateRowsCount(); - java.util.List - getUpdateRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequestOrBuilder getUpdateRowsOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.DeleteRowInBatchWriteRowRequest delete_rows = 4; - java.util.List - getDeleteRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest getDeleteRows(int index); - int getDeleteRowsCount(); - java.util.List - getDeleteRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequestOrBuilder getDeleteRowsOrBuilder( - int index); - } - public static final class TableInBatchWriteRowRequest extends - com.google.protobuf.GeneratedMessage - implements TableInBatchWriteRowRequestOrBuilder { - // Use TableInBatchWriteRowRequest.newBuilder() to construct. - private TableInBatchWriteRowRequest(Builder builder) { - super(builder); - } - private TableInBatchWriteRowRequest(boolean noInit) {} - - private static final TableInBatchWriteRowRequest defaultInstance; - public static TableInBatchWriteRowRequest getDefaultInstance() { - return defaultInstance; - } - - public TableInBatchWriteRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .com.aliyun.openservices.ots.protocol.PutRowInBatchWriteRowRequest put_rows = 2; - public static final int PUT_ROWS_FIELD_NUMBER = 2; - private java.util.List putRows_; - public java.util.List getPutRowsList() { - return putRows_; - } - public java.util.List - getPutRowsOrBuilderList() { - return putRows_; - } - public int getPutRowsCount() { - return putRows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest getPutRows(int index) { - return putRows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequestOrBuilder getPutRowsOrBuilder( - int index) { - return putRows_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.UpdateRowInBatchWriteRowRequest update_rows = 3; - public static final int UPDATE_ROWS_FIELD_NUMBER = 3; - private java.util.List updateRows_; - public java.util.List getUpdateRowsList() { - return updateRows_; - } - public java.util.List - getUpdateRowsOrBuilderList() { - return updateRows_; - } - public int getUpdateRowsCount() { - return updateRows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest getUpdateRows(int index) { - return updateRows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequestOrBuilder getUpdateRowsOrBuilder( - int index) { - return updateRows_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.DeleteRowInBatchWriteRowRequest delete_rows = 4; - public static final int DELETE_ROWS_FIELD_NUMBER = 4; - private java.util.List deleteRows_; - public java.util.List getDeleteRowsList() { - return deleteRows_; - } - public java.util.List - getDeleteRowsOrBuilderList() { - return deleteRows_; - } - public int getDeleteRowsCount() { - return deleteRows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest getDeleteRows(int index) { - return deleteRows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequestOrBuilder getDeleteRowsOrBuilder( - int index) { - return deleteRows_.get(index); - } - - private void initFields() { - tableName_ = ""; - putRows_ = java.util.Collections.emptyList(); - updateRows_ = java.util.Collections.emptyList(); - deleteRows_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPutRowsCount(); i++) { - if (!getPutRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getUpdateRowsCount(); i++) { - if (!getUpdateRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getDeleteRowsCount(); i++) { - if (!getDeleteRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - for (int i = 0; i < putRows_.size(); i++) { - output.writeMessage(2, putRows_.get(i)); - } - for (int i = 0; i < updateRows_.size(); i++) { - output.writeMessage(3, updateRows_.get(i)); - } - for (int i = 0; i < deleteRows_.size(); i++) { - output.writeMessage(4, deleteRows_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - for (int i = 0; i < putRows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, putRows_.get(i)); - } - for (int i = 0; i < updateRows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, updateRows_.get(i)); - } - for (int i = 0; i < deleteRows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, deleteRows_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getPutRowsFieldBuilder(); - getUpdateRowsFieldBuilder(); - getDeleteRowsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (putRowsBuilder_ == null) { - putRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - putRowsBuilder_.clear(); - } - if (updateRowsBuilder_ == null) { - updateRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - updateRowsBuilder_.clear(); - } - if (deleteRowsBuilder_ == null) { - deleteRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - deleteRowsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (putRowsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - putRows_ = java.util.Collections.unmodifiableList(putRows_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.putRows_ = putRows_; - } else { - result.putRows_ = putRowsBuilder_.build(); - } - if (updateRowsBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - updateRows_ = java.util.Collections.unmodifiableList(updateRows_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.updateRows_ = updateRows_; - } else { - result.updateRows_ = updateRowsBuilder_.build(); - } - if (deleteRowsBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - deleteRows_ = java.util.Collections.unmodifiableList(deleteRows_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.deleteRows_ = deleteRows_; - } else { - result.deleteRows_ = deleteRowsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (putRowsBuilder_ == null) { - if (!other.putRows_.isEmpty()) { - if (putRows_.isEmpty()) { - putRows_ = other.putRows_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensurePutRowsIsMutable(); - putRows_.addAll(other.putRows_); - } - onChanged(); - } - } else { - if (!other.putRows_.isEmpty()) { - if (putRowsBuilder_.isEmpty()) { - putRowsBuilder_.dispose(); - putRowsBuilder_ = null; - putRows_ = other.putRows_; - bitField0_ = (bitField0_ & ~0x00000002); - putRowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPutRowsFieldBuilder() : null; - } else { - putRowsBuilder_.addAllMessages(other.putRows_); - } - } - } - if (updateRowsBuilder_ == null) { - if (!other.updateRows_.isEmpty()) { - if (updateRows_.isEmpty()) { - updateRows_ = other.updateRows_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureUpdateRowsIsMutable(); - updateRows_.addAll(other.updateRows_); - } - onChanged(); - } - } else { - if (!other.updateRows_.isEmpty()) { - if (updateRowsBuilder_.isEmpty()) { - updateRowsBuilder_.dispose(); - updateRowsBuilder_ = null; - updateRows_ = other.updateRows_; - bitField0_ = (bitField0_ & ~0x00000004); - updateRowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getUpdateRowsFieldBuilder() : null; - } else { - updateRowsBuilder_.addAllMessages(other.updateRows_); - } - } - } - if (deleteRowsBuilder_ == null) { - if (!other.deleteRows_.isEmpty()) { - if (deleteRows_.isEmpty()) { - deleteRows_ = other.deleteRows_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureDeleteRowsIsMutable(); - deleteRows_.addAll(other.deleteRows_); - } - onChanged(); - } - } else { - if (!other.deleteRows_.isEmpty()) { - if (deleteRowsBuilder_.isEmpty()) { - deleteRowsBuilder_.dispose(); - deleteRowsBuilder_ = null; - deleteRows_ = other.deleteRows_; - bitField0_ = (bitField0_ & ~0x00000008); - deleteRowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getDeleteRowsFieldBuilder() : null; - } else { - deleteRowsBuilder_.addAllMessages(other.deleteRows_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - for (int i = 0; i < getPutRowsCount(); i++) { - if (!getPutRows(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getUpdateRowsCount(); i++) { - if (!getUpdateRows(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getDeleteRowsCount(); i++) { - if (!getDeleteRows(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPutRows(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addUpdateRows(subBuilder.buildPartial()); - break; - } - case 34: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addDeleteRows(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // repeated .com.aliyun.openservices.ots.protocol.PutRowInBatchWriteRowRequest put_rows = 2; - private java.util.List putRows_ = - java.util.Collections.emptyList(); - private void ensurePutRowsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - putRows_ = new java.util.ArrayList(putRows_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequestOrBuilder> putRowsBuilder_; - - public java.util.List getPutRowsList() { - if (putRowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(putRows_); - } else { - return putRowsBuilder_.getMessageList(); - } - } - public int getPutRowsCount() { - if (putRowsBuilder_ == null) { - return putRows_.size(); - } else { - return putRowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest getPutRows(int index) { - if (putRowsBuilder_ == null) { - return putRows_.get(index); - } else { - return putRowsBuilder_.getMessage(index); - } - } - public Builder setPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest value) { - if (putRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePutRowsIsMutable(); - putRows_.set(index, value); - onChanged(); - } else { - putRowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder builderForValue) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.set(index, builderForValue.build()); - onChanged(); - } else { - putRowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPutRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest value) { - if (putRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePutRowsIsMutable(); - putRows_.add(value); - onChanged(); - } else { - putRowsBuilder_.addMessage(value); - } - return this; - } - public Builder addPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest value) { - if (putRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePutRowsIsMutable(); - putRows_.add(index, value); - onChanged(); - } else { - putRowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPutRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder builderForValue) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.add(builderForValue.build()); - onChanged(); - } else { - putRowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder builderForValue) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.add(index, builderForValue.build()); - onChanged(); - } else { - putRowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPutRows( - java.lang.Iterable values) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - super.addAll(values, putRows_); - onChanged(); - } else { - putRowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPutRows() { - if (putRowsBuilder_ == null) { - putRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - putRowsBuilder_.clear(); - } - return this; - } - public Builder removePutRows(int index) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.remove(index); - onChanged(); - } else { - putRowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder getPutRowsBuilder( - int index) { - return getPutRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequestOrBuilder getPutRowsOrBuilder( - int index) { - if (putRowsBuilder_ == null) { - return putRows_.get(index); } else { - return putRowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPutRowsOrBuilderList() { - if (putRowsBuilder_ != null) { - return putRowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(putRows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder addPutRowsBuilder() { - return getPutRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder addPutRowsBuilder( - int index) { - return getPutRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.getDefaultInstance()); - } - public java.util.List - getPutRowsBuilderList() { - return getPutRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequestOrBuilder> - getPutRowsFieldBuilder() { - if (putRowsBuilder_ == null) { - putRowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequestOrBuilder>( - putRows_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - putRows_ = null; - } - return putRowsBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.UpdateRowInBatchWriteRowRequest update_rows = 3; - private java.util.List updateRows_ = - java.util.Collections.emptyList(); - private void ensureUpdateRowsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - updateRows_ = new java.util.ArrayList(updateRows_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequestOrBuilder> updateRowsBuilder_; - - public java.util.List getUpdateRowsList() { - if (updateRowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(updateRows_); - } else { - return updateRowsBuilder_.getMessageList(); - } - } - public int getUpdateRowsCount() { - if (updateRowsBuilder_ == null) { - return updateRows_.size(); - } else { - return updateRowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest getUpdateRows(int index) { - if (updateRowsBuilder_ == null) { - return updateRows_.get(index); - } else { - return updateRowsBuilder_.getMessage(index); - } - } - public Builder setUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest value) { - if (updateRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureUpdateRowsIsMutable(); - updateRows_.set(index, value); - onChanged(); - } else { - updateRowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder builderForValue) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.set(index, builderForValue.build()); - onChanged(); - } else { - updateRowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addUpdateRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest value) { - if (updateRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureUpdateRowsIsMutable(); - updateRows_.add(value); - onChanged(); - } else { - updateRowsBuilder_.addMessage(value); - } - return this; - } - public Builder addUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest value) { - if (updateRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureUpdateRowsIsMutable(); - updateRows_.add(index, value); - onChanged(); - } else { - updateRowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addUpdateRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder builderForValue) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.add(builderForValue.build()); - onChanged(); - } else { - updateRowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder builderForValue) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.add(index, builderForValue.build()); - onChanged(); - } else { - updateRowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllUpdateRows( - java.lang.Iterable values) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - super.addAll(values, updateRows_); - onChanged(); - } else { - updateRowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearUpdateRows() { - if (updateRowsBuilder_ == null) { - updateRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - updateRowsBuilder_.clear(); - } - return this; - } - public Builder removeUpdateRows(int index) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.remove(index); - onChanged(); - } else { - updateRowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder getUpdateRowsBuilder( - int index) { - return getUpdateRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequestOrBuilder getUpdateRowsOrBuilder( - int index) { - if (updateRowsBuilder_ == null) { - return updateRows_.get(index); } else { - return updateRowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getUpdateRowsOrBuilderList() { - if (updateRowsBuilder_ != null) { - return updateRowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(updateRows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder addUpdateRowsBuilder() { - return getUpdateRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder addUpdateRowsBuilder( - int index) { - return getUpdateRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.getDefaultInstance()); - } - public java.util.List - getUpdateRowsBuilderList() { - return getUpdateRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequestOrBuilder> - getUpdateRowsFieldBuilder() { - if (updateRowsBuilder_ == null) { - updateRowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequestOrBuilder>( - updateRows_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - updateRows_ = null; - } - return updateRowsBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.DeleteRowInBatchWriteRowRequest delete_rows = 4; - private java.util.List deleteRows_ = - java.util.Collections.emptyList(); - private void ensureDeleteRowsIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - deleteRows_ = new java.util.ArrayList(deleteRows_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequestOrBuilder> deleteRowsBuilder_; - - public java.util.List getDeleteRowsList() { - if (deleteRowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(deleteRows_); - } else { - return deleteRowsBuilder_.getMessageList(); - } - } - public int getDeleteRowsCount() { - if (deleteRowsBuilder_ == null) { - return deleteRows_.size(); - } else { - return deleteRowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest getDeleteRows(int index) { - if (deleteRowsBuilder_ == null) { - return deleteRows_.get(index); - } else { - return deleteRowsBuilder_.getMessage(index); - } - } - public Builder setDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest value) { - if (deleteRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeleteRowsIsMutable(); - deleteRows_.set(index, value); - onChanged(); - } else { - deleteRowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder builderForValue) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.set(index, builderForValue.build()); - onChanged(); - } else { - deleteRowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addDeleteRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest value) { - if (deleteRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeleteRowsIsMutable(); - deleteRows_.add(value); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(value); - } - return this; - } - public Builder addDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest value) { - if (deleteRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeleteRowsIsMutable(); - deleteRows_.add(index, value); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addDeleteRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder builderForValue) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.add(builderForValue.build()); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder builderForValue) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.add(index, builderForValue.build()); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllDeleteRows( - java.lang.Iterable values) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - super.addAll(values, deleteRows_); - onChanged(); - } else { - deleteRowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearDeleteRows() { - if (deleteRowsBuilder_ == null) { - deleteRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - deleteRowsBuilder_.clear(); - } - return this; - } - public Builder removeDeleteRows(int index) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.remove(index); - onChanged(); - } else { - deleteRowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder getDeleteRowsBuilder( - int index) { - return getDeleteRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequestOrBuilder getDeleteRowsOrBuilder( - int index) { - if (deleteRowsBuilder_ == null) { - return deleteRows_.get(index); } else { - return deleteRowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getDeleteRowsOrBuilderList() { - if (deleteRowsBuilder_ != null) { - return deleteRowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(deleteRows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder addDeleteRowsBuilder() { - return getDeleteRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder addDeleteRowsBuilder( - int index) { - return getDeleteRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.getDefaultInstance()); - } - public java.util.List - getDeleteRowsBuilderList() { - return getDeleteRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequestOrBuilder> - getDeleteRowsFieldBuilder() { - if (deleteRowsBuilder_ == null) { - deleteRowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequestOrBuilder>( - deleteRows_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - deleteRows_ = null; - } - return deleteRowsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.TableInBatchWriteRowRequest) - } - - static { - defaultInstance = new TableInBatchWriteRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.TableInBatchWriteRowRequest) - } - - public interface BatchWriteRowRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchWriteRowRequest tables = 1; - java.util.List - getTablesList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest getTables(int index); - int getTablesCount(); - java.util.List - getTablesOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequestOrBuilder getTablesOrBuilder( - int index); - } - public static final class BatchWriteRowRequest extends - com.google.protobuf.GeneratedMessage - implements BatchWriteRowRequestOrBuilder { - // Use BatchWriteRowRequest.newBuilder() to construct. - private BatchWriteRowRequest(Builder builder) { - super(builder); - } - private BatchWriteRowRequest(boolean noInit) {} - - private static final BatchWriteRowRequest defaultInstance; - public static BatchWriteRowRequest getDefaultInstance() { - return defaultInstance; - } - - public BatchWriteRowRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_fieldAccessorTable; - } - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchWriteRowRequest tables = 1; - public static final int TABLES_FIELD_NUMBER = 1; - private java.util.List tables_; - public java.util.List getTablesList() { - return tables_; - } - public java.util.List - getTablesOrBuilderList() { - return tables_; - } - public int getTablesCount() { - return tables_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest getTables(int index) { - return tables_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequestOrBuilder getTablesOrBuilder( - int index) { - return tables_.get(index); - } - - private void initFields() { - tables_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < tables_.size(); i++) { - output.writeMessage(1, tables_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < tables_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, tables_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getTablesFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - tablesBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest(this); - int from_bitField0_ = bitField0_; - if (tablesBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = java.util.Collections.unmodifiableList(tables_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.tables_ = tables_; - } else { - result.tables_ = tablesBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.getDefaultInstance()) return this; - if (tablesBuilder_ == null) { - if (!other.tables_.isEmpty()) { - if (tables_.isEmpty()) { - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureTablesIsMutable(); - tables_.addAll(other.tables_); - } - onChanged(); - } - } else { - if (!other.tables_.isEmpty()) { - if (tablesBuilder_.isEmpty()) { - tablesBuilder_.dispose(); - tablesBuilder_ = null; - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - tablesBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getTablesFieldBuilder() : null; - } else { - tablesBuilder_.addAllMessages(other.tables_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addTables(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchWriteRowRequest tables = 1; - private java.util.List tables_ = - java.util.Collections.emptyList(); - private void ensureTablesIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = new java.util.ArrayList(tables_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequestOrBuilder> tablesBuilder_; - - public java.util.List getTablesList() { - if (tablesBuilder_ == null) { - return java.util.Collections.unmodifiableList(tables_); - } else { - return tablesBuilder_.getMessageList(); - } - } - public int getTablesCount() { - if (tablesBuilder_ == null) { - return tables_.size(); - } else { - return tablesBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest getTables(int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); - } else { - return tablesBuilder_.getMessage(index); - } - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.set(index, value); - onChanged(); - } else { - tablesBuilder_.setMessage(index, value); - } - return this; - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.set(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addTables(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(value); - onChanged(); - } else { - tablesBuilder_.addMessage(value); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(index, value); - onChanged(); - } else { - tablesBuilder_.addMessage(index, value); - } - return this; - } - public Builder addTables( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllTables( - java.lang.Iterable values) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - super.addAll(values, tables_); - onChanged(); - } else { - tablesBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearTables() { - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - tablesBuilder_.clear(); - } - return this; - } - public Builder removeTables(int index) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.remove(index); - onChanged(); - } else { - tablesBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder getTablesBuilder( - int index) { - return getTablesFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequestOrBuilder getTablesOrBuilder( - int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); } else { - return tablesBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getTablesOrBuilderList() { - if (tablesBuilder_ != null) { - return tablesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(tables_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder addTablesBuilder() { - return getTablesFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder addTablesBuilder( - int index) { - return getTablesFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.getDefaultInstance()); - } - public java.util.List - getTablesBuilderList() { - return getTablesFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequestOrBuilder> - getTablesFieldBuilder() { - if (tablesBuilder_ == null) { - tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequestOrBuilder>( - tables_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - tables_ = null; - } - return tablesBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.BatchWriteRowRequest) - } - - static { - defaultInstance = new BatchWriteRowRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.BatchWriteRowRequest) - } - - public interface RowInBatchWriteRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required bool is_ok = 1 [default = true]; - boolean hasIsOk(); - boolean getIsOk(); - - // optional .com.aliyun.openservices.ots.protocol.Error error = 2; - boolean hasError(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error getError(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder getErrorOrBuilder(); - - // optional .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 3; - boolean hasConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder(); - } - public static final class RowInBatchWriteRowResponse extends - com.google.protobuf.GeneratedMessage - implements RowInBatchWriteRowResponseOrBuilder { - // Use RowInBatchWriteRowResponse.newBuilder() to construct. - private RowInBatchWriteRowResponse(Builder builder) { - super(builder); - } - private RowInBatchWriteRowResponse(boolean noInit) {} - - private static final RowInBatchWriteRowResponse defaultInstance; - public static RowInBatchWriteRowResponse getDefaultInstance() { - return defaultInstance; - } - - public RowInBatchWriteRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required bool is_ok = 1 [default = true]; - public static final int IS_OK_FIELD_NUMBER = 1; - private boolean isOk_; - public boolean hasIsOk() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public boolean getIsOk() { - return isOk_; - } - - // optional .com.aliyun.openservices.ots.protocol.Error error = 2; - public static final int ERROR_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Error error_; - public boolean hasError() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error getError() { - return error_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder getErrorOrBuilder() { - return error_; - } - - // optional .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 3; - public static final int CONSUMED_FIELD_NUMBER = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - return consumed_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - return consumed_; - } - - private void initFields() { - isOk_ = true; - error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasIsOk()) { - memoizedIsInitialized = 0; - return false; - } - if (hasError()) { - if (!getError().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasConsumed()) { - if (!getConsumed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBool(1, isOk_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, error_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(3, consumed_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(1, isOk_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, error_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, consumed_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getErrorFieldBuilder(); - getConsumedFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - isOk_ = true; - bitField0_ = (bitField0_ & ~0x00000001); - if (errorBuilder_ == null) { - error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - } else { - errorBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.isOk_ = isOk_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (errorBuilder_ == null) { - result.error_ = error_; - } else { - result.error_ = errorBuilder_.build(); - } - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - if (consumedBuilder_ == null) { - result.consumed_ = consumed_; - } else { - result.consumed_ = consumedBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance()) return this; - if (other.hasIsOk()) { - setIsOk(other.getIsOk()); - } - if (other.hasError()) { - mergeError(other.getError()); - } - if (other.hasConsumed()) { - mergeConsumed(other.getConsumed()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasIsOk()) { - - return false; - } - if (hasError()) { - if (!getError().isInitialized()) { - - return false; - } - } - if (hasConsumed()) { - if (!getConsumed().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - isOk_ = input.readBool(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.newBuilder(); - if (hasError()) { - subBuilder.mergeFrom(getError()); - } - input.readMessage(subBuilder, extensionRegistry); - setError(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(); - if (hasConsumed()) { - subBuilder.mergeFrom(getConsumed()); - } - input.readMessage(subBuilder, extensionRegistry); - setConsumed(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required bool is_ok = 1 [default = true]; - private boolean isOk_ = true; - public boolean hasIsOk() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public boolean getIsOk() { - return isOk_; - } - public Builder setIsOk(boolean value) { - bitField0_ |= 0x00000001; - isOk_ = value; - onChanged(); - return this; - } - public Builder clearIsOk() { - bitField0_ = (bitField0_ & ~0x00000001); - isOk_ = true; - onChanged(); - return this; - } - - // optional .com.aliyun.openservices.ots.protocol.Error error = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Error error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error, com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder> errorBuilder_; - public boolean hasError() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error getError() { - if (errorBuilder_ == null) { - return error_; - } else { - return errorBuilder_.getMessage(); - } - } - public Builder setError(com.aliyun.openservices.ots.protocol.OtsProtocol2.Error value) { - if (errorBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - error_ = value; - onChanged(); - } else { - errorBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder setError( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder builderForValue) { - if (errorBuilder_ == null) { - error_ = builderForValue.build(); - onChanged(); - } else { - errorBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder mergeError(com.aliyun.openservices.ots.protocol.OtsProtocol2.Error value) { - if (errorBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - error_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance()) { - error_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.newBuilder(error_).mergeFrom(value).buildPartial(); - } else { - error_ = value; - } - onChanged(); - } else { - errorBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - public Builder clearError() { - if (errorBuilder_ == null) { - error_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.getDefaultInstance(); - onChanged(); - } else { - errorBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder getErrorBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getErrorFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder getErrorOrBuilder() { - if (errorBuilder_ != null) { - return errorBuilder_.getMessageOrBuilder(); - } else { - return error_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error, com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder> - getErrorFieldBuilder() { - if (errorBuilder_ == null) { - errorBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error, com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ErrorOrBuilder>( - error_, - getParentForChildren(), - isClean()); - error_ = null; - } - return errorBuilder_; - } - - // optional .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 3; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> consumedBuilder_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - if (consumedBuilder_ == null) { - return consumed_; - } else { - return consumedBuilder_.getMessage(); - } - } - public Builder setConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - consumed_ = value; - onChanged(); - } else { - consumedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder setConsumed( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder builderForValue) { - if (consumedBuilder_ == null) { - consumed_ = builderForValue.build(); - onChanged(); - } else { - consumedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder mergeConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - consumed_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) { - consumed_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); - } else { - consumed_ = value; - } - onChanged(); - } else { - consumedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - public Builder clearConsumed() { - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - onChanged(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder getConsumedBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getConsumedFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - if (consumedBuilder_ != null) { - return consumedBuilder_.getMessageOrBuilder(); - } else { - return consumed_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> - getConsumedFieldBuilder() { - if (consumedBuilder_ == null) { - consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder>( - consumed_, - getParentForChildren(), - isClean()); - consumed_ = null; - } - return consumedBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse) - } - - static { - defaultInstance = new RowInBatchWriteRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse) - } - - public interface TableInBatchWriteRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse put_rows = 2; - java.util.List - getPutRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getPutRows(int index); - int getPutRowsCount(); - java.util.List - getPutRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getPutRowsOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse update_rows = 3; - java.util.List - getUpdateRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getUpdateRows(int index); - int getUpdateRowsCount(); - java.util.List - getUpdateRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getUpdateRowsOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse delete_rows = 4; - java.util.List - getDeleteRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getDeleteRows(int index); - int getDeleteRowsCount(); - java.util.List - getDeleteRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getDeleteRowsOrBuilder( - int index); - } - public static final class TableInBatchWriteRowResponse extends - com.google.protobuf.GeneratedMessage - implements TableInBatchWriteRowResponseOrBuilder { - // Use TableInBatchWriteRowResponse.newBuilder() to construct. - private TableInBatchWriteRowResponse(Builder builder) { - super(builder); - } - private TableInBatchWriteRowResponse(boolean noInit) {} - - private static final TableInBatchWriteRowResponse defaultInstance; - public static TableInBatchWriteRowResponse getDefaultInstance() { - return defaultInstance; - } - - public TableInBatchWriteRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse put_rows = 2; - public static final int PUT_ROWS_FIELD_NUMBER = 2; - private java.util.List putRows_; - public java.util.List getPutRowsList() { - return putRows_; - } - public java.util.List - getPutRowsOrBuilderList() { - return putRows_; - } - public int getPutRowsCount() { - return putRows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getPutRows(int index) { - return putRows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getPutRowsOrBuilder( - int index) { - return putRows_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse update_rows = 3; - public static final int UPDATE_ROWS_FIELD_NUMBER = 3; - private java.util.List updateRows_; - public java.util.List getUpdateRowsList() { - return updateRows_; - } - public java.util.List - getUpdateRowsOrBuilderList() { - return updateRows_; - } - public int getUpdateRowsCount() { - return updateRows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getUpdateRows(int index) { - return updateRows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getUpdateRowsOrBuilder( - int index) { - return updateRows_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse delete_rows = 4; - public static final int DELETE_ROWS_FIELD_NUMBER = 4; - private java.util.List deleteRows_; - public java.util.List getDeleteRowsList() { - return deleteRows_; - } - public java.util.List - getDeleteRowsOrBuilderList() { - return deleteRows_; - } - public int getDeleteRowsCount() { - return deleteRows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getDeleteRows(int index) { - return deleteRows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getDeleteRowsOrBuilder( - int index) { - return deleteRows_.get(index); - } - - private void initFields() { - tableName_ = ""; - putRows_ = java.util.Collections.emptyList(); - updateRows_ = java.util.Collections.emptyList(); - deleteRows_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getPutRowsCount(); i++) { - if (!getPutRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getUpdateRowsCount(); i++) { - if (!getUpdateRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getDeleteRowsCount(); i++) { - if (!getDeleteRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - for (int i = 0; i < putRows_.size(); i++) { - output.writeMessage(2, putRows_.get(i)); - } - for (int i = 0; i < updateRows_.size(); i++) { - output.writeMessage(3, updateRows_.get(i)); - } - for (int i = 0; i < deleteRows_.size(); i++) { - output.writeMessage(4, deleteRows_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - for (int i = 0; i < putRows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, putRows_.get(i)); - } - for (int i = 0; i < updateRows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, updateRows_.get(i)); - } - for (int i = 0; i < deleteRows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, deleteRows_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getPutRowsFieldBuilder(); - getUpdateRowsFieldBuilder(); - getDeleteRowsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (putRowsBuilder_ == null) { - putRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - putRowsBuilder_.clear(); - } - if (updateRowsBuilder_ == null) { - updateRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - updateRowsBuilder_.clear(); - } - if (deleteRowsBuilder_ == null) { - deleteRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - deleteRowsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (putRowsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - putRows_ = java.util.Collections.unmodifiableList(putRows_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.putRows_ = putRows_; - } else { - result.putRows_ = putRowsBuilder_.build(); - } - if (updateRowsBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - updateRows_ = java.util.Collections.unmodifiableList(updateRows_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.updateRows_ = updateRows_; - } else { - result.updateRows_ = updateRowsBuilder_.build(); - } - if (deleteRowsBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - deleteRows_ = java.util.Collections.unmodifiableList(deleteRows_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.deleteRows_ = deleteRows_; - } else { - result.deleteRows_ = deleteRowsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (putRowsBuilder_ == null) { - if (!other.putRows_.isEmpty()) { - if (putRows_.isEmpty()) { - putRows_ = other.putRows_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensurePutRowsIsMutable(); - putRows_.addAll(other.putRows_); - } - onChanged(); - } - } else { - if (!other.putRows_.isEmpty()) { - if (putRowsBuilder_.isEmpty()) { - putRowsBuilder_.dispose(); - putRowsBuilder_ = null; - putRows_ = other.putRows_; - bitField0_ = (bitField0_ & ~0x00000002); - putRowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getPutRowsFieldBuilder() : null; - } else { - putRowsBuilder_.addAllMessages(other.putRows_); - } - } - } - if (updateRowsBuilder_ == null) { - if (!other.updateRows_.isEmpty()) { - if (updateRows_.isEmpty()) { - updateRows_ = other.updateRows_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureUpdateRowsIsMutable(); - updateRows_.addAll(other.updateRows_); - } - onChanged(); - } - } else { - if (!other.updateRows_.isEmpty()) { - if (updateRowsBuilder_.isEmpty()) { - updateRowsBuilder_.dispose(); - updateRowsBuilder_ = null; - updateRows_ = other.updateRows_; - bitField0_ = (bitField0_ & ~0x00000004); - updateRowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getUpdateRowsFieldBuilder() : null; - } else { - updateRowsBuilder_.addAllMessages(other.updateRows_); - } - } - } - if (deleteRowsBuilder_ == null) { - if (!other.deleteRows_.isEmpty()) { - if (deleteRows_.isEmpty()) { - deleteRows_ = other.deleteRows_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureDeleteRowsIsMutable(); - deleteRows_.addAll(other.deleteRows_); - } - onChanged(); - } - } else { - if (!other.deleteRows_.isEmpty()) { - if (deleteRowsBuilder_.isEmpty()) { - deleteRowsBuilder_.dispose(); - deleteRowsBuilder_ = null; - deleteRows_ = other.deleteRows_; - bitField0_ = (bitField0_ & ~0x00000008); - deleteRowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getDeleteRowsFieldBuilder() : null; - } else { - deleteRowsBuilder_.addAllMessages(other.deleteRows_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - for (int i = 0; i < getPutRowsCount(); i++) { - if (!getPutRows(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getUpdateRowsCount(); i++) { - if (!getUpdateRows(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getDeleteRowsCount(); i++) { - if (!getDeleteRows(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addPutRows(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addUpdateRows(subBuilder.buildPartial()); - break; - } - case 34: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addDeleteRows(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse put_rows = 2; - private java.util.List putRows_ = - java.util.Collections.emptyList(); - private void ensurePutRowsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - putRows_ = new java.util.ArrayList(putRows_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder> putRowsBuilder_; - - public java.util.List getPutRowsList() { - if (putRowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(putRows_); - } else { - return putRowsBuilder_.getMessageList(); - } - } - public int getPutRowsCount() { - if (putRowsBuilder_ == null) { - return putRows_.size(); - } else { - return putRowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getPutRows(int index) { - if (putRowsBuilder_ == null) { - return putRows_.get(index); - } else { - return putRowsBuilder_.getMessage(index); - } - } - public Builder setPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (putRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePutRowsIsMutable(); - putRows_.set(index, value); - onChanged(); - } else { - putRowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.set(index, builderForValue.build()); - onChanged(); - } else { - putRowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addPutRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (putRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePutRowsIsMutable(); - putRows_.add(value); - onChanged(); - } else { - putRowsBuilder_.addMessage(value); - } - return this; - } - public Builder addPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (putRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePutRowsIsMutable(); - putRows_.add(index, value); - onChanged(); - } else { - putRowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addPutRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.add(builderForValue.build()); - onChanged(); - } else { - putRowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addPutRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.add(index, builderForValue.build()); - onChanged(); - } else { - putRowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllPutRows( - java.lang.Iterable values) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - super.addAll(values, putRows_); - onChanged(); - } else { - putRowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearPutRows() { - if (putRowsBuilder_ == null) { - putRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - putRowsBuilder_.clear(); - } - return this; - } - public Builder removePutRows(int index) { - if (putRowsBuilder_ == null) { - ensurePutRowsIsMutable(); - putRows_.remove(index); - onChanged(); - } else { - putRowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder getPutRowsBuilder( - int index) { - return getPutRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getPutRowsOrBuilder( - int index) { - if (putRowsBuilder_ == null) { - return putRows_.get(index); } else { - return putRowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getPutRowsOrBuilderList() { - if (putRowsBuilder_ != null) { - return putRowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(putRows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder addPutRowsBuilder() { - return getPutRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder addPutRowsBuilder( - int index) { - return getPutRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance()); - } - public java.util.List - getPutRowsBuilderList() { - return getPutRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder> - getPutRowsFieldBuilder() { - if (putRowsBuilder_ == null) { - putRowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder>( - putRows_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - putRows_ = null; - } - return putRowsBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse update_rows = 3; - private java.util.List updateRows_ = - java.util.Collections.emptyList(); - private void ensureUpdateRowsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - updateRows_ = new java.util.ArrayList(updateRows_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder> updateRowsBuilder_; - - public java.util.List getUpdateRowsList() { - if (updateRowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(updateRows_); - } else { - return updateRowsBuilder_.getMessageList(); - } - } - public int getUpdateRowsCount() { - if (updateRowsBuilder_ == null) { - return updateRows_.size(); - } else { - return updateRowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getUpdateRows(int index) { - if (updateRowsBuilder_ == null) { - return updateRows_.get(index); - } else { - return updateRowsBuilder_.getMessage(index); - } - } - public Builder setUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (updateRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureUpdateRowsIsMutable(); - updateRows_.set(index, value); - onChanged(); - } else { - updateRowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.set(index, builderForValue.build()); - onChanged(); - } else { - updateRowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addUpdateRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (updateRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureUpdateRowsIsMutable(); - updateRows_.add(value); - onChanged(); - } else { - updateRowsBuilder_.addMessage(value); - } - return this; - } - public Builder addUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (updateRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureUpdateRowsIsMutable(); - updateRows_.add(index, value); - onChanged(); - } else { - updateRowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addUpdateRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.add(builderForValue.build()); - onChanged(); - } else { - updateRowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addUpdateRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.add(index, builderForValue.build()); - onChanged(); - } else { - updateRowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllUpdateRows( - java.lang.Iterable values) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - super.addAll(values, updateRows_); - onChanged(); - } else { - updateRowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearUpdateRows() { - if (updateRowsBuilder_ == null) { - updateRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - updateRowsBuilder_.clear(); - } - return this; - } - public Builder removeUpdateRows(int index) { - if (updateRowsBuilder_ == null) { - ensureUpdateRowsIsMutable(); - updateRows_.remove(index); - onChanged(); - } else { - updateRowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder getUpdateRowsBuilder( - int index) { - return getUpdateRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getUpdateRowsOrBuilder( - int index) { - if (updateRowsBuilder_ == null) { - return updateRows_.get(index); } else { - return updateRowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getUpdateRowsOrBuilderList() { - if (updateRowsBuilder_ != null) { - return updateRowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(updateRows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder addUpdateRowsBuilder() { - return getUpdateRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder addUpdateRowsBuilder( - int index) { - return getUpdateRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance()); - } - public java.util.List - getUpdateRowsBuilderList() { - return getUpdateRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder> - getUpdateRowsFieldBuilder() { - if (updateRowsBuilder_ == null) { - updateRowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder>( - updateRows_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - updateRows_ = null; - } - return updateRowsBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.RowInBatchWriteRowResponse delete_rows = 4; - private java.util.List deleteRows_ = - java.util.Collections.emptyList(); - private void ensureDeleteRowsIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - deleteRows_ = new java.util.ArrayList(deleteRows_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder> deleteRowsBuilder_; - - public java.util.List getDeleteRowsList() { - if (deleteRowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(deleteRows_); - } else { - return deleteRowsBuilder_.getMessageList(); - } - } - public int getDeleteRowsCount() { - if (deleteRowsBuilder_ == null) { - return deleteRows_.size(); - } else { - return deleteRowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse getDeleteRows(int index) { - if (deleteRowsBuilder_ == null) { - return deleteRows_.get(index); - } else { - return deleteRowsBuilder_.getMessage(index); - } - } - public Builder setDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (deleteRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeleteRowsIsMutable(); - deleteRows_.set(index, value); - onChanged(); - } else { - deleteRowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.set(index, builderForValue.build()); - onChanged(); - } else { - deleteRowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addDeleteRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (deleteRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeleteRowsIsMutable(); - deleteRows_.add(value); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(value); - } - return this; - } - public Builder addDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse value) { - if (deleteRowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeleteRowsIsMutable(); - deleteRows_.add(index, value); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addDeleteRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.add(builderForValue.build()); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addDeleteRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder builderForValue) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.add(index, builderForValue.build()); - onChanged(); - } else { - deleteRowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllDeleteRows( - java.lang.Iterable values) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - super.addAll(values, deleteRows_); - onChanged(); - } else { - deleteRowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearDeleteRows() { - if (deleteRowsBuilder_ == null) { - deleteRows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - deleteRowsBuilder_.clear(); - } - return this; - } - public Builder removeDeleteRows(int index) { - if (deleteRowsBuilder_ == null) { - ensureDeleteRowsIsMutable(); - deleteRows_.remove(index); - onChanged(); - } else { - deleteRowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder getDeleteRowsBuilder( - int index) { - return getDeleteRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder getDeleteRowsOrBuilder( - int index) { - if (deleteRowsBuilder_ == null) { - return deleteRows_.get(index); } else { - return deleteRowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getDeleteRowsOrBuilderList() { - if (deleteRowsBuilder_ != null) { - return deleteRowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(deleteRows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder addDeleteRowsBuilder() { - return getDeleteRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder addDeleteRowsBuilder( - int index) { - return getDeleteRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.getDefaultInstance()); - } - public java.util.List - getDeleteRowsBuilderList() { - return getDeleteRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder> - getDeleteRowsFieldBuilder() { - if (deleteRowsBuilder_ == null) { - deleteRowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponseOrBuilder>( - deleteRows_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - deleteRows_ = null; - } - return deleteRowsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.TableInBatchWriteRowResponse) - } - - static { - defaultInstance = new TableInBatchWriteRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.TableInBatchWriteRowResponse) - } - - public interface BatchWriteRowResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchWriteRowResponse tables = 1; - java.util.List - getTablesList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse getTables(int index); - int getTablesCount(); - java.util.List - getTablesOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponseOrBuilder getTablesOrBuilder( - int index); - } - public static final class BatchWriteRowResponse extends - com.google.protobuf.GeneratedMessage - implements BatchWriteRowResponseOrBuilder { - // Use BatchWriteRowResponse.newBuilder() to construct. - private BatchWriteRowResponse(Builder builder) { - super(builder); - } - private BatchWriteRowResponse(boolean noInit) {} - - private static final BatchWriteRowResponse defaultInstance; - public static BatchWriteRowResponse getDefaultInstance() { - return defaultInstance; - } - - public BatchWriteRowResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_fieldAccessorTable; - } - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchWriteRowResponse tables = 1; - public static final int TABLES_FIELD_NUMBER = 1; - private java.util.List tables_; - public java.util.List getTablesList() { - return tables_; - } - public java.util.List - getTablesOrBuilderList() { - return tables_; - } - public int getTablesCount() { - return tables_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse getTables(int index) { - return tables_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponseOrBuilder getTablesOrBuilder( - int index) { - return tables_.get(index); - } - - private void initFields() { - tables_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (int i = 0; i < tables_.size(); i++) { - output.writeMessage(1, tables_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < tables_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, tables_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getTablesFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - tablesBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse(this); - int from_bitField0_ = bitField0_; - if (tablesBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = java.util.Collections.unmodifiableList(tables_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.tables_ = tables_; - } else { - result.tables_ = tablesBuilder_.build(); - } - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse.getDefaultInstance()) return this; - if (tablesBuilder_ == null) { - if (!other.tables_.isEmpty()) { - if (tables_.isEmpty()) { - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureTablesIsMutable(); - tables_.addAll(other.tables_); - } - onChanged(); - } - } else { - if (!other.tables_.isEmpty()) { - if (tablesBuilder_.isEmpty()) { - tablesBuilder_.dispose(); - tablesBuilder_ = null; - tables_ = other.tables_; - bitField0_ = (bitField0_ & ~0x00000001); - tablesBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getTablesFieldBuilder() : null; - } else { - tablesBuilder_.addAllMessages(other.tables_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - for (int i = 0; i < getTablesCount(); i++) { - if (!getTables(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addTables(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // repeated .com.aliyun.openservices.ots.protocol.TableInBatchWriteRowResponse tables = 1; - private java.util.List tables_ = - java.util.Collections.emptyList(); - private void ensureTablesIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - tables_ = new java.util.ArrayList(tables_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponseOrBuilder> tablesBuilder_; - - public java.util.List getTablesList() { - if (tablesBuilder_ == null) { - return java.util.Collections.unmodifiableList(tables_); - } else { - return tablesBuilder_.getMessageList(); - } - } - public int getTablesCount() { - if (tablesBuilder_ == null) { - return tables_.size(); - } else { - return tablesBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse getTables(int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); - } else { - return tablesBuilder_.getMessage(index); - } - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.set(index, value); - onChanged(); - } else { - tablesBuilder_.setMessage(index, value); - } - return this; - } - public Builder setTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.set(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addTables(com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(value); - onChanged(); - } else { - tablesBuilder_.addMessage(value); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse value) { - if (tablesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTablesIsMutable(); - tables_.add(index, value); - onChanged(); - } else { - tablesBuilder_.addMessage(index, value); - } - return this; - } - public Builder addTables( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addTables( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder builderForValue) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.add(index, builderForValue.build()); - onChanged(); - } else { - tablesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllTables( - java.lang.Iterable values) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - super.addAll(values, tables_); - onChanged(); - } else { - tablesBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearTables() { - if (tablesBuilder_ == null) { - tables_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - tablesBuilder_.clear(); - } - return this; - } - public Builder removeTables(int index) { - if (tablesBuilder_ == null) { - ensureTablesIsMutable(); - tables_.remove(index); - onChanged(); - } else { - tablesBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder getTablesBuilder( - int index) { - return getTablesFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponseOrBuilder getTablesOrBuilder( - int index) { - if (tablesBuilder_ == null) { - return tables_.get(index); } else { - return tablesBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getTablesOrBuilderList() { - if (tablesBuilder_ != null) { - return tablesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(tables_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder addTablesBuilder() { - return getTablesFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder addTablesBuilder( - int index) { - return getTablesFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.getDefaultInstance()); - } - public java.util.List - getTablesBuilderList() { - return getTablesFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponseOrBuilder> - getTablesFieldBuilder() { - if (tablesBuilder_ == null) { - tablesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponseOrBuilder>( - tables_, - ((bitField0_ & 0x00000001) == 0x00000001), - getParentForChildren(), - isClean()); - tables_ = null; - } - return tablesBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.BatchWriteRowResponse) - } - - static { - defaultInstance = new BatchWriteRowResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.BatchWriteRowResponse) - } - - public interface GetRangeRequestOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required string table_name = 1; - boolean hasTableName(); - String getTableName(); - - // required .com.aliyun.openservices.ots.protocol.Direction direction = 2; - boolean hasDirection(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction getDirection(); - - // repeated string columns_to_get = 3; - java.util.List getColumnsToGetList(); - int getColumnsToGetCount(); - String getColumnsToGet(int index); - - // optional int32 limit = 4; - boolean hasLimit(); - int getLimit(); - - // repeated .com.aliyun.openservices.ots.protocol.Column inclusive_start_primary_key = 5; - java.util.List - getInclusiveStartPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getInclusiveStartPrimaryKey(int index); - int getInclusiveStartPrimaryKeyCount(); - java.util.List - getInclusiveStartPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getInclusiveStartPrimaryKeyOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.Column exclusive_end_primary_key = 6; - java.util.List - getExclusiveEndPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getExclusiveEndPrimaryKey(int index); - int getExclusiveEndPrimaryKeyCount(); - java.util.List - getExclusiveEndPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getExclusiveEndPrimaryKeyOrBuilder( - int index); - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 7; - boolean hasFilter(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder(); - } - public static final class GetRangeRequest extends - com.google.protobuf.GeneratedMessage - implements GetRangeRequestOrBuilder { - // Use GetRangeRequest.newBuilder() to construct. - private GetRangeRequest(Builder builder) { - super(builder); - } - private GetRangeRequest(boolean noInit) {} - - private static final GetRangeRequest defaultInstance; - public static GetRangeRequest getDefaultInstance() { - return defaultInstance; - } - - public GetRangeRequest getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_fieldAccessorTable; - } - - private int bitField0_; - // required string table_name = 1; - public static final int TABLE_NAME_FIELD_NUMBER = 1; - private java.lang.Object tableName_; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // required .com.aliyun.openservices.ots.protocol.Direction direction = 2; - public static final int DIRECTION_FIELD_NUMBER = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction direction_; - public boolean hasDirection() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction getDirection() { - return direction_; - } - - // repeated string columns_to_get = 3; - public static final int COLUMNS_TO_GET_FIELD_NUMBER = 3; - private com.google.protobuf.LazyStringList columnsToGet_; - public java.util.List - getColumnsToGetList() { - return columnsToGet_; - } - public int getColumnsToGetCount() { - return columnsToGet_.size(); - } - public String getColumnsToGet(int index) { - return columnsToGet_.get(index); - } - - // optional int32 limit = 4; - public static final int LIMIT_FIELD_NUMBER = 4; - private int limit_; - public boolean hasLimit() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public int getLimit() { - return limit_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column inclusive_start_primary_key = 5; - public static final int INCLUSIVE_START_PRIMARY_KEY_FIELD_NUMBER = 5; - private java.util.List inclusiveStartPrimaryKey_; - public java.util.List getInclusiveStartPrimaryKeyList() { - return inclusiveStartPrimaryKey_; - } - public java.util.List - getInclusiveStartPrimaryKeyOrBuilderList() { - return inclusiveStartPrimaryKey_; - } - public int getInclusiveStartPrimaryKeyCount() { - return inclusiveStartPrimaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getInclusiveStartPrimaryKey(int index) { - return inclusiveStartPrimaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getInclusiveStartPrimaryKeyOrBuilder( - int index) { - return inclusiveStartPrimaryKey_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.Column exclusive_end_primary_key = 6; - public static final int EXCLUSIVE_END_PRIMARY_KEY_FIELD_NUMBER = 6; - private java.util.List exclusiveEndPrimaryKey_; - public java.util.List getExclusiveEndPrimaryKeyList() { - return exclusiveEndPrimaryKey_; - } - public java.util.List - getExclusiveEndPrimaryKeyOrBuilderList() { - return exclusiveEndPrimaryKey_; - } - public int getExclusiveEndPrimaryKeyCount() { - return exclusiveEndPrimaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getExclusiveEndPrimaryKey(int index) { - return exclusiveEndPrimaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getExclusiveEndPrimaryKeyOrBuilder( - int index) { - return exclusiveEndPrimaryKey_.get(index); - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 7; - public static final int FILTER_FIELD_NUMBER = 7; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition filter_; - public boolean hasFilter() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter() { - return filter_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder() { - return filter_; - } - - private void initFields() { - tableName_ = ""; - direction_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.FORWARD; - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - limit_ = 0; - inclusiveStartPrimaryKey_ = java.util.Collections.emptyList(); - exclusiveEndPrimaryKey_ = java.util.Collections.emptyList(); - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasTableName()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasDirection()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getInclusiveStartPrimaryKeyCount(); i++) { - if (!getInclusiveStartPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getExclusiveEndPrimaryKeyCount(); i++) { - if (!getExclusiveEndPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - if (hasFilter()) { - if (!getFilter().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeEnum(2, direction_.getNumber()); - } - for (int i = 0; i < columnsToGet_.size(); i++) { - output.writeBytes(3, columnsToGet_.getByteString(i)); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt32(4, limit_); - } - for (int i = 0; i < inclusiveStartPrimaryKey_.size(); i++) { - output.writeMessage(5, inclusiveStartPrimaryKey_.get(i)); - } - for (int i = 0; i < exclusiveEndPrimaryKey_.size(); i++) { - output.writeMessage(6, exclusiveEndPrimaryKey_.get(i)); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeMessage(7, filter_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, getTableNameBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(2, direction_.getNumber()); - } - { - int dataSize = 0; - for (int i = 0; i < columnsToGet_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(columnsToGet_.getByteString(i)); - } - size += dataSize; - size += 1 * getColumnsToGetList().size(); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(4, limit_); - } - for (int i = 0; i < inclusiveStartPrimaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(5, inclusiveStartPrimaryKey_.get(i)); - } - for (int i = 0; i < exclusiveEndPrimaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(6, exclusiveEndPrimaryKey_.get(i)); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(7, filter_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getInclusiveStartPrimaryKeyFieldBuilder(); - getExclusiveEndPrimaryKeyFieldBuilder(); - getFilterFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - direction_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.FORWARD; - bitField0_ = (bitField0_ & ~0x00000002); - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - limit_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); - if (inclusiveStartPrimaryKeyBuilder_ == null) { - inclusiveStartPrimaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - } else { - inclusiveStartPrimaryKeyBuilder_.clear(); - } - if (exclusiveEndPrimaryKeyBuilder_ == null) { - exclusiveEndPrimaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - } else { - exclusiveEndPrimaryKeyBuilder_.clear(); - } - if (filterBuilder_ == null) { - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - } else { - filterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableName_ = tableName_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.direction_ = direction_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - columnsToGet_ = new com.google.protobuf.UnmodifiableLazyStringList( - columnsToGet_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.columnsToGet_ = columnsToGet_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000004; - } - result.limit_ = limit_; - if (inclusiveStartPrimaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010)) { - inclusiveStartPrimaryKey_ = java.util.Collections.unmodifiableList(inclusiveStartPrimaryKey_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.inclusiveStartPrimaryKey_ = inclusiveStartPrimaryKey_; - } else { - result.inclusiveStartPrimaryKey_ = inclusiveStartPrimaryKeyBuilder_.build(); - } - if (exclusiveEndPrimaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020)) { - exclusiveEndPrimaryKey_ = java.util.Collections.unmodifiableList(exclusiveEndPrimaryKey_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.exclusiveEndPrimaryKey_ = exclusiveEndPrimaryKey_; - } else { - result.exclusiveEndPrimaryKey_ = exclusiveEndPrimaryKeyBuilder_.build(); - } - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000008; - } - if (filterBuilder_ == null) { - result.filter_ = filter_; - } else { - result.filter_ = filterBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.getDefaultInstance()) return this; - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (other.hasDirection()) { - setDirection(other.getDirection()); - } - if (!other.columnsToGet_.isEmpty()) { - if (columnsToGet_.isEmpty()) { - columnsToGet_ = other.columnsToGet_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureColumnsToGetIsMutable(); - columnsToGet_.addAll(other.columnsToGet_); - } - onChanged(); - } - if (other.hasLimit()) { - setLimit(other.getLimit()); - } - if (inclusiveStartPrimaryKeyBuilder_ == null) { - if (!other.inclusiveStartPrimaryKey_.isEmpty()) { - if (inclusiveStartPrimaryKey_.isEmpty()) { - inclusiveStartPrimaryKey_ = other.inclusiveStartPrimaryKey_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.addAll(other.inclusiveStartPrimaryKey_); - } - onChanged(); - } - } else { - if (!other.inclusiveStartPrimaryKey_.isEmpty()) { - if (inclusiveStartPrimaryKeyBuilder_.isEmpty()) { - inclusiveStartPrimaryKeyBuilder_.dispose(); - inclusiveStartPrimaryKeyBuilder_ = null; - inclusiveStartPrimaryKey_ = other.inclusiveStartPrimaryKey_; - bitField0_ = (bitField0_ & ~0x00000010); - inclusiveStartPrimaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getInclusiveStartPrimaryKeyFieldBuilder() : null; - } else { - inclusiveStartPrimaryKeyBuilder_.addAllMessages(other.inclusiveStartPrimaryKey_); - } - } - } - if (exclusiveEndPrimaryKeyBuilder_ == null) { - if (!other.exclusiveEndPrimaryKey_.isEmpty()) { - if (exclusiveEndPrimaryKey_.isEmpty()) { - exclusiveEndPrimaryKey_ = other.exclusiveEndPrimaryKey_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.addAll(other.exclusiveEndPrimaryKey_); - } - onChanged(); - } - } else { - if (!other.exclusiveEndPrimaryKey_.isEmpty()) { - if (exclusiveEndPrimaryKeyBuilder_.isEmpty()) { - exclusiveEndPrimaryKeyBuilder_.dispose(); - exclusiveEndPrimaryKeyBuilder_ = null; - exclusiveEndPrimaryKey_ = other.exclusiveEndPrimaryKey_; - bitField0_ = (bitField0_ & ~0x00000020); - exclusiveEndPrimaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getExclusiveEndPrimaryKeyFieldBuilder() : null; - } else { - exclusiveEndPrimaryKeyBuilder_.addAllMessages(other.exclusiveEndPrimaryKey_); - } - } - } - if (other.hasFilter()) { - mergeFilter(other.getFilter()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasTableName()) { - - return false; - } - if (!hasDirection()) { - - return false; - } - for (int i = 0; i < getInclusiveStartPrimaryKeyCount(); i++) { - if (!getInclusiveStartPrimaryKey(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getExclusiveEndPrimaryKeyCount(); i++) { - if (!getExclusiveEndPrimaryKey(i).isInitialized()) { - - return false; - } - } - if (hasFilter()) { - if (!getFilter().isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - tableName_ = input.readBytes(); - break; - } - case 16: { - int rawValue = input.readEnum(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction value = com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - bitField0_ |= 0x00000002; - direction_ = value; - } - break; - } - case 26: { - ensureColumnsToGetIsMutable(); - columnsToGet_.add(input.readBytes()); - break; - } - case 32: { - bitField0_ |= 0x00000008; - limit_ = input.readInt32(); - break; - } - case 42: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addInclusiveStartPrimaryKey(subBuilder.buildPartial()); - break; - } - case 50: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addExclusiveEndPrimaryKey(subBuilder.buildPartial()); - break; - } - case 58: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(); - if (hasFilter()) { - subBuilder.mergeFrom(getFilter()); - } - input.readMessage(subBuilder, extensionRegistry); - setFilter(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required string table_name = 1; - private java.lang.Object tableName_ = ""; - public boolean hasTableName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - return this; - } - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000001); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - tableName_ = value; - onChanged(); - } - - // required .com.aliyun.openservices.ots.protocol.Direction direction = 2; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction direction_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.FORWARD; - public boolean hasDirection() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction getDirection() { - return direction_; - } - public Builder setDirection(com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - direction_ = value; - onChanged(); - return this; - } - public Builder clearDirection() { - bitField0_ = (bitField0_ & ~0x00000002); - direction_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.FORWARD; - onChanged(); - return this; - } - - // repeated string columns_to_get = 3; - private com.google.protobuf.LazyStringList columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureColumnsToGetIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - columnsToGet_ = new com.google.protobuf.LazyStringArrayList(columnsToGet_); - bitField0_ |= 0x00000004; - } - } - public java.util.List - getColumnsToGetList() { - return java.util.Collections.unmodifiableList(columnsToGet_); - } - public int getColumnsToGetCount() { - return columnsToGet_.size(); - } - public String getColumnsToGet(int index) { - return columnsToGet_.get(index); - } - public Builder setColumnsToGet( - int index, String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsToGetIsMutable(); - columnsToGet_.set(index, value); - onChanged(); - return this; - } - public Builder addColumnsToGet(String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsToGetIsMutable(); - columnsToGet_.add(value); - onChanged(); - return this; - } - public Builder addAllColumnsToGet( - java.lang.Iterable values) { - ensureColumnsToGetIsMutable(); - super.addAll(values, columnsToGet_); - onChanged(); - return this; - } - public Builder clearColumnsToGet() { - columnsToGet_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - void addColumnsToGet(com.google.protobuf.ByteString value) { - ensureColumnsToGetIsMutable(); - columnsToGet_.add(value); - onChanged(); - } - - // optional int32 limit = 4; - private int limit_ ; - public boolean hasLimit() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - public int getLimit() { - return limit_; - } - public Builder setLimit(int value) { - bitField0_ |= 0x00000008; - limit_ = value; - onChanged(); - return this; - } - public Builder clearLimit() { - bitField0_ = (bitField0_ & ~0x00000008); - limit_ = 0; - onChanged(); - return this; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column inclusive_start_primary_key = 5; - private java.util.List inclusiveStartPrimaryKey_ = - java.util.Collections.emptyList(); - private void ensureInclusiveStartPrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - inclusiveStartPrimaryKey_ = new java.util.ArrayList(inclusiveStartPrimaryKey_); - bitField0_ |= 0x00000010; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> inclusiveStartPrimaryKeyBuilder_; - - public java.util.List getInclusiveStartPrimaryKeyList() { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(inclusiveStartPrimaryKey_); - } else { - return inclusiveStartPrimaryKeyBuilder_.getMessageList(); - } - } - public int getInclusiveStartPrimaryKeyCount() { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - return inclusiveStartPrimaryKey_.size(); - } else { - return inclusiveStartPrimaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getInclusiveStartPrimaryKey(int index) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - return inclusiveStartPrimaryKey_.get(index); - } else { - return inclusiveStartPrimaryKeyBuilder_.getMessage(index); - } - } - public Builder setInclusiveStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.set(index, value); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setInclusiveStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addInclusiveStartPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.add(value); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addInclusiveStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.add(index, value); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addInclusiveStartPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.add(builderForValue.build()); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addInclusiveStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllInclusiveStartPrimaryKey( - java.lang.Iterable values) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - ensureInclusiveStartPrimaryKeyIsMutable(); - super.addAll(values, inclusiveStartPrimaryKey_); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearInclusiveStartPrimaryKey() { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - inclusiveStartPrimaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.clear(); - } - return this; - } - public Builder removeInclusiveStartPrimaryKey(int index) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - ensureInclusiveStartPrimaryKeyIsMutable(); - inclusiveStartPrimaryKey_.remove(index); - onChanged(); - } else { - inclusiveStartPrimaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getInclusiveStartPrimaryKeyBuilder( - int index) { - return getInclusiveStartPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getInclusiveStartPrimaryKeyOrBuilder( - int index) { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - return inclusiveStartPrimaryKey_.get(index); } else { - return inclusiveStartPrimaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getInclusiveStartPrimaryKeyOrBuilderList() { - if (inclusiveStartPrimaryKeyBuilder_ != null) { - return inclusiveStartPrimaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(inclusiveStartPrimaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addInclusiveStartPrimaryKeyBuilder() { - return getInclusiveStartPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addInclusiveStartPrimaryKeyBuilder( - int index) { - return getInclusiveStartPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getInclusiveStartPrimaryKeyBuilderList() { - return getInclusiveStartPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getInclusiveStartPrimaryKeyFieldBuilder() { - if (inclusiveStartPrimaryKeyBuilder_ == null) { - inclusiveStartPrimaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - inclusiveStartPrimaryKey_, - ((bitField0_ & 0x00000010) == 0x00000010), - getParentForChildren(), - isClean()); - inclusiveStartPrimaryKey_ = null; - } - return inclusiveStartPrimaryKeyBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column exclusive_end_primary_key = 6; - private java.util.List exclusiveEndPrimaryKey_ = - java.util.Collections.emptyList(); - private void ensureExclusiveEndPrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - exclusiveEndPrimaryKey_ = new java.util.ArrayList(exclusiveEndPrimaryKey_); - bitField0_ |= 0x00000020; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> exclusiveEndPrimaryKeyBuilder_; - - public java.util.List getExclusiveEndPrimaryKeyList() { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(exclusiveEndPrimaryKey_); - } else { - return exclusiveEndPrimaryKeyBuilder_.getMessageList(); - } - } - public int getExclusiveEndPrimaryKeyCount() { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - return exclusiveEndPrimaryKey_.size(); - } else { - return exclusiveEndPrimaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getExclusiveEndPrimaryKey(int index) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - return exclusiveEndPrimaryKey_.get(index); - } else { - return exclusiveEndPrimaryKeyBuilder_.getMessage(index); - } - } - public Builder setExclusiveEndPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.set(index, value); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setExclusiveEndPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addExclusiveEndPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.add(value); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addExclusiveEndPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.add(index, value); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addExclusiveEndPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.add(builderForValue.build()); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addExclusiveEndPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllExclusiveEndPrimaryKey( - java.lang.Iterable values) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - ensureExclusiveEndPrimaryKeyIsMutable(); - super.addAll(values, exclusiveEndPrimaryKey_); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearExclusiveEndPrimaryKey() { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - exclusiveEndPrimaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.clear(); - } - return this; - } - public Builder removeExclusiveEndPrimaryKey(int index) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - ensureExclusiveEndPrimaryKeyIsMutable(); - exclusiveEndPrimaryKey_.remove(index); - onChanged(); - } else { - exclusiveEndPrimaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getExclusiveEndPrimaryKeyBuilder( - int index) { - return getExclusiveEndPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getExclusiveEndPrimaryKeyOrBuilder( - int index) { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - return exclusiveEndPrimaryKey_.get(index); } else { - return exclusiveEndPrimaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getExclusiveEndPrimaryKeyOrBuilderList() { - if (exclusiveEndPrimaryKeyBuilder_ != null) { - return exclusiveEndPrimaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(exclusiveEndPrimaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addExclusiveEndPrimaryKeyBuilder() { - return getExclusiveEndPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addExclusiveEndPrimaryKeyBuilder( - int index) { - return getExclusiveEndPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getExclusiveEndPrimaryKeyBuilderList() { - return getExclusiveEndPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getExclusiveEndPrimaryKeyFieldBuilder() { - if (exclusiveEndPrimaryKeyBuilder_ == null) { - exclusiveEndPrimaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - exclusiveEndPrimaryKey_, - ((bitField0_ & 0x00000020) == 0x00000020), - getParentForChildren(), - isClean()); - exclusiveEndPrimaryKey_ = null; - } - return exclusiveEndPrimaryKeyBuilder_; - } - - // optional .com.aliyun.openservices.ots.protocol.ColumnCondition filter = 7; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> filterBuilder_; - public boolean hasFilter() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition getFilter() { - if (filterBuilder_ == null) { - return filter_; - } else { - return filterBuilder_.getMessage(); - } - } - public Builder setFilter(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (filterBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - filter_ = value; - onChanged(); - } else { - filterBuilder_.setMessage(value); - } - bitField0_ |= 0x00000040; - return this; - } - public Builder setFilter( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder builderForValue) { - if (filterBuilder_ == null) { - filter_ = builderForValue.build(); - onChanged(); - } else { - filterBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000040; - return this; - } - public Builder mergeFilter(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition value) { - if (filterBuilder_ == null) { - if (((bitField0_ & 0x00000040) == 0x00000040) && - filter_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance()) { - filter_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.newBuilder(filter_).mergeFrom(value).buildPartial(); - } else { - filter_ = value; - } - onChanged(); - } else { - filterBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000040; - return this; - } - public Builder clearFilter() { - if (filterBuilder_ == null) { - filter_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.getDefaultInstance(); - onChanged(); - } else { - filterBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder getFilterBuilder() { - bitField0_ |= 0x00000040; - onChanged(); - return getFilterFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder getFilterOrBuilder() { - if (filterBuilder_ != null) { - return filterBuilder_.getMessageOrBuilder(); - } else { - return filter_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder> - getFilterFieldBuilder() { - if (filterBuilder_ == null) { - filterBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnConditionOrBuilder>( - filter_, - getParentForChildren(), - isClean()); - filter_ = null; - } - return filterBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.GetRangeRequest) - } - - static { - defaultInstance = new GetRangeRequest(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.GetRangeRequest) - } - - public interface GetRangeResponseOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - boolean hasConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder(); - - // repeated .com.aliyun.openservices.ots.protocol.Column next_start_primary_key = 2; - java.util.List - getNextStartPrimaryKeyList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getNextStartPrimaryKey(int index); - int getNextStartPrimaryKeyCount(); - java.util.List - getNextStartPrimaryKeyOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getNextStartPrimaryKeyOrBuilder( - int index); - - // repeated .com.aliyun.openservices.ots.protocol.Row rows = 3; - java.util.List - getRowsList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRows(int index); - int getRowsCount(); - java.util.List - getRowsOrBuilderList(); - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowsOrBuilder( - int index); - } - public static final class GetRangeResponse extends - com.google.protobuf.GeneratedMessage - implements GetRangeResponseOrBuilder { - // Use GetRangeResponse.newBuilder() to construct. - private GetRangeResponse(Builder builder) { - super(builder); - } - private GetRangeResponse(boolean noInit) {} - - private static final GetRangeResponse defaultInstance; - public static GetRangeResponse getDefaultInstance() { - return defaultInstance; - } - - public GetRangeResponse getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_fieldAccessorTable; - } - - private int bitField0_; - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - public static final int CONSUMED_FIELD_NUMBER = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - return consumed_; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - return consumed_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column next_start_primary_key = 2; - public static final int NEXT_START_PRIMARY_KEY_FIELD_NUMBER = 2; - private java.util.List nextStartPrimaryKey_; - public java.util.List getNextStartPrimaryKeyList() { - return nextStartPrimaryKey_; - } - public java.util.List - getNextStartPrimaryKeyOrBuilderList() { - return nextStartPrimaryKey_; - } - public int getNextStartPrimaryKeyCount() { - return nextStartPrimaryKey_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getNextStartPrimaryKey(int index) { - return nextStartPrimaryKey_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getNextStartPrimaryKeyOrBuilder( - int index) { - return nextStartPrimaryKey_.get(index); - } - - // repeated .com.aliyun.openservices.ots.protocol.Row rows = 3; - public static final int ROWS_FIELD_NUMBER = 3; - private java.util.List rows_; - public java.util.List getRowsList() { - return rows_; - } - public java.util.List - getRowsOrBuilderList() { - return rows_; - } - public int getRowsCount() { - return rows_.size(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRows(int index) { - return rows_.get(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowsOrBuilder( - int index) { - return rows_.get(index); - } - - private void initFields() { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - nextStartPrimaryKey_ = java.util.Collections.emptyList(); - rows_ = java.util.Collections.emptyList(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - if (!hasConsumed()) { - memoizedIsInitialized = 0; - return false; - } - if (!getConsumed().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - for (int i = 0; i < getNextStartPrimaryKeyCount(); i++) { - if (!getNextStartPrimaryKey(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - for (int i = 0; i < getRowsCount(); i++) { - if (!getRows(i).isInitialized()) { - memoizedIsInitialized = 0; - return false; - } - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, consumed_); - } - for (int i = 0; i < nextStartPrimaryKey_.size(); i++) { - output.writeMessage(2, nextStartPrimaryKey_.get(i)); - } - for (int i = 0; i < rows_.size(); i++) { - output.writeMessage(3, rows_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, consumed_); - } - for (int i = 0; i < nextStartPrimaryKey_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, nextStartPrimaryKey_.get(i)); - } - for (int i = 0; i < rows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, rows_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_fieldAccessorTable; - } - - // Construct using com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getConsumedFieldBuilder(); - getNextStartPrimaryKeyFieldBuilder(); - getRowsFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (nextStartPrimaryKeyBuilder_ == null) { - nextStartPrimaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - nextStartPrimaryKeyBuilder_.clear(); - } - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - rowsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse.getDescriptor(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse getDefaultInstanceForType() { - return com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse.getDefaultInstance(); - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse build() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse buildPartial() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse result = new com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (consumedBuilder_ == null) { - result.consumed_ = consumed_; - } else { - result.consumed_ = consumedBuilder_.build(); - } - if (nextStartPrimaryKeyBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - nextStartPrimaryKey_ = java.util.Collections.unmodifiableList(nextStartPrimaryKey_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.nextStartPrimaryKey_ = nextStartPrimaryKey_; - } else { - result.nextStartPrimaryKey_ = nextStartPrimaryKeyBuilder_.build(); - } - if (rowsBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - rows_ = java.util.Collections.unmodifiableList(rows_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.rows_ = rows_; - } else { - result.rows_ = rowsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse) { - return mergeFrom((com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse other) { - if (other == com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse.getDefaultInstance()) return this; - if (other.hasConsumed()) { - mergeConsumed(other.getConsumed()); - } - if (nextStartPrimaryKeyBuilder_ == null) { - if (!other.nextStartPrimaryKey_.isEmpty()) { - if (nextStartPrimaryKey_.isEmpty()) { - nextStartPrimaryKey_ = other.nextStartPrimaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.addAll(other.nextStartPrimaryKey_); - } - onChanged(); - } - } else { - if (!other.nextStartPrimaryKey_.isEmpty()) { - if (nextStartPrimaryKeyBuilder_.isEmpty()) { - nextStartPrimaryKeyBuilder_.dispose(); - nextStartPrimaryKeyBuilder_ = null; - nextStartPrimaryKey_ = other.nextStartPrimaryKey_; - bitField0_ = (bitField0_ & ~0x00000002); - nextStartPrimaryKeyBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getNextStartPrimaryKeyFieldBuilder() : null; - } else { - nextStartPrimaryKeyBuilder_.addAllMessages(other.nextStartPrimaryKey_); - } - } - } - if (rowsBuilder_ == null) { - if (!other.rows_.isEmpty()) { - if (rows_.isEmpty()) { - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureRowsIsMutable(); - rows_.addAll(other.rows_); - } - onChanged(); - } - } else { - if (!other.rows_.isEmpty()) { - if (rowsBuilder_.isEmpty()) { - rowsBuilder_.dispose(); - rowsBuilder_ = null; - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000004); - rowsBuilder_ = - com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? - getRowsFieldBuilder() : null; - } else { - rowsBuilder_.addAllMessages(other.rows_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - if (!hasConsumed()) { - - return false; - } - if (!getConsumed().isInitialized()) { - - return false; - } - for (int i = 0; i < getNextStartPrimaryKeyCount(); i++) { - if (!getNextStartPrimaryKey(i).isInitialized()) { - - return false; - } - } - for (int i = 0; i < getRowsCount(); i++) { - if (!getRows(i).isInitialized()) { - - return false; - } - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(); - if (hasConsumed()) { - subBuilder.mergeFrom(getConsumed()); - } - input.readMessage(subBuilder, extensionRegistry); - setConsumed(subBuilder.buildPartial()); - break; - } - case 18: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addNextStartPrimaryKey(subBuilder.buildPartial()); - break; - } - case 26: { - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder subBuilder = com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addRows(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // required .com.aliyun.openservices.ots.protocol.ConsumedCapacity consumed = 1; - private com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> consumedBuilder_; - public boolean hasConsumed() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity getConsumed() { - if (consumedBuilder_ == null) { - return consumed_; - } else { - return consumedBuilder_.getMessage(); - } - } - public Builder setConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - consumed_ = value; - onChanged(); - } else { - consumedBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder setConsumed( - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder builderForValue) { - if (consumedBuilder_ == null) { - consumed_ = builderForValue.build(); - onChanged(); - } else { - consumedBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder mergeConsumed(com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity value) { - if (consumedBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - consumed_ != com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance()) { - consumed_ = - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.newBuilder(consumed_).mergeFrom(value).buildPartial(); - } else { - consumed_ = value; - } - onChanged(); - } else { - consumedBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - public Builder clearConsumed() { - if (consumedBuilder_ == null) { - consumed_ = com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.getDefaultInstance(); - onChanged(); - } else { - consumedBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder getConsumedBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getConsumedFieldBuilder().getBuilder(); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder getConsumedOrBuilder() { - if (consumedBuilder_ != null) { - return consumedBuilder_.getMessageOrBuilder(); - } else { - return consumed_; - } - } - private com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder> - getConsumedFieldBuilder() { - if (consumedBuilder_ == null) { - consumedBuilder_ = new com.google.protobuf.SingleFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacityOrBuilder>( - consumed_, - getParentForChildren(), - isClean()); - consumed_ = null; - } - return consumedBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Column next_start_primary_key = 2; - private java.util.List nextStartPrimaryKey_ = - java.util.Collections.emptyList(); - private void ensureNextStartPrimaryKeyIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - nextStartPrimaryKey_ = new java.util.ArrayList(nextStartPrimaryKey_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> nextStartPrimaryKeyBuilder_; - - public java.util.List getNextStartPrimaryKeyList() { - if (nextStartPrimaryKeyBuilder_ == null) { - return java.util.Collections.unmodifiableList(nextStartPrimaryKey_); - } else { - return nextStartPrimaryKeyBuilder_.getMessageList(); - } - } - public int getNextStartPrimaryKeyCount() { - if (nextStartPrimaryKeyBuilder_ == null) { - return nextStartPrimaryKey_.size(); - } else { - return nextStartPrimaryKeyBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column getNextStartPrimaryKey(int index) { - if (nextStartPrimaryKeyBuilder_ == null) { - return nextStartPrimaryKey_.get(index); - } else { - return nextStartPrimaryKeyBuilder_.getMessage(index); - } - } - public Builder setNextStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (nextStartPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.set(index, value); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.setMessage(index, value); - } - return this; - } - public Builder setNextStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (nextStartPrimaryKeyBuilder_ == null) { - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.set(index, builderForValue.build()); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addNextStartPrimaryKey(com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (nextStartPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.add(value); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.addMessage(value); - } - return this; - } - public Builder addNextStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column value) { - if (nextStartPrimaryKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.add(index, value); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.addMessage(index, value); - } - return this; - } - public Builder addNextStartPrimaryKey( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (nextStartPrimaryKeyBuilder_ == null) { - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.add(builderForValue.build()); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addNextStartPrimaryKey( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder builderForValue) { - if (nextStartPrimaryKeyBuilder_ == null) { - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.add(index, builderForValue.build()); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllNextStartPrimaryKey( - java.lang.Iterable values) { - if (nextStartPrimaryKeyBuilder_ == null) { - ensureNextStartPrimaryKeyIsMutable(); - super.addAll(values, nextStartPrimaryKey_); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearNextStartPrimaryKey() { - if (nextStartPrimaryKeyBuilder_ == null) { - nextStartPrimaryKey_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.clear(); - } - return this; - } - public Builder removeNextStartPrimaryKey(int index) { - if (nextStartPrimaryKeyBuilder_ == null) { - ensureNextStartPrimaryKeyIsMutable(); - nextStartPrimaryKey_.remove(index); - onChanged(); - } else { - nextStartPrimaryKeyBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder getNextStartPrimaryKeyBuilder( - int index) { - return getNextStartPrimaryKeyFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder getNextStartPrimaryKeyOrBuilder( - int index) { - if (nextStartPrimaryKeyBuilder_ == null) { - return nextStartPrimaryKey_.get(index); } else { - return nextStartPrimaryKeyBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getNextStartPrimaryKeyOrBuilderList() { - if (nextStartPrimaryKeyBuilder_ != null) { - return nextStartPrimaryKeyBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(nextStartPrimaryKey_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addNextStartPrimaryKeyBuilder() { - return getNextStartPrimaryKeyFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder addNextStartPrimaryKeyBuilder( - int index) { - return getNextStartPrimaryKeyFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.getDefaultInstance()); - } - public java.util.List - getNextStartPrimaryKeyBuilderList() { - return getNextStartPrimaryKeyFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder> - getNextStartPrimaryKeyFieldBuilder() { - if (nextStartPrimaryKeyBuilder_ == null) { - nextStartPrimaryKeyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column, com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnOrBuilder>( - nextStartPrimaryKey_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - nextStartPrimaryKey_ = null; - } - return nextStartPrimaryKeyBuilder_; - } - - // repeated .com.aliyun.openservices.ots.protocol.Row rows = 3; - private java.util.List rows_ = - java.util.Collections.emptyList(); - private void ensureRowsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - rows_ = new java.util.ArrayList(rows_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder> rowsBuilder_; - - public java.util.List getRowsList() { - if (rowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(rows_); - } else { - return rowsBuilder_.getMessageList(); - } - } - public int getRowsCount() { - if (rowsBuilder_ == null) { - return rows_.size(); - } else { - return rowsBuilder_.getCount(); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row getRows(int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); - } else { - return rowsBuilder_.getMessage(index); - } - } - public Builder setRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.set(index, value); - onChanged(); - } else { - rowsBuilder_.setMessage(index, value); - } - return this; - } - public Builder setRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.set(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - public Builder addRows(com.aliyun.openservices.ots.protocol.OtsProtocol2.Row value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(value); - onChanged(); - } else { - rowsBuilder_.addMessage(value); - } - return this; - } - public Builder addRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(index, value); - onChanged(); - } else { - rowsBuilder_.addMessage(index, value); - } - return this; - } - public Builder addRows( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - public Builder addRows( - int index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - public Builder addAllRows( - java.lang.Iterable values) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - super.addAll(values, rows_); - onChanged(); - } else { - rowsBuilder_.addAllMessages(values); - } - return this; - } - public Builder clearRows() { - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - rowsBuilder_.clear(); - } - return this; - } - public Builder removeRows(int index) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.remove(index); - onChanged(); - } else { - rowsBuilder_.remove(index); - } - return this; - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder getRowsBuilder( - int index) { - return getRowsFieldBuilder().getBuilder(index); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder getRowsOrBuilder( - int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); } else { - return rowsBuilder_.getMessageOrBuilder(index); - } - } - public java.util.List - getRowsOrBuilderList() { - if (rowsBuilder_ != null) { - return rowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(rows_); - } - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder addRowsBuilder() { - return getRowsFieldBuilder().addBuilder( - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance()); - } - public com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder addRowsBuilder( - int index) { - return getRowsFieldBuilder().addBuilder( - index, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.getDefaultInstance()); - } - public java.util.List - getRowsBuilderList() { - return getRowsFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder> - getRowsFieldBuilder() { - if (rowsBuilder_ == null) { - rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row, com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder, com.aliyun.openservices.ots.protocol.OtsProtocol2.RowOrBuilder>( - rows_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - rows_ = null; - } - return rowsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.aliyun.openservices.ots.protocol.GetRangeResponse) - } - - static { - defaultInstance = new GetRangeResponse(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.aliyun.openservices.ots.protocol.GetRangeResponse) - } - - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_Error_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_Error_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_Column_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_Column_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_Row_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_Row_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_TableMeta_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_TableMeta_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_Condition_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_Condition_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\024ots_protocol.2.proto\022$com.aliyun.opens" + - "ervices.ots.protocol\"&\n\005Error\022\014\n\004code\030\001 " + - "\002(\t\022\017\n\007message\030\002 \001(\t\"\\\n\014ColumnSchema\022\014\n\004" + - "name\030\001 \002(\t\022>\n\004type\030\002 \002(\01620.com.aliyun.op" + - "enservices.ots.protocol.ColumnType\"\242\001\n\013C" + - "olumnValue\022>\n\004type\030\001 \002(\01620.com.aliyun.op" + - "enservices.ots.protocol.ColumnType\022\r\n\005v_" + - "int\030\002 \001(\003\022\020\n\010v_string\030\003 \001(\t\022\016\n\006v_bool\030\004 " + - "\001(\010\022\020\n\010v_double\030\005 \001(\001\022\020\n\010v_binary\030\006 \001(\014\"" + - "X\n\006Column\022\014\n\004name\030\001 \002(\t\022@\n\005value\030\002 \002(\01321", - ".com.aliyun.openservices.ots.protocol.Co" + - "lumnValue\"\231\001\n\003Row\022I\n\023primary_key_columns" + - "\030\001 \003(\0132,.com.aliyun.openservices.ots.pro" + - "tocol.Column\022G\n\021attribute_columns\030\002 \003(\0132" + - ",.com.aliyun.openservices.ots.protocol.C" + - "olumn\"h\n\tTableMeta\022\022\n\ntable_name\030\001 \002(\t\022G" + - "\n\013primary_key\030\002 \003(\01322.com.aliyun.openser" + - "vices.ots.protocol.ColumnSchema\"\324\001\n\021Rela" + - "tionCondition\022H\n\ncomparator\030\001 \002(\01624.com." + - "aliyun.openservices.ots.protocol.Compara", - "torType\022\023\n\013column_name\030\002 \002(\t\022G\n\014column_v" + - "alue\030\003 \002(\01321.com.aliyun.openservices.ots" + - ".protocol.ColumnValue\022\027\n\017pass_if_missing" + - "\030\004 \002(\010\"\256\001\n\022CompositeCondition\022I\n\ncombina" + - "tor\030\001 \002(\01625.com.aliyun.openservices.ots." + - "protocol.LogicalOperator\022M\n\016sub_conditio" + - "ns\030\002 \003(\01325.com.aliyun.openservices.ots.p" + - "rotocol.ColumnCondition\"m\n\017ColumnConditi" + - "on\022G\n\004type\030\001 \002(\01629.com.aliyun.openservic" + - "es.ots.protocol.ColumnConditionType\022\021\n\tc", - "ondition\030\002 \002(\014\"\262\001\n\tCondition\022T\n\rrow_exis" + - "tence\030\001 \002(\0162=.com.aliyun.openservices.ot" + - "s.protocol.RowExistenceExpectation\022O\n\020co" + - "lumn_condition\030\002 \001(\01325.com.aliyun.opense" + - "rvices.ots.protocol.ColumnCondition\"+\n\014C" + - "apacityUnit\022\014\n\004read\030\001 \001(\005\022\r\n\005write\030\002 \001(\005" + - "\"\301\001\n\031ReservedThroughputDetails\022I\n\rcapaci" + - "ty_unit\030\001 \002(\01322.com.aliyun.openservices." + - "ots.protocol.CapacityUnit\022\032\n\022last_increa" + - "se_time\030\002 \002(\003\022\032\n\022last_decrease_time\030\003 \001(", - "\003\022!\n\031number_of_decreases_today\030\004 \002(\005\"_\n\022" + - "ReservedThroughput\022I\n\rcapacity_unit\030\001 \002(" + - "\01322.com.aliyun.openservices.ots.protocol" + - ".CapacityUnit\"]\n\020ConsumedCapacity\022I\n\rcap" + - "acity_unit\030\001 \002(\01322.com.aliyun.openservic" + - "es.ots.protocol.CapacityUnit\"\260\001\n\022CreateT" + - "ableRequest\022C\n\ntable_meta\030\001 \002(\0132/.com.al" + - "iyun.openservices.ots.protocol.TableMeta" + - "\022U\n\023reserved_throughput\030\002 \002(\01328.com.aliy" + - "un.openservices.ots.protocol.ReservedThr", - "oughput\"\025\n\023CreateTableResponse\"\177\n\022Update" + - "TableRequest\022\022\n\ntable_name\030\001 \002(\t\022U\n\023rese" + - "rved_throughput\030\002 \002(\01328.com.aliyun.opens" + - "ervices.ots.protocol.ReservedThroughput\"" + - "{\n\023UpdateTableResponse\022d\n\033reserved_throu" + - "ghput_details\030\001 \002(\0132?.com.aliyun.openser" + - "vices.ots.protocol.ReservedThroughputDet" + - "ails\"*\n\024DescribeTableRequest\022\022\n\ntable_na" + - "me\030\001 \002(\t\"\302\001\n\025DescribeTableResponse\022C\n\nta" + - "ble_meta\030\001 \002(\0132/.com.aliyun.openservices", - ".ots.protocol.TableMeta\022d\n\033reserved_thro" + - "ughput_details\030\002 \002(\0132?.com.aliyun.opense" + - "rvices.ots.protocol.ReservedThroughputDe" + - "tails\"\022\n\020ListTableRequest\"(\n\021ListTableRe" + - "sponse\022\023\n\013table_names\030\001 \003(\t\"(\n\022DeleteTab" + - "leRequest\022\022\n\ntable_name\030\001 \002(\t\"\025\n\023DeleteT" + - "ableResponse\"\305\001\n\rGetRowRequest\022\022\n\ntable_" + - "name\030\001 \002(\t\022A\n\013primary_key\030\002 \003(\0132,.com.al" + - "iyun.openservices.ots.protocol.Column\022\026\n" + - "\016columns_to_get\030\003 \003(\t\022E\n\006filter\030\004 \001(\01325.", - "com.aliyun.openservices.ots.protocol.Col" + - "umnCondition\"\222\001\n\016GetRowResponse\022H\n\010consu" + - "med\030\001 \002(\01326.com.aliyun.openservices.ots." + - "protocol.ConsumedCapacity\0226\n\003row\030\002 \002(\0132)" + - ".com.aliyun.openservices.ots.protocol.Ro" + - "w\"\241\001\n\014ColumnUpdate\022A\n\004type\030\001 \002(\01623.com.a" + - "liyun.openservices.ots.protocol.Operatio" + - "nType\022\014\n\004name\030\002 \002(\t\022@\n\005value\030\003 \001(\01321.com" + - ".aliyun.openservices.ots.protocol.Column" + - "Value\"\374\001\n\020UpdateRowRequest\022\022\n\ntable_name", - "\030\001 \002(\t\022B\n\tcondition\030\002 \002(\0132/.com.aliyun.o" + - "penservices.ots.protocol.Condition\022A\n\013pr" + - "imary_key\030\003 \003(\0132,.com.aliyun.openservice" + - "s.ots.protocol.Column\022M\n\021attribute_colum" + - "ns\030\004 \003(\01322.com.aliyun.openservices.ots.p" + - "rotocol.ColumnUpdate\"]\n\021UpdateRowRespons" + - "e\022H\n\010consumed\030\001 \002(\01326.com.aliyun.openser" + - "vices.ots.protocol.ConsumedCapacity\"\363\001\n\r" + - "PutRowRequest\022\022\n\ntable_name\030\001 \002(\t\022B\n\tcon" + - "dition\030\002 \002(\0132/.com.aliyun.openservices.o", - "ts.protocol.Condition\022A\n\013primary_key\030\003 \003" + - "(\0132,.com.aliyun.openservices.ots.protoco" + - "l.Column\022G\n\021attribute_columns\030\004 \003(\0132,.co" + - "m.aliyun.openservices.ots.protocol.Colum" + - "n\"Z\n\016PutRowResponse\022H\n\010consumed\030\001 \002(\01326." + - "com.aliyun.openservices.ots.protocol.Con" + - "sumedCapacity\"\255\001\n\020DeleteRowRequest\022\022\n\nta" + - "ble_name\030\001 \002(\t\022B\n\tcondition\030\002 \002(\0132/.com." + - "aliyun.openservices.ots.protocol.Conditi" + - "on\022A\n\013primary_key\030\003 \003(\0132,.com.aliyun.ope", - "nservices.ots.protocol.Column\"]\n\021DeleteR" + - "owResponse\022H\n\010consumed\030\001 \002(\01326.com.aliyu" + - "n.openservices.ots.protocol.ConsumedCapa" + - "city\"\\\n\027RowInBatchGetRowRequest\022A\n\013prima" + - "ry_key\030\001 \003(\0132,.com.aliyun.openservices.o" + - "ts.protocol.Column\"\333\001\n\031TableInBatchGetRo" + - "wRequest\022\022\n\ntable_name\030\001 \002(\t\022K\n\004rows\030\002 \003" + - "(\0132=.com.aliyun.openservices.ots.protoco" + - "l.RowInBatchGetRowRequest\022\026\n\016columns_to_" + - "get\030\003 \003(\t\022E\n\006filter\030\004 \001(\01325.com.aliyun.o", - "penservices.ots.protocol.ColumnCondition" + - "\"e\n\022BatchGetRowRequest\022O\n\006tables\030\001 \003(\0132?" + - ".com.aliyun.openservices.ots.protocol.Ta" + - "bleInBatchGetRowRequest\"\355\001\n\030RowInBatchGe" + - "tRowResponse\022\023\n\005is_ok\030\001 \002(\010:\004true\022:\n\005err" + - "or\030\002 \001(\0132+.com.aliyun.openservices.ots.p" + - "rotocol.Error\022H\n\010consumed\030\003 \001(\01326.com.al" + - "iyun.openservices.ots.protocol.ConsumedC" + - "apacity\0226\n\003row\030\004 \001(\0132).com.aliyun.opense" + - "rvices.ots.protocol.Row\"~\n\032TableInBatchG", - "etRowResponse\022\022\n\ntable_name\030\001 \002(\t\022L\n\004row" + - "s\030\002 \003(\0132>.com.aliyun.openservices.ots.pr" + - "otocol.RowInBatchGetRowResponse\"g\n\023Batch" + - "GetRowResponse\022P\n\006tables\030\001 \003(\0132@.com.ali" + - "yun.openservices.ots.protocol.TableInBat" + - "chGetRowResponse\"\356\001\n\034PutRowInBatchWriteR" + - "owRequest\022B\n\tcondition\030\001 \002(\0132/.com.aliyu" + - "n.openservices.ots.protocol.Condition\022A\n" + - "\013primary_key\030\002 \003(\0132,.com.aliyun.openserv" + - "ices.ots.protocol.Column\022G\n\021attribute_co", - "lumns\030\003 \003(\0132,.com.aliyun.openservices.ot" + - "s.protocol.Column\"\367\001\n\037UpdateRowInBatchWr" + - "iteRowRequest\022B\n\tcondition\030\001 \002(\0132/.com.a" + - "liyun.openservices.ots.protocol.Conditio" + - "n\022A\n\013primary_key\030\002 \003(\0132,.com.aliyun.open" + - "services.ots.protocol.Column\022M\n\021attribut" + - "e_columns\030\003 \003(\01322.com.aliyun.openservice" + - "s.ots.protocol.ColumnUpdate\"\250\001\n\037DeleteRo" + - "wInBatchWriteRowRequest\022B\n\tcondition\030\001 \002" + - "(\0132/.com.aliyun.openservices.ots.protoco", - "l.Condition\022A\n\013primary_key\030\002 \003(\0132,.com.a" + - "liyun.openservices.ots.protocol.Column\"\277" + - "\002\n\033TableInBatchWriteRowRequest\022\022\n\ntable_" + - "name\030\001 \002(\t\022T\n\010put_rows\030\002 \003(\0132B.com.aliyu" + - "n.openservices.ots.protocol.PutRowInBatc" + - "hWriteRowRequest\022Z\n\013update_rows\030\003 \003(\0132E." + - "com.aliyun.openservices.ots.protocol.Upd" + - "ateRowInBatchWriteRowRequest\022Z\n\013delete_r" + - "ows\030\004 \003(\0132E.com.aliyun.openservices.ots." + - "protocol.DeleteRowInBatchWriteRowRequest", - "\"i\n\024BatchWriteRowRequest\022Q\n\006tables\030\001 \003(\013" + - "2A.com.aliyun.openservices.ots.protocol." + - "TableInBatchWriteRowRequest\"\267\001\n\032RowInBat" + - "chWriteRowResponse\022\023\n\005is_ok\030\001 \002(\010:\004true\022" + - ":\n\005error\030\002 \001(\0132+.com.aliyun.openservices" + - ".ots.protocol.Error\022H\n\010consumed\030\003 \001(\01326." + - "com.aliyun.openservices.ots.protocol.Con" + - "sumedCapacity\"\264\002\n\034TableInBatchWriteRowRe" + - "sponse\022\022\n\ntable_name\030\001 \002(\t\022R\n\010put_rows\030\002" + - " \003(\0132@.com.aliyun.openservices.ots.proto", - "col.RowInBatchWriteRowResponse\022U\n\013update" + - "_rows\030\003 \003(\0132@.com.aliyun.openservices.ot" + - "s.protocol.RowInBatchWriteRowResponse\022U\n" + - "\013delete_rows\030\004 \003(\0132@.com.aliyun.openserv" + - "ices.ots.protocol.RowInBatchWriteRowResp" + - "onse\"k\n\025BatchWriteRowResponse\022R\n\006tables\030" + - "\001 \003(\0132B.com.aliyun.openservices.ots.prot" + - "ocol.TableInBatchWriteRowResponse\"\373\002\n\017Ge" + - "tRangeRequest\022\022\n\ntable_name\030\001 \002(\t\022B\n\tdir" + - "ection\030\002 \002(\0162/.com.aliyun.openservices.o", - "ts.protocol.Direction\022\026\n\016columns_to_get\030" + - "\003 \003(\t\022\r\n\005limit\030\004 \001(\005\022Q\n\033inclusive_start_" + - "primary_key\030\005 \003(\0132,.com.aliyun.openservi" + - "ces.ots.protocol.Column\022O\n\031exclusive_end" + - "_primary_key\030\006 \003(\0132,.com.aliyun.openserv" + - "ices.ots.protocol.Column\022E\n\006filter\030\007 \001(\013" + - "25.com.aliyun.openservices.ots.protocol." + - "ColumnCondition\"\343\001\n\020GetRangeResponse\022H\n\010" + - "consumed\030\001 \002(\01326.com.aliyun.openservices" + - ".ots.protocol.ConsumedCapacity\022L\n\026next_s", - "tart_primary_key\030\002 \003(\0132,.com.aliyun.open" + - "services.ots.protocol.Column\0227\n\004rows\030\003 \003" + - "(\0132).com.aliyun.openservices.ots.protoco" + - "l.Row*d\n\nColumnType\022\013\n\007INF_MIN\020\000\022\013\n\007INF_" + - "MAX\020\001\022\013\n\007INTEGER\020\002\022\n\n\006STRING\020\003\022\013\n\007BOOLEA" + - "N\020\004\022\n\n\006DOUBLE\020\005\022\n\n\006BINARY\020\006*M\n\027RowExiste" + - "nceExpectation\022\n\n\006IGNORE\020\000\022\020\n\014EXPECT_EXI" + - "ST\020\001\022\024\n\020EXPECT_NOT_EXIST\020\002*:\n\023ColumnCond" + - "itionType\022\020\n\014CCT_RELATION\020\001\022\021\n\rCCT_COMPO" + - "SITE\020\002*\200\001\n\016ComparatorType\022\014\n\010CT_EQUAL\020\001\022", - "\020\n\014CT_NOT_EQUAL\020\002\022\023\n\017CT_GREATER_THAN\020\003\022\024" + - "\n\020CT_GREATER_EQUAL\020\004\022\020\n\014CT_LESS_THAN\020\005\022\021" + - "\n\rCT_LESS_EQUAL\020\006*4\n\017LogicalOperator\022\n\n\006" + - "LO_NOT\020\001\022\n\n\006LO_AND\020\002\022\t\n\005LO_OR\020\003*$\n\rOpera" + - "tionType\022\007\n\003PUT\020\001\022\n\n\006DELETE\020\002*&\n\tDirecti" + - "on\022\013\n\007FORWARD\020\000\022\014\n\010BACKWARD\020\001" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - internal_static_com_aliyun_openservices_ots_protocol_Error_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_com_aliyun_openservices_ots_protocol_Error_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_Error_descriptor, - new java.lang.String[] { "Code", "Message", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Error.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ColumnSchema_descriptor, - new java.lang.String[] { "Name", "Type", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnSchema.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ColumnValue_descriptor, - new java.lang.String[] { "Type", "VInt", "VString", "VBool", "VDouble", "VBinary", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_Column_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_com_aliyun_openservices_ots_protocol_Column_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_Column_descriptor, - new java.lang.String[] { "Name", "Value", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Column.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_Row_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_com_aliyun_openservices_ots_protocol_Row_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_Row_descriptor, - new java.lang.String[] { "PrimaryKeyColumns", "AttributeColumns", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Row.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_TableMeta_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_com_aliyun_openservices_ots_protocol_TableMeta_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_TableMeta_descriptor, - new java.lang.String[] { "TableName", "PrimaryKey", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableMeta.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_RelationCondition_descriptor, - new java.lang.String[] { "Comparator", "ColumnName", "ColumnValue", "PassIfMissing", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RelationCondition.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_CompositeCondition_descriptor, - new java.lang.String[] { "Combinator", "SubConditions", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CompositeCondition.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ColumnCondition_descriptor, - new java.lang.String[] { "Type", "Condition", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnCondition.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_Condition_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_com_aliyun_openservices_ots_protocol_Condition_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_Condition_descriptor, - new java.lang.String[] { "RowExistence", "ColumnCondition", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.Condition.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_descriptor = - getDescriptor().getMessageTypes().get(10); - internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_CapacityUnit_descriptor, - new java.lang.String[] { "Read", "Write", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CapacityUnit.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_descriptor = - getDescriptor().getMessageTypes().get(11); - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughputDetails_descriptor, - new java.lang.String[] { "CapacityUnit", "LastIncreaseTime", "LastDecreaseTime", "NumberOfDecreasesToday", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughputDetails.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_descriptor = - getDescriptor().getMessageTypes().get(12); - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ReservedThroughput_descriptor, - new java.lang.String[] { "CapacityUnit", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ReservedThroughput.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_descriptor = - getDescriptor().getMessageTypes().get(13); - internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ConsumedCapacity_descriptor, - new java.lang.String[] { "CapacityUnit", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ConsumedCapacity.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_descriptor = - getDescriptor().getMessageTypes().get(14); - internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_CreateTableRequest_descriptor, - new java.lang.String[] { "TableMeta", "ReservedThroughput", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_descriptor = - getDescriptor().getMessageTypes().get(15); - internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_CreateTableResponse_descriptor, - new java.lang.String[] { }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.CreateTableResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_descriptor = - getDescriptor().getMessageTypes().get(16); - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableRequest_descriptor, - new java.lang.String[] { "TableName", "ReservedThroughput", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_descriptor = - getDescriptor().getMessageTypes().get(17); - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_UpdateTableResponse_descriptor, - new java.lang.String[] { "ReservedThroughputDetails", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateTableResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_descriptor = - getDescriptor().getMessageTypes().get(18); - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableRequest_descriptor, - new java.lang.String[] { "TableName", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_descriptor = - getDescriptor().getMessageTypes().get(19); - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_DescribeTableResponse_descriptor, - new java.lang.String[] { "TableMeta", "ReservedThroughputDetails", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DescribeTableResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_descriptor = - getDescriptor().getMessageTypes().get(20); - internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ListTableRequest_descriptor, - new java.lang.String[] { }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_descriptor = - getDescriptor().getMessageTypes().get(21); - internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ListTableResponse_descriptor, - new java.lang.String[] { "TableNames", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ListTableResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_descriptor = - getDescriptor().getMessageTypes().get(22); - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableRequest_descriptor, - new java.lang.String[] { "TableName", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_descriptor = - getDescriptor().getMessageTypes().get(23); - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_DeleteTableResponse_descriptor, - new java.lang.String[] { }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteTableResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_descriptor = - getDescriptor().getMessageTypes().get(24); - internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_GetRowRequest_descriptor, - new java.lang.String[] { "TableName", "PrimaryKey", "ColumnsToGet", "Filter", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_descriptor = - getDescriptor().getMessageTypes().get(25); - internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_GetRowResponse_descriptor, - new java.lang.String[] { "Consumed", "Row", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_descriptor = - getDescriptor().getMessageTypes().get(26); - internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_ColumnUpdate_descriptor, - new java.lang.String[] { "Type", "Name", "Value", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnUpdate.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_descriptor = - getDescriptor().getMessageTypes().get(27); - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowRequest_descriptor, - new java.lang.String[] { "TableName", "Condition", "PrimaryKey", "AttributeColumns", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_descriptor = - getDescriptor().getMessageTypes().get(28); - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowResponse_descriptor, - new java.lang.String[] { "Consumed", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_descriptor = - getDescriptor().getMessageTypes().get(29); - internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_PutRowRequest_descriptor, - new java.lang.String[] { "TableName", "Condition", "PrimaryKey", "AttributeColumns", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_descriptor = - getDescriptor().getMessageTypes().get(30); - internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_PutRowResponse_descriptor, - new java.lang.String[] { "Consumed", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_descriptor = - getDescriptor().getMessageTypes().get(31); - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowRequest_descriptor, - new java.lang.String[] { "TableName", "Condition", "PrimaryKey", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_descriptor = - getDescriptor().getMessageTypes().get(32); - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowResponse_descriptor, - new java.lang.String[] { "Consumed", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_descriptor = - getDescriptor().getMessageTypes().get(33); - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowRequest_descriptor, - new java.lang.String[] { "PrimaryKey", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_descriptor = - getDescriptor().getMessageTypes().get(34); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowRequest_descriptor, - new java.lang.String[] { "TableName", "Rows", "ColumnsToGet", "Filter", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_descriptor = - getDescriptor().getMessageTypes().get(35); - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowRequest_descriptor, - new java.lang.String[] { "Tables", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_descriptor = - getDescriptor().getMessageTypes().get(36); - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchGetRowResponse_descriptor, - new java.lang.String[] { "IsOk", "Error", "Consumed", "Row", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchGetRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_descriptor = - getDescriptor().getMessageTypes().get(37); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchGetRowResponse_descriptor, - new java.lang.String[] { "TableName", "Rows", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchGetRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_descriptor = - getDescriptor().getMessageTypes().get(38); - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_BatchGetRowResponse_descriptor, - new java.lang.String[] { "Tables", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchGetRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_descriptor = - getDescriptor().getMessageTypes().get(39); - internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_PutRowInBatchWriteRowRequest_descriptor, - new java.lang.String[] { "Condition", "PrimaryKey", "AttributeColumns", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.PutRowInBatchWriteRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_descriptor = - getDescriptor().getMessageTypes().get(40); - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_UpdateRowInBatchWriteRowRequest_descriptor, - new java.lang.String[] { "Condition", "PrimaryKey", "AttributeColumns", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.UpdateRowInBatchWriteRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_descriptor = - getDescriptor().getMessageTypes().get(41); - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_DeleteRowInBatchWriteRowRequest_descriptor, - new java.lang.String[] { "Condition", "PrimaryKey", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.DeleteRowInBatchWriteRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_descriptor = - getDescriptor().getMessageTypes().get(42); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowRequest_descriptor, - new java.lang.String[] { "TableName", "PutRows", "UpdateRows", "DeleteRows", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_descriptor = - getDescriptor().getMessageTypes().get(43); - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowRequest_descriptor, - new java.lang.String[] { "Tables", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_descriptor = - getDescriptor().getMessageTypes().get(44); - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_RowInBatchWriteRowResponse_descriptor, - new java.lang.String[] { "IsOk", "Error", "Consumed", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowInBatchWriteRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_descriptor = - getDescriptor().getMessageTypes().get(45); - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_TableInBatchWriteRowResponse_descriptor, - new java.lang.String[] { "TableName", "PutRows", "UpdateRows", "DeleteRows", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.TableInBatchWriteRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_descriptor = - getDescriptor().getMessageTypes().get(46); - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_BatchWriteRowResponse_descriptor, - new java.lang.String[] { "Tables", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.BatchWriteRowResponse.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_descriptor = - getDescriptor().getMessageTypes().get(47); - internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_GetRangeRequest_descriptor, - new java.lang.String[] { "TableName", "Direction", "ColumnsToGet", "Limit", "InclusiveStartPrimaryKey", "ExclusiveEndPrimaryKey", "Filter", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeRequest.Builder.class); - internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_descriptor = - getDescriptor().getMessageTypes().get(48); - internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_aliyun_openservices_ots_protocol_GetRangeResponse_descriptor, - new java.lang.String[] { "Consumed", "NextStartPrimaryKey", "Rows", }, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse.class, - com.aliyun.openservices.ots.protocol.OtsProtocol2.GetRangeResponse.Builder.class); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/src/main/java/com/aliyun/openservices/ots/protocol/ots_protocol.2.proto b/src/main/java/com/aliyun/openservices/ots/protocol/ots_protocol.2.proto deleted file mode 100644 index 5482bb6..0000000 --- a/src/main/java/com/aliyun/openservices/ots/protocol/ots_protocol.2.proto +++ /dev/null @@ -1,319 +0,0 @@ -package com.aliyun.openservices.ots.protocol; - -message Error { - required string code = 1; - optional string message = 2; -} - - -enum ColumnType { - INF_MIN = 0; // only for GetRange - INF_MAX = 1; // only for GetRange - INTEGER = 2; - STRING = 3; - BOOLEAN = 4; - DOUBLE = 5; - BINARY = 6; -} - -message ColumnSchema { - required string name = 1; - required ColumnType type = 2; -} - -message ColumnValue { - required ColumnType type = 1; - optional int64 v_int = 2; - optional string v_string = 3; - optional bool v_bool = 4; - optional double v_double = 5; - optional bytes v_binary = 6; -} - -message Column { - required string name = 1; - required ColumnValue value = 2; -} - -message Row { - repeated Column primary_key_columns = 1; - repeated Column attribute_columns = 2; -} - -message TableMeta { - required string table_name = 1; - repeated ColumnSchema primary_key = 2; -} - -enum RowExistenceExpectation { - IGNORE = 0; - EXPECT_EXIST = 1; - EXPECT_NOT_EXIST = 2; -} - -enum ColumnConditionType { - CCT_RELATION = 1; - CCT_COMPOSITE = 2; -} - -enum ComparatorType { - CT_EQUAL = 1; - CT_NOT_EQUAL = 2; - CT_GREATER_THAN = 3; - CT_GREATER_EQUAL = 4; - CT_LESS_THAN = 5; - CT_LESS_EQUAL = 6; -} - -message RelationCondition { - required ComparatorType comparator = 1; - required string column_name = 2; - required ColumnValue column_value = 3; - required bool pass_if_missing = 4; -} - -enum LogicalOperator { - LO_NOT = 1; - LO_AND = 2; - LO_OR = 3; -} - -message CompositeCondition { - required LogicalOperator combinator = 1; - repeated ColumnCondition sub_conditions = 2; -} - -message ColumnCondition { - required ColumnConditionType type = 1; - required bytes condition = 2; // Serialized bytes of column condition of the type -} - -message Condition { - required RowExistenceExpectation row_existence = 1; - optional ColumnCondition column_condition = 2; -} - -message CapacityUnit { - optional int32 read = 1; - optional int32 write = 2; -} - -message ReservedThroughputDetails { - required CapacityUnit capacity_unit = 1; - required int64 last_increase_time = 2; - optional int64 last_decrease_time = 3; - required int32 number_of_decreases_today = 4; -} - -message ReservedThroughput { - required CapacityUnit capacity_unit = 1; -} - -message ConsumedCapacity { - required CapacityUnit capacity_unit = 1; -} - -/* CreateTable */ -message CreateTableRequest { - required TableMeta table_meta = 1; - required ReservedThroughput reserved_throughput = 2; -} - -message CreateTableResponse { -} - -/* UpdateTable */ - -message UpdateTableRequest { - required string table_name = 1; - required ReservedThroughput reserved_throughput = 2; -} - -message UpdateTableResponse { - required ReservedThroughputDetails reserved_throughput_details = 1; -} - -/* DescribeTable */ -message DescribeTableRequest { - required string table_name = 1; -} - -message DescribeTableResponse { - required TableMeta table_meta = 1; - required ReservedThroughputDetails reserved_throughput_details = 2; -} - -/* ListTable */ -message ListTableRequest { -} - -message ListTableResponse { - repeated string table_names = 1; -} - -/* DeleteTable */ -message DeleteTableRequest { - required string table_name = 1; -} - -message DeleteTableResponse { -} - -/* GetRow */ -message GetRowRequest { - required string table_name = 1; - repeated Column primary_key = 2; - repeated string columns_to_get = 3; - optional ColumnCondition filter = 4; -} - -message GetRowResponse { - required ConsumedCapacity consumed = 1; - required Row row = 2; -} - -/* UpdateRow */ -enum OperationType { - PUT = 1; - DELETE = 2; -} - -message ColumnUpdate { - required OperationType type = 1; - required string name = 2; - optional ColumnValue value = 3; -} - -message UpdateRowRequest { - required string table_name = 1; - required Condition condition = 2; - repeated Column primary_key = 3; - repeated ColumnUpdate attribute_columns = 4; -} - -message UpdateRowResponse { - required ConsumedCapacity consumed = 1; -} - -/* PutRow */ -message PutRowRequest { - required string table_name = 1; - required Condition condition = 2; - repeated Column primary_key = 3; - repeated Column attribute_columns = 4; -} - -message PutRowResponse { - required ConsumedCapacity consumed = 1; -} - -/* DeleteRow */ -message DeleteRowRequest { - required string table_name = 1; - required Condition condition = 2; - repeated Column primary_key = 3; -} - -message DeleteRowResponse { - required ConsumedCapacity consumed = 1; -} - -/* BatchGetRow */ -message RowInBatchGetRowRequest { - repeated Column primary_key = 1; -} - -message TableInBatchGetRowRequest { - required string table_name = 1; - repeated RowInBatchGetRowRequest rows = 2; - repeated string columns_to_get = 3; - optional ColumnCondition filter = 4; -} - -message BatchGetRowRequest { - repeated TableInBatchGetRowRequest tables = 1; -} - -message RowInBatchGetRowResponse { - required bool is_ok = 1 [default = true]; - optional Error error = 2; - optional ConsumedCapacity consumed = 3; - optional Row row = 4; -} - -message TableInBatchGetRowResponse { - required string table_name = 1; - repeated RowInBatchGetRowResponse rows = 2; // same indices w.r.t. request -} - -message BatchGetRowResponse { - repeated TableInBatchGetRowResponse tables = 1; // same indices w.r.t. request -} - -/* BatchWriteRow */ -message PutRowInBatchWriteRowRequest { - required Condition condition = 1; - repeated Column primary_key = 2; - repeated Column attribute_columns = 3; -} - -message UpdateRowInBatchWriteRowRequest { - required Condition condition = 1; - repeated Column primary_key = 2; - repeated ColumnUpdate attribute_columns = 3; -} - -message DeleteRowInBatchWriteRowRequest { - required Condition condition = 1; - repeated Column primary_key = 2; -} - -message TableInBatchWriteRowRequest { - required string table_name = 1; - repeated PutRowInBatchWriteRowRequest put_rows = 2; - repeated UpdateRowInBatchWriteRowRequest update_rows = 3; - repeated DeleteRowInBatchWriteRowRequest delete_rows = 4; -} - -message BatchWriteRowRequest { - repeated TableInBatchWriteRowRequest tables = 1; // same indices w.r.t. request -} - -message RowInBatchWriteRowResponse { - required bool is_ok = 1 [default = true]; - optional Error error = 2; - optional ConsumedCapacity consumed = 3; -} - -message TableInBatchWriteRowResponse { - required string table_name = 1; - repeated RowInBatchWriteRowResponse put_rows = 2; // same indices w.r.t. request - repeated RowInBatchWriteRowResponse update_rows = 3; // same indices w.r.t. request - repeated RowInBatchWriteRowResponse delete_rows = 4; // same indices w.r.t. request -} - -message BatchWriteRowResponse { - repeated TableInBatchWriteRowResponse tables = 1; -} - -/* GetRange */ -enum Direction { - FORWARD = 0; - BACKWARD = 1; -} - -message GetRangeRequest { - required string table_name = 1; - required Direction direction = 2; - repeated string columns_to_get = 3; - optional int32 limit = 4; - repeated Column inclusive_start_primary_key = 5; // required all PKs, possibly filled with INF_MIN/INF_MAX - repeated Column exclusive_end_primary_key = 6; // required all PKs, possibly filled with INF_MIN/INF_MAX - optional ColumnCondition filter = 7; -} - -message GetRangeResponse { - required ConsumedCapacity consumed = 1; - repeated Column next_start_primary_key = 2; // missing means hitting the end - repeated Row rows = 3; -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/CalculateHelper.java b/src/main/java/com/aliyun/openservices/ots/utils/CalculateHelper.java deleted file mode 100644 index c27ff80..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/CalculateHelper.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import java.io.UnsupportedEncodingException; -import java.util.Map; -import java.util.Map.Entry; - -import com.aliyun.openservices.ots.model.ColumnValue; -import com.aliyun.openservices.ots.model.PrimaryKeyValue; -import com.aliyun.openservices.ots.model.RowDeleteChange; -import com.aliyun.openservices.ots.model.RowPrimaryKey; -import com.aliyun.openservices.ots.model.RowPutChange; -import com.aliyun.openservices.ots.model.RowUpdateChange; - -public class CalculateHelper { - - /** - * 计算字符串的大小(按照UTF-8编码) - * @param str - * @return 返回字符串的字节数 - * @throws IllegalStateException - */ - public static int getStringDataSize(String str) throws IllegalStateException { - try { - return str.getBytes("UTF-8").length; - } catch (UnsupportedEncodingException e) { - throw new IllegalStateException(e.getMessage(), e.getCause()); - } - } - - /** - * 计算一个PK列的数据大小 - * @param name pk列的名字 - * @param value pk列的值 - * @return 主键的数据大小 - * @throws IllegalStateException - */ - public static int getPrimaryKeyDataSize(String name, PrimaryKeyValue value) throws IllegalStateException { - int primaryKeyTotalSize = getStringDataSize(name); - switch (value.getType()) { - case INTEGER: - primaryKeyTotalSize += 8; - break; - case STRING: - primaryKeyTotalSize += getStringDataSize(value.asString()); - break; - default: - throw new IllegalStateException("Bug: not support the type : " + value.getType()); - - } - return primaryKeyTotalSize; - } - - /** - * 计算RowPrimaryKey的数据大小 - * @param primaryKey - * @return 主键的数据大小 - * @throws IllegalStateException - */ - public static int getPrimaryKeyDataSize(RowPrimaryKey primaryKey) throws IllegalStateException { - int primaryKeyTotalSize = 0; - // PrimaryKeys Total Size - for (Entry pk : primaryKey.getPrimaryKey().entrySet()) { - primaryKeyTotalSize += getPrimaryKeyDataSize(pk.getKey(), pk.getValue()); - } - return primaryKeyTotalSize; - } - - /** - * 计算一个属性列的数据大小 - * @param name 属性列的名字 - * @param value 属性列的值 - * @return 属性列数据大小 - * @throws IllegalStateException - */ - public static int getAttributeColumnDataSize(String name, ColumnValue value) throws IllegalStateException { - int columnTotalSize = getStringDataSize(name); - switch (value.getType()) { - case BINARY: - columnTotalSize += value.asBinary().length; - break; - case BOOLEAN: - columnTotalSize += 1; - break; - case DOUBLE: - columnTotalSize += 8; - break; - case INTEGER: - columnTotalSize += 8; - break; - case STRING: - columnTotalSize += getStringDataSize(value.asString()); - break; - default: - throw new IllegalStateException("Bug: not support the type : " + value.getType()); - } - - return columnTotalSize; - } - - /** - * 计算属性列的数据大小 - * @param columns - * @return 属性列数据大小 - * @throws IllegalStateException - */ - public static int getAttributeColumnDataSize(Map columns) throws IllegalStateException { - int columnTotalSize = 0; - - // Columns Total Size - for (Entry column : columns.entrySet()) { - columnTotalSize += getAttributeColumnDataSize(column.getKey(), column.getValue()); - } - - return columnTotalSize; - } - - /** - * 计算RowPutChange的数据大小 - * @param change - * @return RowPutChange数据大小 - * @throws IllegalStateException - */ - public static int getRowChangeDataSize(RowPutChange change) throws IllegalStateException { - return getPrimaryKeyDataSize(change.getRowPrimaryKey()) + getAttributeColumnDataSize(change.getAttributeColumns()); - } - - /** - * 计算RowUpdateChange的数据大小 - * @param change - * @return RowUpdateChange数据大小 - * @throws IllegalStateException - */ - public static int getRowChangeDataSize(RowUpdateChange change) throws IllegalStateException { - return getPrimaryKeyDataSize(change.getRowPrimaryKey()) + getAttributeColumnDataSize(change.getAttributeColumns()); - } - - /** - * 计算RowDeleteChange的数据大小 - * @param change - * @return RowDeleteChange数据大小 - * @throws IllegalStateException - */ - public static int getRowChangeDataSize(RowDeleteChange change) throws IllegalStateException { - return getPrimaryKeyDataSize(change.getRowPrimaryKey()); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/ClientConfigurationUtil.java b/src/main/java/com/aliyun/openservices/ots/utils/ClientConfigurationUtil.java deleted file mode 100755 index 6248b3b..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/ClientConfigurationUtil.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import com.aliyun.openservices.ots.ClientConfiguration; - -public class ClientConfigurationUtil { - public static void copyConfig(ClientConfiguration source, ClientConfiguration target) { - target.setIoThreadCount(source.getIoThreadCount()); - target.setConnectionTimeoutInMillisecond(source.getConnectionTimeoutInMillisecond()); - target.setMaxConnections(source.getMaxConnections()); - target.setProxyDomain(source.getProxyDomain()); - target.setProxyHost(source.getProxyHost()); - target.setProxyPassword(source.getProxyPassword()); - target.setProxyPort(source.getProxyPort()); - target.setProxyUsername(source.getProxyUsername()); - target.setProxyWorkstation(source.getProxyWorkstation()); - target.setSocketTimeoutInMillisecond(source.getSocketTimeoutInMillisecond()); - target.setUserAgent(source.getUserAgent()); - target.setRetryThreadCount(source.getRetryThreadCount()); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/CodingUtils.java b/src/main/java/com/aliyun/openservices/ots/utils/CodingUtils.java deleted file mode 100755 index 00815ca..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/CodingUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import java.util.List; - -/** - * Utils for common coding. - * - */ -public class CodingUtils { - private static ResourceManager rm = ResourceManager - .getInstance(ServiceConstants.RESOURCE_NAME_COMMON); - - public static void assertParameterNotNull(Object param, String paramName) { - if (param == null) { - throw new NullPointerException(rm.getFormattedString( - "ParameterIsNull", paramName)); - } - } - - public static void assertStringNotNullOrEmpty(String param, String paramName) { - assertParameterNotNull(param, paramName); - if (param.length() == 0) { - throw new IllegalArgumentException(rm.getFormattedString( - "ParameterStringIsEmpty", paramName)); - } - } - - @SuppressWarnings("rawtypes") - public static void assertListNotNullOrEmpty(List param, String paramName){ - assertParameterNotNull(param, paramName); - if (param.size() == 0) { - throw new IllegalArgumentException(rm.getFormattedString( - "ParameterListIsEmpty", paramName)); - } - } - - - public static boolean isNullOrEmpty(String value) { - return value == null || value.length() == 0; - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/HttpHeaders.java b/src/main/java/com/aliyun/openservices/ots/utils/HttpHeaders.java deleted file mode 100755 index b30311e..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/HttpHeaders.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -/** - * Contains the common HTTP headers. - * - */ -public interface HttpHeaders { - - public static final String AUTHORIZATION = "Authorization"; - public static final String CACHE_CONTROL = "Cache-Control"; - public static final String CONTENT_DISPOSITION = "Content-Disposition"; - public static final String CONTENT_ENCODING = "Content-Encoding"; - public static final String CONTENT_LENGTH = "Content-Length"; - public static final String CONTENT_MD5 = "Content-MD5"; - public static final String CONTENT_TYPE = "Content-Type"; - public static final String DATE = "Date"; - public static final String ETAG = "ETag"; - public static final String EXPIRES = "Expires"; - public static final String HOST = "Host"; - public static final String LAST_MODIFIED = "Last-Modified"; - public static final String RANGE = "Range"; - public static final String LOCATION = "Location"; - -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/ParamChecker.java b/src/main/java/com/aliyun/openservices/ots/utils/ParamChecker.java deleted file mode 100644 index cdaf58f..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/ParamChecker.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.internal.writer.WriterConfig; -import com.aliyun.openservices.ots.model.*; - -import java.util.Map; - -public class ParamChecker { - /** - * It does following checkings: - * - primary key schema is matched with which defined in table meta. - * - primary key column's value size is less than {@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxPKColumnSize} - * - attribute column's value size is less than {@link com.aliyun.openservices.ots.internal.writer.WriterConfig#maxAttrColumnSize} - * - the count of attribute columns is less than {@link WriterConfig#maxColumnsCount} - * - the name of attribute columns not duplicated with primary key column's name - * - the total row size - * - * @param tableMeta - * @param rowChange - * @param config - * @throws ClientException - */ - public static void checkRowChange(TableMeta tableMeta, RowChange rowChange, WriterConfig config) - throws ClientException { - // check table name - if (!tableMeta.getTableName().equals(rowChange.getTableName())) { - throw new ClientException("The row to write belongs to another table."); - } - - // check row size - if (rowChange.getDataSize() > config.getMaxBatchSize()) { - throw new ClientException("The row size exceeds the max batch size: " + config.getMaxBatchSize() + "."); - } - - - Map pkDefinedInMeta = tableMeta.getPrimaryKey(); - Map pkInRow = rowChange.getRowPrimaryKey().getPrimaryKey(); - if (pkDefinedInMeta.size() != pkInRow.size()) { - throw new ClientException("The primary key schema is not match which defined in table meta."); - } - - for (Map.Entry entry : tableMeta.getPrimaryKey().entrySet()) { - PrimaryKeyValue value = pkInRow.get(entry.getKey()); - - // schema checking - if (value == null) { - throw new ClientException("Can't find primary key column '" + entry.getKey() + "' in row."); - } - - if (value.getType() != entry.getValue()) { - throw new ClientException("The type of primary key column '" + entry.getKey() + "' is " + value.getType() + - ", but it's defined as " + entry.getValue() + " in table meta."); - } - - // value size checking - if (value.getSize() > config.getMaxPKColumnSize()) { - throw new ClientException("The size of primary key column '" + entry.getKey() + "' has exceeded the max length:" + config.getMaxPKColumnSize() + "."); - } - } - - Map attributes = null; - if (rowChange instanceof RowPutChange) { - RowPutChange rowPut = (RowPutChange)rowChange; - attributes = rowPut.getAttributeColumns(); - } else if (rowChange instanceof RowUpdateChange) { - RowUpdateChange rowUpdate = (RowUpdateChange)rowChange; - attributes = rowUpdate.getAttributeColumns(); - } - - if (attributes != null) { - if (attributes.size() > config.getMaxColumnsCount()) { - throw new ClientException("The count of attribute columns exceeds the maximum: " + config.getMaxColumnsCount() + "."); - } - - for (Map.Entry entry : attributes.entrySet()) { - if (pkDefinedInMeta.containsKey(entry.getKey())) { - throw new ClientException("The attribute column's name duplicate with primary key column, which is '" + entry.getKey() + "'."); - } - - ColumnValue value = entry.getValue(); - if (value != null && value.getSize() > config.getMaxAttrColumnSize()) { - throw new ClientException("The size of attribute column '" + entry.getKey() + "' has exceeded the max length: " + config.getMaxAttrColumnSize() + "."); - } - } - } - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/ResourceManager.java b/src/main/java/com/aliyun/openservices/ots/utils/ResourceManager.java deleted file mode 100755 index 68e4897..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/ResourceManager.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import java.text.MessageFormat; -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * Manager class to get localized resources. - * - */ -public class ResourceManager { - private ResourceBundle bundle; - - ResourceManager(String baseName, Locale locale){ - this.bundle = ResourceBundle.getBundle(baseName, locale); - } - - public static ResourceManager getInstance(String baseName){ - return new ResourceManager(baseName, Locale.getDefault()); - } - - public static ResourceManager getInstance(String baseName, Locale locale){ - return new ResourceManager(baseName, locale); - } - - public String getString(String key){ - return bundle.getString(key); - } - - public String getFormattedString(String key, Object... args){ - return MessageFormat.format(getString(key), args); - } -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/ServiceConstants.java b/src/main/java/com/aliyun/openservices/ots/utils/ServiceConstants.java deleted file mode 100755 index d09e1d5..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/ServiceConstants.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -public interface ServiceConstants { - - public static final String DEFAULT_ENCODING = "utf-8"; - - public static final String RESOURCE_NAME_COMMON = "common"; -} diff --git a/src/main/java/com/aliyun/openservices/ots/utils/VersionInfoUtils.java b/src/main/java/com/aliyun/openservices/ots/utils/VersionInfoUtils.java deleted file mode 100755 index ca2515c..0000000 --- a/src/main/java/com/aliyun/openservices/ots/utils/VersionInfoUtils.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import java.io.InputStream; -import java.util.Properties; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class VersionInfoUtils { - private static final String VERSION_INFO_FILE = "versioninfo.properties"; - private static final String USER_AGENT_PREFIX = "aliyun-tablestore-sdk-java"; - - private static Log log = LogFactory.getLog(VersionInfoUtils.class); - - - private static String version = null; - - private static String defaultUserAgent = null; - - public static String getVersion() { - if (version == null) { - initializeVersion(); - } - return version; - } - - public static String getDefaultUserAgent() { - if (defaultUserAgent == null) { - defaultUserAgent = USER_AGENT_PREFIX + "/" + getVersion() + "(" + - System.getProperty("os.name") + "/" + System.getProperty("os.version") + "/" + - System.getProperty("os.arch") + ";" + System.getProperty("java.version") + ")"; - } - return defaultUserAgent; - } - - private static void initializeVersion() { - InputStream inputStream = VersionInfoUtils.class.getClassLoader().getResourceAsStream(VERSION_INFO_FILE); - Properties versionInfoProperties = new Properties(); - try { - if (inputStream == null) - throw new Exception(VERSION_INFO_FILE + " not found on classpath"); - - versionInfoProperties.load(inputStream); - version = versionInfoProperties.getProperty("version"); - } catch (Exception e) { - log.info("Unable to load version information for the running SDK: " + e.getMessage()); - version = "unknown-version"; - } - } -} diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index 8c8e59f..d12a270 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -1,9 +1,9 @@ - + filePattern="logs/$${date:yyyy-MM}/aliyun-openservices-tablestore-%d{MM-dd-yyyy}-%i.log.gz"> %d %p %c{1.} [%t] %m%n @@ -18,10 +18,10 @@ - - + + - + diff --git a/src/main/resources/ots.properties b/src/main/resources/tablestore.properties similarity index 93% rename from src/main/resources/ots.properties rename to src/main/resources/tablestore.properties index b32e266..aaa6f51 100755 --- a/src/main/resources/ots.properties +++ b/src/main/resources/tablestore.properties @@ -4,7 +4,7 @@ BeginIsInfMin=The range begin cannot be PrimaryKeyRange.INF_MIN on reading in re DateTypeIsNot=The data type is not {0}. DoubleNaNNotSupported=Double.NaN is not supported. EndpointInvalid=The endpoint is an invalid URI. -EndpointProtocolInvalid=The endpoint must start with "http://" or "https://". +EndpointProtocolInvalid=Only the "http" protocol is supported, so the endpoint must start with "http://". InfPKNotAllowed=PrimaryKeyRange.INF_MAX or PrimaryKeyRange.INF_MIN is just allowed in RangeRowQueryCriteria#setRange(). MustSetCriteriaRange=The primary key range is not set. MustSetCriteriaTop=The top count of the result to return is not set, and it has to be greater than or equal to 0. diff --git a/src/main/resources/ots_zh_CN.properties b/src/main/resources/tablestore_zh_CN.properties similarity index 92% rename from src/main/resources/ots_zh_CN.properties rename to src/main/resources/tablestore_zh_CN.properties index bae5582..e345dd7 100755 --- a/src/main/resources/ots_zh_CN.properties +++ b/src/main/resources/tablestore_zh_CN.properties @@ -4,7 +4,7 @@ BeginIsInfMin=\u53cd\u5411\u8bfb\u53d6\u65f6begin\u4e0d\u80fd\u662fPrimaryKeyRan DateTypeIsNot=\u6570\u636e\u7c7b\u578b\u4e0d\u662f{0}. DoubleNaNNotSupported=\u4e0d\u652f\u6301Double.NaN\u3002 EndpointInvalid=Endpoint\u65e0\u6548\u3002 -EndpointProtocolInvalid=\u0045\u006e\u0064\u0070\u006f\u0069\u006e\u0074\u5fc5\u987b\u4ee5\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u6216\u8005\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u5f00\u5934\u3002 +EndpointProtocolInvalid=\u4ec5\u652f\u6301http\u534f\u8bae\u3002Endpoint\u5fc5\u987b\u4ee5http://\u5f00\u5934\u3002 InfPKNotAllowed=PrimaryKeyRange.INF_MAX \u6216 PrimaryKeyRange.INF_MIN\u53ea\u5141\u8bb8\u5728RangeRowQueryCriteria#setRange\u4e2d\u4f7f\u7528\u3002 MustSetCriteriaRange=\u5fc5\u987b\u8bbe\u5b9a\u4e3b\u952e\u67e5\u8be2\u8303\u56f4\u3002 MustSetCriteriaTop=\u5fc5\u987b\u6307\u5b9a\u8fd4\u56de\u7ed3\u679c\u884c\u6570\uff0c\u4e14\u4e0d\u80fd\u5c0f\u4e8e0\u3002 diff --git a/src/main/resources/versioninfo.properties b/src/main/resources/versioninfo.properties index 0a7561c..7e2f5c1 100755 --- a/src/main/resources/versioninfo.properties +++ b/src/main/resources/versioninfo.properties @@ -1 +1 @@ -version=2.2.4 +version=TableStore-1.0 diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/BaseFT.java b/src/test/java/com/alicloud/openservices/tablestore/common/BaseFT.java new file mode 100644 index 0000000..6fe6d1f --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/BaseFT.java @@ -0,0 +1,133 @@ +package com.alicloud.openservices.tablestore.common; + + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClientInterface; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.Map; +import java.util.NavigableMap; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class BaseFT { + + private static final Logger LOG = LoggerFactory.getLogger(BaseFT.class); + + public static void assertTableStoreException( + TableStoreException expect, + TableStoreException actual) { + LOG.info(actual.toString()); + assertEquals(expect.getErrorCode(), actual.getErrorCode()); + assertEquals(expect.getMessage(), actual.getMessage()); + assertEquals(expect.getHttpStatus(), actual.getHttpStatus()); + } + + public static void assertTableStoreException( + String errorCode, + String errorMsg, + int httpCode, + TableStoreException actual) { + LOG.info(actual.toString()); + assertEquals(errorCode, actual.getErrorCode()); + assertEquals(errorMsg, actual.getMessage()); + assertEquals(httpCode, actual.getHttpStatus()); + } + + public static void assertClientException( + ClientException expect, + ClientException actual) { + LOG.info(actual.toString()); + assertEquals(expect.getMessage(), actual.getMessage()); + } + + public static void checkTimestampWithDeviation(long expect, long actual) { + LOG.info("Expect Ts: {}, Actual Ts: {}", expect, actual); + long begin = expect - (OTSTestConst.TIMESTAMP_DEVIATION_IN_SECOND * 1000); + long end = expect + (OTSTestConst.TIMESTAMP_DEVIATION_IN_SECOND * 1000); + if (!(begin < actual && actual < end)) { + fail(String.format("Expect:%d, Actual: %d", expect, actual)); + } + } + + public static void checkPrimaryKeySchemas( + Map expectPK, + Map actualPK ) { + assertEquals(expectPK.size(), actualPK.size()); + + for (int i = 0; i < expectPK.size(); i++) { + assertEquals(expectPK.get(i), actualPK.get(i)); + } + } + + public static void checkTableMeta( + TableMeta expect, + TableMeta actual) { + assertEquals(expect.getTableName(), actual.getTableName()); + + checkPrimaryKeySchemas(expect.getPrimaryKeyMap(), actual.getPrimaryKeyMap()); + } + + public static void checkDescribeTableResult( + DescribeTableResponse expect, + DescribeTableResponse actual) { + checkTableMeta(expect.getTableMeta(), actual.getTableMeta()); + } + + public static void checkColumns( + Column[] expect, + Column[] actual) { + assertEquals(expect.length, actual.length); + for (int i = 0; i < expect.length; i++) { + assertEquals(expect[i], actual[i]); + } + } + + public static void checkColumns( + NavigableMap> expect, + NavigableMap> actual) { + assertEquals(expect.size(), actual.size()); + for (Map.Entry> entry : expect.entrySet()) { + NavigableMap expectValueList = entry.getValue(); + NavigableMap actualValueList = actual.get(entry.getKey()); + assertEquals(expectValueList.size(), actualValueList.size()); + for (Long ts : expectValueList.keySet()) { + assertEquals(expectValueList.get(ts), actualValueList.get(ts)); + } + } + } + + public static void checkColumnsNoTimestamp( + Column[] expect, + Column[] actual) { + assertEquals(expect.length, actual.length); + for (int i = 0; i < expect.length; i++) { + assertEquals(expect[i].getName(), actual[i].getName()); + assertEquals(expect[i].getValue(), actual[i].getValue()); + } + } + + public static void checkRow( + Row expect, + Row actual) { + if (expect == null) { + assertEquals(actual, null); + } else { + checkColumns(expect.getColumnsMap(), actual.getColumnsMap()); + } + } + + public static void checkRowNoTimestamp( + Row expect, + Row actual) { + assertEquals(expect.getPrimaryKey(), actual.getPrimaryKey()); + + checkColumnsNoTimestamp(expect.getColumns(), actual.getColumns()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/OTSHelper.java b/src/test/java/com/alicloud/openservices/tablestore/common/OTSHelper.java new file mode 100644 index 0000000..cdaf8e0 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/OTSHelper.java @@ -0,0 +1,543 @@ +package com.alicloud.openservices.tablestore.common; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alicloud.openservices.tablestore.SyncClientInterface; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse.RowResult; +import com.alicloud.openservices.tablestore.core.utils.Pair; + +public class OTSHelper { + + private static final Logger LOG = LoggerFactory.getLogger(OTSHelper.class); + + public static TableMeta getTableMeta(String tableName, Map pk) { + TableMeta meta = new TableMeta(tableName); + for (Map.Entry entry : pk.entrySet()) { + meta.addPrimaryKeyColumn(entry.getKey(), entry.getValue()); + } + return meta; + } + + public static void createTable( + SyncClientInterface ots, + String tableName, + Map pk) { + CreateTableRequest request = new CreateTableRequest(getTableMeta(tableName, pk), new TableOptions(-1, 1)); + request.setReservedThroughput(new ReservedThroughput(0, 0)); + ots.createTable(request); + } + + public static void createTable( + SyncClientInterface ots, + String tableName, + Map pk, + int readCU, + int writeCU, + int timeToLive, + int maxVersions) { + CreateTableRequest request = new CreateTableRequest(getTableMeta(tableName, pk), new TableOptions(timeToLive, maxVersions)); + request.setReservedThroughput(new ReservedThroughput(readCU, writeCU)); + ots.createTable(request); + } + + public static void createTable( + SyncClientInterface ots, + TableMeta meta) { + CreateTableRequest request = new CreateTableRequest(meta, getDefaultTableOptions()); + request.setReservedThroughput(new ReservedThroughput(0, 0)); + ots.createTable(request); + } + + public static PutRowResponse putRow(SyncClientInterface ots, String tableName, PrimaryKey pk, + Map columns) { + RowPutChange rowChange = new RowPutChange(tableName); + rowChange.setPrimaryKey(pk); + for (Map.Entry col : columns.entrySet()) { + rowChange.addColumn(col.getKey(), col.getValue()); + } + return putRow(ots, rowChange); + } + + public static PutRowResponse putRow(SyncClientInterface ots, String tableName, PrimaryKey pk, + Map columns, RowExistenceExpectation rowExist) { + RowPutChange rowChange = new RowPutChange(tableName); + rowChange.setPrimaryKey(pk); + for (Map.Entry col : columns.entrySet()) { + rowChange.addColumn(col.getKey(), col.getValue()); + } + if (rowExist != null) { + Condition condition = new Condition(); + condition.setRowExistenceExpectation(rowExist); + rowChange.setCondition(condition); + } + return putRow(ots, rowChange); + } + + public static GetRowResponse getRow(SyncClientInterface ots, String tableName, PrimaryKey pk) { + GetRowRequest request = new GetRowRequest(); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(pk); + criteria.setMaxVersions(1); + request.setRowQueryCriteria(criteria); + return ots.getRow(request); + } + + + + public static void deleteAllTable(SyncClientInterface ots) throws Exception { + LOG.info("Begin deleteAllTable"); + ListTableResponse r = ots.listTable(); + + for (String name : r.getTableNames()) { + LOG.info("delete : " + name); + deleteTable(ots, name); + } + LOG.info("End deleteAllTable"); + } + + public static TableMeta getTableMeta(String tableName, List pk) { + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(pk); + return meta; + } + + public static void createTable( + SyncClientInterface ots, + String tableName, + List pk) { + + createTable(ots, getTableMeta(tableName, pk), new CapacityUnit(0, 0), null); + } + + public static void createTable( + SyncClientInterface ots, + String tableName, + List scheme, + int ttl, + int maxVersions) { + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(scheme); + + TableOptions to = new TableOptions(); + to.setTimeToLive(ttl); + to.setMaxVersions(maxVersions); + createTable(ots, meta, new CapacityUnit(0, 0), to); + } + + public static TableOptions getDefaultTableOptions() { + TableOptions tableOptions = new TableOptions(); + tableOptions.setTimeToLive(OTSTestConst.DEFAULT_TTL); + tableOptions.setMaxVersions(OTSTestConst.DEFAULT_MAX_VERSION); + tableOptions.setMaxTimeDeviation(Long.MAX_VALUE / 1000000); + return tableOptions; + } + + public static void createTable( + SyncClientInterface ots, + TableMeta meta, + CapacityUnit capacityUnit, + TableOptions tableOptions) { + if (tableOptions == null) { + tableOptions = getDefaultTableOptions(); + } + CreateTableRequest createTableRequest = new CreateTableRequest(meta, tableOptions); + createTableRequest.setReservedThroughput(new ReservedThroughput( + capacityUnit)); + + ots.createTable(createTableRequest); + } + + public static void deleteTable(SyncClientInterface ots, String tableName) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest( + tableName); + ots.deleteTable(deleteTableRequest); + } + + public static List listTable(SyncClientInterface ots) { + ListTableResponse r = ots.listTable(); + return r.getTableNames(); + } + + public static DescribeTableResponse describeTable(SyncClientInterface ots, String tableName) { + DescribeTableRequest describeTableRequest = new DescribeTableRequest( + tableName); + DescribeTableResponse result = ots.describeTable(describeTableRequest); + if (!result.getTableMeta().getTableName().equals(tableName)) { + throw new RuntimeException("Wrong result."); + } + return result; + } + + public static UpdateTableResponse updateTable(SyncClientInterface ots, String tableName, + ReservedThroughput reservedThroughputForUpdate, + TableOptions tableOptionsForUpdate) { + UpdateTableRequest updateTableRequest = new UpdateTableRequest( + tableName); + if (reservedThroughputForUpdate != null) { + updateTableRequest + .setReservedThroughputForUpdate(reservedThroughputForUpdate); + } + if (tableOptionsForUpdate != null) { + updateTableRequest.setTableOptionsForUpdate(tableOptionsForUpdate); + } + return ots.updateTable(updateTableRequest); + } + + public static PutRowResponse putRow(SyncClientInterface ots, String tableName, PrimaryKey pk, + List columns) { + RowPutChange rowChange = new RowPutChange(tableName, pk); + for (Column col : columns) { + rowChange.addColumn(col); + } + + return putRow(ots, rowChange); + } + + public static PutRowResponse putRow(SyncClientInterface ots, RowPutChange rowChange) { + PutRowRequest putRowRequest = new PutRowRequest(rowChange); + return ots.putRow(putRowRequest); + } + + public static GetRowResponse getRowForAll(SyncClientInterface ots, String tableName, PrimaryKey pk) { + return getRow(ots, tableName, pk, null, Integer.MAX_VALUE); + } + + public static GetRowResponse getRow(SyncClientInterface ots, String tableName, PrimaryKey pk, long ts) { + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria( + tableName, pk); + rowQueryCriteria.setTimestamp(ts); + return getRow(ots, rowQueryCriteria); + } + + public static GetRowResponse getRow(SyncClientInterface ots, String tableName, PrimaryKey pk, TimeRange range, int maxVersion) { + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria( + tableName, pk); + if (range != null) { + rowQueryCriteria.setTimeRange(range); + } + if (maxVersion > 0) { + rowQueryCriteria.setMaxVersions(maxVersion); + } + return getRow(ots, rowQueryCriteria); + } + + public static GetRowResponse getRow(SyncClientInterface ots, String tableName, PrimaryKey pk, TimeRange range, int maxVersion, List columnToGet) { + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria( + tableName, pk); + rowQueryCriteria.addColumnsToGet(columnToGet); + if (range != null) { + rowQueryCriteria.setTimeRange(range); + } + if (maxVersion > 0) { + rowQueryCriteria.setMaxVersions(maxVersion); + } + return getRow(ots, rowQueryCriteria); + } + + public static GetRowResponse getRow(SyncClientInterface ots, + SingleRowQueryCriteria rowQueryCriteria) { + GetRowRequest getRowRequest = new GetRowRequest(rowQueryCriteria); + GetRowResponse result = ots.getRow(getRowRequest); + if (result.getRow() != null && !result.getRow().getPrimaryKey().equals(rowQueryCriteria.getPrimaryKey())) { + throw new RuntimeException("Wrong result."); + } + return result; + } + + + public static UpdateRowResponse updateRow(SyncClientInterface ots, String tableName, + PrimaryKey pk, List puts, List deleteColumn, + List> deleteCell) { + return updateRow(ots, tableName, pk, puts, deleteColumn, deleteCell, RowExistenceExpectation.IGNORE); + } + + public static UpdateRowResponse updateRow(SyncClientInterface ots, String tableName, + PrimaryKey pk, List puts, List deleteColumn, + List> deleteCell, RowExistenceExpectation rowExist) { + RowUpdateChange rowChange = new RowUpdateChange(tableName, pk); + if (puts != null) { + for (Column c : puts) { + rowChange.put(c); + } + } + if (deleteColumn != null) { + for (String s : deleteColumn) { + rowChange.deleteColumns(s); + } + } + if (deleteCell != null) { + for (Pair s : deleteCell) { + rowChange.deleteColumn(s.getFirst(), s.getSecond()); + } + } + if (rowExist != null) { + Condition condition = new Condition(); + condition.setRowExistenceExpectation(rowExist); + rowChange.setCondition(condition); + } + return updateRow(ots, rowChange); + } + + public static UpdateRowResponse updateRow(SyncClientInterface ots, RowUpdateChange rowChange) { + UpdateRowRequest updateRowRequest = new UpdateRowRequest(rowChange); + return ots.updateRow(updateRowRequest); + } + + public static DeleteRowResponse deleteRow(SyncClientInterface ots, String tableName, + PrimaryKey pk) { + RowDeleteChange rowChange = new RowDeleteChange(tableName, pk); + return deleteRow(ots, rowChange); + } + + public static DeleteRowResponse deleteRow(SyncClientInterface ots, String tableName, + PrimaryKey pk, RowExistenceExpectation rowExist) { + RowDeleteChange rowChange = new RowDeleteChange(tableName, pk); + if (rowExist != null) { + Condition condition = new Condition(); + condition.setRowExistenceExpectation(rowExist); + rowChange.setCondition(condition); + } + return deleteRow(ots, rowChange); + } + + public static DeleteRowResponse deleteRow(SyncClientInterface ots, RowDeleteChange rowChange) { + DeleteRowRequest deleteRowRequest = new DeleteRowRequest(rowChange); + return ots.deleteRow(deleteRowRequest); + } + + private static List getRows(SyncClientInterface ots, List> pks) { + List criterias = new ArrayList(); + for (Pair p : pks) { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(p.getFirst()); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + } + + List rr = batchGetRow(ots, criterias).getSucceedRows(); + List rows = new ArrayList(); + for (RowResult r : rr) { + rows.add(r.getRow()); + } + return rows; + } + + public static List batchGetRowForAllRow( + SyncClientInterface ots, + List> pks) { + List rows = new ArrayList(); + + for (int i = 0; i < pks.size(); i += OTSRestrictedItemConst.BATCH_GET_ROW_COUNT_MAX) { + if (i + OTSRestrictedItemConst.BATCH_GET_ROW_COUNT_MAX < pks.size()) { + rows.addAll(getRows(ots, pks.subList(i, i + OTSRestrictedItemConst.BATCH_GET_ROW_COUNT_MAX))); + } else { + rows.addAll(getRows(ots, pks.subList(i, pks.size()))); + } + } + return rows; + } + + public static BatchGetRowResponse batchGetRow( + SyncClientInterface ots, + List criterias) { + BatchGetRowRequest batchGetRowRequest = new BatchGetRowRequest(); + for (MultiRowQueryCriteria criteria : criterias) { + batchGetRowRequest.addMultiRowQueryCriteria(criteria); + } + return ots.batchGetRow(batchGetRowRequest); + } + + public static List batchGetRowNoLimit( + SyncClientInterface ots, + List criterias) { + List rr = new ArrayList(); + for (MultiRowQueryCriteria c : criterias) { + MultiRowQueryCriteria cc = new MultiRowQueryCriteria(c.getTableName()); + LOG.info("Table: {}, count:{}", c.getTableName(), c.getRowKeys().size()); + cc.setMaxVersions(Integer.MAX_VALUE); + for (PrimaryKey pk : c.getRowKeys()) { + if (cc.getRowKeys().size() == OTSRestrictedItemConst.BATCH_GET_ROW_COUNT_MAX) { + List ccs = new ArrayList(); + ccs.add(cc); + + BatchGetRowResponse r = batchGetRow(ots, ccs); + LOG.info("Fail size : " + r.getFailedRows().size()); + LOG.info("Succ size : " + r.getSucceedRows().size()); + if (!r.isAllSucceed()) { + for (RowResult row : r.getFailedRows()) { + LOG.error("Fail : {}, {}", row.getError().getCode(), row.getError().getMessage()); + throw new RuntimeException(String.format("BatchGetRow fail. code :%s, msg:%s", row.getError().getCode(), row.getError().getMessage())); + } + } + + rr.addAll(r.getSucceedRows()); + cc = new MultiRowQueryCriteria(c.getTableName()); + cc.setMaxVersions(Integer.MAX_VALUE); + cc.addRow(pk); + } else { + cc.addRow(pk); + } + } + List ccs = new ArrayList(); + ccs.add(cc); + BatchGetRowResponse r = batchGetRow(ots, ccs); + LOG.info("Fail size : " + r.getFailedRows().size()); + LOG.info("Succ size : " + r.getSucceedRows().size()); + if (!r.isAllSucceed()) { + for (RowResult row : r.getFailedRows()) { + LOG.error("Fail : {}, {}", row.getError().getCode(), row.getError().getMessage()); + throw new RuntimeException(String.format("BatchGetRow fail. code :%s, msg:%s", row.getError().getCode(), row.getError().getMessage())); + } + } + rr.addAll(r.getSucceedRows()); + } + return rr; + } + + public static BatchWriteRowResponse batchWriteRow( + SyncClientInterface ots, + List puts, + List updates, + List deletes) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + if (puts != null) { + for (RowPutChange put : puts) { + batchWriteRowRequest.addRowChange(put); + } + } + if (updates != null) { + for (RowUpdateChange update : updates) { + batchWriteRowRequest.addRowChange(update); + } + } + if (deletes != null) { + for (RowDeleteChange delete : deletes) { + batchWriteRowRequest.addRowChange(delete); + } + } + return ots.batchWriteRow(batchWriteRowRequest); + } + + public static void batchWriteRowNoLimit( + SyncClientInterface ots, + List puts, + List updates, + List deletes) { + int count = 0; + if (puts != null) + { + List newPuts = new ArrayList(); + for (RowPutChange put : puts) { + if (newPuts.size() == OTSRestrictedItemConst.BATCH_WRITE_ROW_COUNT_MAX) { + count += newPuts.size(); + BatchWriteRowResponse r = batchWriteRow(ots, newPuts, null, null); + LOG.info("RequestID:{}", r.getRequestId()); + List s = r.getFailedRows(); + for (BatchWriteRowResponse.RowResult rr : s) { + LOG.error("batchWriteRow-put fail, {}, {}", rr.getError().getCode(), rr.getError().getMessage()); + throw new RuntimeException(String.format("batchWriteRow-put fail, %s, %s", rr.getError().getCode(), rr.getError().getMessage())); + } + newPuts.clear(); + } + newPuts.add(put); + } + if (!newPuts.isEmpty()) { + count += newPuts.size(); + BatchWriteRowResponse r = batchWriteRow(ots, newPuts, null, null); + LOG.info("RequestID:{}", r.getRequestId()); + List s = r.getFailedRows(); + for (BatchWriteRowResponse.RowResult rr : s) { + LOG.error("batchWriteRow-put fail, {}, {}", rr.getError().getCode(), rr.getError().getMessage()); + throw new RuntimeException(String.format("batchWriteRow-put fail, %s, %s", rr.getError().getCode(), rr.getError().getMessage())); + } + } + } + if (updates != null) + { + List newUpdates = new ArrayList(); + for (RowUpdateChange update : updates) { + if (newUpdates.size() == OTSRestrictedItemConst.BATCH_WRITE_ROW_COUNT_MAX) { + count += newUpdates.size(); + BatchWriteRowResponse r = batchWriteRow(ots, null, newUpdates, null); + LOG.info("RequestID:{}", r.getRequestId()); + List s = r.getFailedRows(); + for (BatchWriteRowResponse.RowResult rr : s) { + LOG.error("batchWriteRow-update fail, {}, {}", rr.getError().getCode(), rr.getError().getMessage()); + throw new RuntimeException(String.format("batchWriteRow-update fail, %s, %s", rr.getError().getCode(), rr.getError().getMessage())); + } + newUpdates.clear(); + } + newUpdates.add(update); + } + + if (!newUpdates.isEmpty()) { + count += newUpdates.size(); + BatchWriteRowResponse r = batchWriteRow(ots, null, newUpdates, null); + LOG.info("RequestID:{}", r.getRequestId()); + List s = r.getFailedRows(); + for (BatchWriteRowResponse.RowResult rr : s) { + LOG.error("batchWriteRow-update fail, {}, {}", rr.getError().getCode(), rr.getError().getMessage()); + throw new RuntimeException(String.format("batchWriteRow-update fail, %s, %s", rr.getError().getCode(), rr.getError().getMessage())); + } + } + } + + if (deletes != null) + { + List newDeletes = new ArrayList(); + for (RowDeleteChange delete : deletes) { + if (newDeletes.size() == OTSRestrictedItemConst.BATCH_WRITE_ROW_COUNT_MAX) { + count += newDeletes.size(); + BatchWriteRowResponse r = batchWriteRow(ots, null, null, newDeletes); + LOG.info("RequestID:{}", r.getRequestId()); + List s = r.getFailedRows(); + for (BatchWriteRowResponse.RowResult rr : s) { + LOG.error("batchWriteRow-delete fail, {}, {}", rr.getError().getCode(), rr.getError().getMessage()); + throw new RuntimeException(String.format("batchWriteRow-delete fail, %s, %s", rr.getError().getCode(), rr.getError().getMessage())); + } + newDeletes.clear(); + } + newDeletes.add(delete); + } + + if (!newDeletes.isEmpty()) { + count += newDeletes.size(); + BatchWriteRowResponse r = batchWriteRow(ots, null, null, newDeletes); + LOG.info("RequestID:{}", r.getRequestId()); + List s = r.getFailedRows(); + for (BatchWriteRowResponse.RowResult rr : s) { + LOG.error("batchWriteRow-delete fail, {}, {}", rr.getError().getCode(), rr.getError().getMessage()); + throw new RuntimeException(String.format("batchWriteRow-delete fail, %s, %s", rr.getError().getCode(), rr.getError().getMessage())); + } + } + } + LOG.info("BatchWriteRow Count : {}", count); + } + + public static GetRangeResponse getRange(SyncClientInterface ots, + RangeRowQueryCriteria rangeRowQueryCriteria) { + GetRangeRequest getRangeRequest = new GetRangeRequest( + rangeRowQueryCriteria); + return ots.getRange(getRangeRequest); + } + + public static List getRangeForAll(SyncClientInterface ots, + RangeRowQueryCriteria rangeRowQueryCriteria) { + List result = new ArrayList(); + GetRangeRequest getRangeRequest = new GetRangeRequest( + rangeRowQueryCriteria); + GetRangeResponse r = ots.getRange(getRangeRequest); + result.addAll(r.getRows()); + while (r.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(r.getNextStartPrimaryKey()); + r = ots.getRange(getRangeRequest); + result.addAll(r.getRows()); + } + return result; + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/OTSRestrictedItemConst.java b/src/test/java/com/alicloud/openservices/tablestore/common/OTSRestrictedItemConst.java new file mode 100644 index 0000000..05b16c0 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/OTSRestrictedItemConst.java @@ -0,0 +1,18 @@ +package com.alicloud.openservices.tablestore.common; + +public class OTSRestrictedItemConst { + + public static final int TABLE_NAME_LENGTH_MAX = 255; + public static final int COLUMN_NAME_LENGTH_MAX = 255; + public static final int TABLE_NUMBER_MAX = 64; + public static final int PRIMARY_KEY_COLUMN_NUMBER_MAX = 4; + public static final int PRIMARY_KEY_VALUE_STRING_LENGTH_MAX = 1024; + public static final int PRIMARY_KEY_VALUE_BINARY_LENGTH_MAX = 1024; + public static final int COLUMN_VALUE_STRING_LENGTH_MAX = 2 * 1024 * 1024; + public static final int COLUMN_VALUE_BINARY_LENGTH_MAX = 2 * 1024 * 1024; + public static final int BATCH_GET_ROW_COUNT_MAX = 100; + public static final int BATCH_WRITE_ROW_COUNT_MAX = 200; + public static final int GET_RANGE_COUNT_MAX = 5000; + public static final int GET_RANGE_SIZE_MAX = 4 * 1024 * 1024; + public static final int COLUMN_COUNT_MAX_IN_SINGLE_ROW = 1024; +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/OTSRowBuilder.java b/src/test/java/com/alicloud/openservices/tablestore/common/OTSRowBuilder.java new file mode 100644 index 0000000..08a2a2e --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/OTSRowBuilder.java @@ -0,0 +1,48 @@ +package com.alicloud.openservices.tablestore.common; + +import com.alicloud.openservices.tablestore.model.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class OTSRowBuilder { + + private List primaryKeyColumn = new ArrayList(); + private List attrs = new ArrayList(); + + private OTSRowBuilder() {} + + public static OTSRowBuilder newInstance() { + return new OTSRowBuilder(); + } + + public OTSRowBuilder addPK(PrimaryKey pk) { + primaryKeyColumn.addAll(Arrays.asList(pk.getPrimaryKeyColumns())); + return this; + } + + public OTSRowBuilder addPrimaryKeyColumn(List columns) { + primaryKeyColumn.addAll(columns); + return this; + } + + public OTSRowBuilder addPrimaryKeyColumn(String name, PrimaryKeyValue value) { + primaryKeyColumn.add(new PrimaryKeyColumn(name, value)); + return this; + } + + public OTSRowBuilder addAttrColumn(String name, ColumnValue value) { + attrs.add(new Column(name, value)); + return this; + } + + public OTSRowBuilder addAttrColumn(String name, ColumnValue value, long ts) { + attrs.add(new Column(name, value, ts)); + return this; + } + + public Row toRow() { + return new Row(new PrimaryKey(primaryKeyColumn), attrs); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/OTSTableBuilder.java b/src/test/java/com/alicloud/openservices/tablestore/common/OTSTableBuilder.java new file mode 100644 index 0000000..7e36e84 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/OTSTableBuilder.java @@ -0,0 +1,31 @@ +package com.alicloud.openservices.tablestore.common; + +import com.alicloud.openservices.tablestore.model.ReservedThroughput; +import com.alicloud.openservices.tablestore.model.TableMeta; +import com.alicloud.openservices.tablestore.model.TableOptions; + +public class OTSTableBuilder { + private TableMeta meta; + private TableOptions to; + private ReservedThroughput reservedThroughput = new ReservedThroughput(); + + private OTSTableBuilder() {} + + public static OTSTableBuilder newInstance() { + return new OTSTableBuilder(); + } + + public OTSTableBuilder setTableMeta(TableMeta meta) { + this.meta = meta; + return this; + } + + public OTSTableBuilder setTableOptions(TableOptions to) { + this.to = to; + return this; + } + + public Table toTable() { + return new Table(meta, reservedThroughput, to); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/OTSTestConst.java b/src/test/java/com/alicloud/openservices/tablestore/common/OTSTestConst.java new file mode 100644 index 0000000..f21ec4c --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/OTSTestConst.java @@ -0,0 +1,13 @@ +package com.alicloud.openservices.tablestore.common; + +public class OTSTestConst { + public static final int CREATE_TABLE_SLEEP_IN_SECOND = 2; + + public static final int UPDATE_TABLE_SLEEP_IN_SECOND = 10; + + public static final int DEFAULT_MAX_VERSION = Integer.MAX_VALUE; + + public static final int DEFAULT_TTL= -1; + + public static final long TIMESTAMP_DEVIATION_IN_SECOND = 30; +} diff --git a/src/test/java/com/aliyun/openservices/ots/utils/ServiceSettings.java b/src/test/java/com/alicloud/openservices/tablestore/common/ServiceSettings.java similarity index 96% rename from src/test/java/com/aliyun/openservices/ots/utils/ServiceSettings.java rename to src/test/java/com/alicloud/openservices/tablestore/common/ServiceSettings.java index 2088cce..13884e5 100644 --- a/src/test/java/com/aliyun/openservices/ots/utils/ServiceSettings.java +++ b/src/test/java/com/alicloud/openservices/tablestore/common/ServiceSettings.java @@ -1,4 +1,7 @@ -package com.aliyun.openservices.ots.utils; +package com.alicloud.openservices.tablestore.common; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -6,15 +9,12 @@ import java.io.InputStream; import java.util.Properties; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - public class ServiceSettings { private static final String SETTINGS_FILE_NAME = "src/test/resources/conf.properties"; private static final Log log = LogFactory.getLog(ServiceSettings.class); - + private Properties properties = new Properties(); @@ -56,7 +56,7 @@ public String getOTSAccessKeySecret() { public void setOTSAccessKeySecret(String otsAccessKeySecret) { properties.setProperty("ots.accesskeysecret", otsAccessKeySecret); } - + public String getOTSInstanceName() { String instanceName = properties.getProperty("ots.instancename"); if (instanceName.isEmpty()) { @@ -64,11 +64,11 @@ public String getOTSInstanceName() { } return instanceName; } - + public void setOTSInstanceName(String otsInstanceName) { properties.setProperty("ots.instancename", otsInstanceName); - } - + } + public String getProxyHost() { return properties.getProperty("proxy.host"); } @@ -79,7 +79,7 @@ public void setProxyHost(String proxyHost) { public int getProxyPort() { if (properties.getProperty("proxy.port") != null) { - return Integer.parseInt(properties.getProperty("proxy.port")); + return Integer.parseInt(properties.getProperty("proxy.port")); } else { return 0; @@ -129,3 +129,4 @@ public static ServiceSettings load() { return ss; } } + diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/Table.java b/src/test/java/com/alicloud/openservices/tablestore/common/Table.java new file mode 100644 index 0000000..a8dff5a --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/Table.java @@ -0,0 +1,65 @@ +package com.alicloud.openservices.tablestore.common; + +import java.util.Date; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import com.alicloud.openservices.tablestore.model.*; + +public class Table { + private long lastUpdateTime; + private TableMeta meta; + private ReservedThroughput reservedThroughput; + private TableOptions tableOptions; + private Map datas = new ConcurrentHashMap(); + + public Table( + TableMeta meta, + ReservedThroughput reservedThroughput, + TableOptions tableOptions) { + this.lastUpdateTime = new Date().getTime(); + this.meta = meta; + this.reservedThroughput = reservedThroughput; + this.tableOptions = tableOptions; + } + + public long getLastUpdateTime() { + return lastUpdateTime; + } + + public void setLastUpdateTime(long lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + } + + public TableMeta getMeta() { + return meta; + } + + public void setMeta(TableMeta meta) { + this.meta = meta; + } + + public ReservedThroughput getReservedThroughput() { + return reservedThroughput; + } + + public void setReservedThroughput(ReservedThroughput reservedThroughput) { + this.reservedThroughput = reservedThroughput; + } + public TableOptions getTableOptions() { + return tableOptions; + } + + public void setTableOptions(TableOptions tableOptions) { + this.tableOptions = tableOptions; + } + + public Map getDatas() { + return datas; + } + + public void setDatas(Map datas) { + this.datas = datas; + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/TestUtil.java b/src/test/java/com/alicloud/openservices/tablestore/common/TestUtil.java new file mode 100644 index 0000000..4baabb4 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/TestUtil.java @@ -0,0 +1,155 @@ +package com.alicloud.openservices.tablestore.common; + +import com.alicloud.openservices.tablestore.model.*; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import static org.junit.Assert.assertEquals; + +public class TestUtil { + + public static long randomLong() { + Random random = new Random(System.currentTimeMillis()); + return random.nextInt(); + } + + public static boolean randomBoolean() { + Random random = new Random(System.currentTimeMillis()); + return random.nextInt() % 2 == 0; + } + + public static double randomDouble() { + Random random = new Random(System.currentTimeMillis()); + return random.nextDouble(); + } + + public static byte[] randomBytes(int length) { + Random random = new Random(System.currentTimeMillis()); + byte[] result = new byte[length]; + random.nextBytes(result); + return result; + } + + public static String randomString(int length) { + Random random = new Random(System.currentTimeMillis()); + char[] chars = new char[length]; + for (int i = 0; i < length; i++) { + chars[i] = (char)random.nextInt(); + } + return new String(new String(chars).getBytes()); + } + + public static int randomLength() { + int length = (int)(randomLong() % (1024)); + return Math.abs(length); + } + + public static PrimaryKeyValue randomPrimaryKeyValue(PrimaryKeyType type) { + switch (type) { + case STRING: + return PrimaryKeyValue.fromString(randomString(randomLength())); + case INTEGER: + return PrimaryKeyValue.fromLong(randomLong()); + case BINARY: + return PrimaryKeyValue.fromBinary(randomBytes(randomLength())); + default: + throw new IllegalStateException("Unsupported primary key type: " + type); + } + } + + public static ColumnValue randomColumnValue(ColumnType type) { + switch (type) { + case STRING: + return ColumnValue.fromString(randomString(randomLength())); + case INTEGER: + return ColumnValue.fromLong(randomLong()); + case BOOLEAN: + return ColumnValue.fromBoolean(randomBoolean()); + case DOUBLE: + return ColumnValue.fromDouble(randomDouble()); + case BINARY: + return ColumnValue.fromBinary(randomBytes(randomLength())); + default: + throw new IllegalStateException("Unsupported column type: " + type); + } + } + + public static PrimaryKey randomPrimaryKey(PrimaryKeySchema[] schema) { + PrimaryKeyColumn[] pks = new PrimaryKeyColumn[schema.length]; + for (int i = 0; i < schema.length; i++) { + pks[i] = new PrimaryKeyColumn(schema[i].getName(), randomPrimaryKeyValue(schema[i].getType())); + } + return new PrimaryKey(pks); + } + + public static PrimaryKeySchema[] randomPrimaryKeySchema(int size) { + PrimaryKeySchema[] pks = new PrimaryKeySchema[size]; + for (int i = 0; i < size; i++) { + String name = "pk" + i; + switch (Math.abs((int)randomLong()) % 3) { + case 0: + pks[i] = new PrimaryKeySchema(name, PrimaryKeyType.INTEGER); + break; + case 1: + pks[i] = new PrimaryKeySchema(name, PrimaryKeyType.BINARY); + break; + case 2: + pks[i] = new PrimaryKeySchema(name, PrimaryKeyType.STRING); + break; + default: + throw new IllegalStateException(); + } + } + return pks; + } + + public static Row randomRow(int pkCount, int columnCount) { + PrimaryKey primaryKey = randomPrimaryKey(randomPrimaryKeySchema(pkCount)); + List columns = new ArrayList(); + for (int i = 0; i < columnCount; i++) { + columns.add(new Column("column" + i, randomColumnValue(ColumnType.INTEGER), Math.abs(randomLong()))); + } + return new Row(primaryKey, columns); + } + + public static void compareRow(Row row1, Row row2) { + assertEquals(row1.getPrimaryKey(), row2.getPrimaryKey()); + assertEquals(row1.getColumns().length, row2.getColumns().length); + for (int i = 0; i < row1.getColumns().length; i++) { + assertEquals(row1.getColumns()[i], row2.getColumns()[i]); + } + } + + private static Field getAccessibleField(Class clazz, String fieldName) + throws NoSuchFieldException { + + Field field = clazz.getDeclaredField(fieldName); + field.setAccessible(true); + return field; + } + + private static void injectIntoUnmodifiableMap(String key, String value, Object map) throws Exception { + Class unmodifiableMap = Class.forName("java.util.Collections$UnmodifiableMap"); + Field field = getAccessibleField(unmodifiableMap, "m"); + Object obj = field.get(map); + ((Map) obj).put(key, value); + } + + public static void injectEnvironmentVariable(String key, String value) + throws Exception { + + Class processEnvironment = Class.forName("java.lang.ProcessEnvironment"); + + Field unmodifiableMapField = getAccessibleField(processEnvironment, "theUnmodifiableEnvironment"); + Object unmodifiableMap = unmodifiableMapField.get(null); + injectIntoUnmodifiableMap(key, value, unmodifiableMap); + + Field mapField = getAccessibleField(processEnvironment, "theEnvironment"); + Map map = (Map) mapField.get(null); + map.put(key, value); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/common/Utils.java b/src/test/java/com/alicloud/openservices/tablestore/common/Utils.java new file mode 100644 index 0000000..81155a2 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/common/Utils.java @@ -0,0 +1,122 @@ +package com.alicloud.openservices.tablestore.common; + +import java.io.UnsupportedEncodingException; +import java.util.List; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.core.ErrorCode; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.assertEquals; + +public class Utils { + + private static final Logger LOG = LoggerFactory.getLogger(Utils.class); + + public static void sleepSeconds(int seconds) { + try { + Thread.sleep(seconds * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + System.exit(-1); + } + } + + public static boolean checkNameExiste(List names, String name) { + for (String n : names) { + if (n.equals(name)) { + return true; + } + } + return false; + } + + public static PrimaryKeyValue getPKColumnValue(PrimaryKeyType type, String value) throws UnsupportedEncodingException { + switch (type) { + case INTEGER: + return PrimaryKeyValue.fromLong(Long.valueOf(value)); + case STRING: + return PrimaryKeyValue.fromString(value); + case BINARY: + return PrimaryKeyValue.fromBinary(value.getBytes("UTF-8")); + default: + throw new RuntimeException("Bug: not support : " + type); + } + } + + public static PrimaryKey getMinPK(List scheme) { + PrimaryKeyBuilder builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + for (PrimaryKeySchema s : scheme) { + builder.addPrimaryKeyColumn(s.getName(), PrimaryKeyValue.INF_MIN); + } + return builder.build(); + } + + public static PrimaryKey getMaxPK(List scheme) { + PrimaryKeyBuilder builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + for (PrimaryKeySchema s : scheme) { + builder.addPrimaryKeyColumn(s.getName(), PrimaryKeyValue.INF_MAX); + } + return builder.build(); + } + + + public static void deleteTableIfExist(SyncClientInterface ots, String tableName) { + try { + OTSHelper.deleteTable(ots, tableName); + } catch (TableStoreException e) { + if (e.getErrorCode() != ErrorCode.OBJECT_NOT_EXIST) { + throw e; + } + } + } + + public static SyncClientInterface getOTSInstance() { + return getOTSInstance(null); + } + + public static SyncClientInterface getOTSInstance(ClientConfiguration configuration) { + ServiceSettings serviceSettings = ServiceSettings.load(); + return new SyncClient( + serviceSettings.getOTSEndpoint(), + serviceSettings.getOTSAccessKeyId(), + serviceSettings.getOTSAccessKeySecret(), + serviceSettings.getOTSInstanceName(), + configuration + ); + } + + public static void checkColumns(Column[] columns, List expect) { + checkColumns(columns, expect, true); + } + + public static void checkColumns(Column[] columns, List expect, + boolean isCheckTimestamp) { + //LOG.info("Expect Size: {}, actual size : {}, isCheckTimestamp : {} ", expect.size(), columns.length, isCheckTimestamp); + LOG.info("Expect:"); + for (Column c : expect) { + LOG.info(c.toString()); + } + LOG.info("Actual:"); + for (Column c : columns) { + LOG.info(c.toString()); + } + assertEquals(expect.size(), columns.length); + for (int i = 0; i < columns.length; i++) { + LOG.info("expect:{}, actual:{}", expect.get(i).toString(), columns[i].toString()); + assertEquals(expect.get(i).getName(), columns[i].getName()); + assertEquals(expect.get(i).getValue(), columns[i].getValue()); + if (isCheckTimestamp == true) { + assertEquals(expect.get(i).getTimestamp(), columns[i].getTimestamp()); + } + } + } + + public static void waitForPartitionLoad(String tableName) { + sleepSeconds(OTSTestConst.CREATE_TABLE_SLEEP_IN_SECOND); + } +} + diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncBatchGetRowCompletion.java b/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncBatchGetRowCompletion.java new file mode 100644 index 0000000..865b76b --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncBatchGetRowCompletion.java @@ -0,0 +1,246 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.DefaultCredentialProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.Error; +import org.apache.http.concurrent.FutureCallback; +import org.junit.Test; + +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TestAsyncBatchGetRowCompletion { + + static class BatchGetRowCompletion extends AsyncBatchGetRowCompletion { + public BatchGetRowCompletion(OperationLauncher launcher, + BatchGetRowRequest request, + TraceLogger tracer, + ExecutorService callbackExecutor, + RetryStrategy retry, + ScheduledExecutorService retryExecutor) { + super(launcher, request, tracer, callbackExecutor, retry, retryExecutor); + } + + @Override + public void onCompleted(final BatchGetRowRequest req, final BatchGetRowResponse res) { + } + } + + private BatchGetRowCompletion buildBatchGetRowCompletion(BatchGetRowRequest batchGetRowRequest) { + TraceLogger traceLogger = new TraceLogger("traceId", 1000); + RetryStrategy retryStrategy = new DefaultRetryStrategy(); + ExecutorService callbackExecutor = Executors.newFixedThreadPool(1); + ScheduledExecutorService retryExecutor = Executors.newSingleThreadScheduledExecutor(); + AsyncServiceClient client = new AsyncServiceClient(new ClientConfiguration()); + + callbackExecutor.shutdown(); + retryExecutor.shutdown(); + client.shutdown(); + + BatchGetRowCompletion completion = new BatchGetRowCompletion(new OperationLauncher("", client, + new DefaultCredentialProvider("accessid", "accesskey"), new ClientConfiguration(), batchGetRowRequest) { + @Override + public void fire(BatchGetRowRequest request, FutureCallback cb) { + + } + }, batchGetRowRequest, traceLogger, callbackExecutor, retryStrategy, retryExecutor); + return completion; + } + + private BatchGetRowRequest generateBatchGetRowRequest(int tableNum, int rowPerTable) { + BatchGetRowRequest batchGetRowRequest = new BatchGetRowRequest(); + for (int i = 0; i < tableNum; i++) { + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("Table" + i); + for (int j = 0; j < rowPerTable; j++) { + PrimaryKey primaryKey = new PrimaryKey(new PrimaryKeyColumn[] {new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(j))}); + criteria.addRow(primaryKey); + } + criteria.setMaxVersions(i + 1); // test set parameters for next request. + batchGetRowRequest.addMultiRowQueryCriteria(criteria); + } + return batchGetRowRequest; + } + + private List generateRowSlices(Row row) { + Random random = new Random(); + List responseList = new ArrayList(); + Response response = new Response("requestId"); + if (row == null) { + while (random.nextBoolean()) { + GetRowResponse getRowResponse = new GetRowResponse(response, null, new ConsumedCapacity(new CapacityUnit(1, 0))); + getRowResponse.setNextToken("token".getBytes()); + responseList.add(getRowResponse); + } + responseList.add(new GetRowResponse(response, null, new ConsumedCapacity(new CapacityUnit(1, 0)))); + return responseList; + } else { + PrimaryKey primaryKey = row.getPrimaryKey(); + List columns = Arrays.asList(row.getColumns()); + while (random.nextBoolean()) { + GetRowResponse getRowResponse = new GetRowResponse(response, null, new ConsumedCapacity(new CapacityUnit(1, 0))); + getRowResponse.setNextToken("token".getBytes()); + responseList.add(getRowResponse); + } + int cur = 0; + boolean finished = false; + while (!finished) { + int size = random.nextInt(columns.size() + 1 - cur); + Row rowSlice = null; + if (size > 0) { + rowSlice = new Row(primaryKey, columns.subList(cur, cur + size)); + } + GetRowResponse getRowResponse = new GetRowResponse(response, rowSlice, new ConsumedCapacity(new CapacityUnit(1, 0))); + cur += size; + if (cur == columns.size()) { + finished = random.nextBoolean(); + } + if (!finished) { + getRowResponse.setNextToken("token".getBytes()); + } else if (columns.isEmpty()) { + rowSlice = new Row(primaryKey, new ArrayList()); + getRowResponse = new GetRowResponse(response, rowSlice, new ConsumedCapacity(new CapacityUnit(1, 0))); + } + responseList.add(getRowResponse); + } + return responseList; + } + } + + private List generateColumn(int colNum, int verNum) { + Random random = new Random(); + List columns = new ArrayList(); + for (int i = 0; i < colNum; i++) { + for (int j = 0; j < verNum; j++) { + columns.add(new Column("Col" + i, ColumnValue.fromLong(random.nextInt()), j)); + } + } + return columns; + } + + @Test + public void testOneRow() { + for (int t = 0; t < 100; t++) { + PrimaryKey primaryKey = new PrimaryKey(new PrimaryKeyColumn[]{new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(0))}); + List columns = generateColumn(10, 10); + Row row = new Row(primaryKey, columns); + BatchGetRowRequest batchGetRowRequest = generateBatchGetRowRequest(1, 1); + BatchGetRowCompletion completion = buildBatchGetRowCompletion(batchGetRowRequest); + + List getRowResponses = generateRowSlices(row); + for (GetRowResponse getRowResponse : getRowResponses) { + BatchGetRowResponse batchGetRowResponse = new BatchGetRowResponse(new Response("requestId")); + batchGetRowResponse.addResult(new BatchGetRowResponse.RowResult("Table0", getRowResponse.getRow(), new ConsumedCapacity(new CapacityUnit(1, 0)), 0, getRowResponse.getNextToken())); + completion.handleResult(batchGetRowResponse); + } + + BatchGetRowResponse batchGetRowResponse = completion.buildFinalResult(); + assertEquals(1, batchGetRowResponse.getTableToRowsResult().size()); + assertEquals(1, batchGetRowResponse.getBatchGetRowResult("Table0").size()); + BatchGetRowResponse.RowResult rowResult = batchGetRowResponse.getBatchGetRowResult("Table0").get(0); + assertEquals(row.toString(), rowResult.getRow().toString()); + assertTrue(!rowResult.hasNextToken()); + } + } + + @Test + public void testMultiTableWithMultiRow() { + for (int t = 0; t < 10; t++) { + Map>> allResults = new HashMap>>(); + Map> finalResults = new HashMap>(); + + for (int i = 0; i < 10; i++) { + Map> tableResults = new HashMap>(); + Map tableRows = new HashMap(); + for (int j = 0; j < 10; j++) { + PrimaryKey primaryKey = new PrimaryKey(new PrimaryKeyColumn[]{new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(j))}); + List columns = generateColumn(10, 10); + Row row = new Row(primaryKey, columns); + tableResults.put(primaryKey, generateRowSlices(row).iterator()); + tableRows.put(primaryKey, row); + } + allResults.put("Table" + i, tableResults); + finalResults.put("Table" + i, tableRows); + } + + BatchGetRowRequest batchGetRowRequest = generateBatchGetRowRequest(10, 10); + BatchGetRowCompletion completion = buildBatchGetRowCompletion(batchGetRowRequest); + + while (!batchGetRowRequest.isEmpty()) { + BatchGetRowResponse response = new BatchGetRowResponse(new Response("requestId")); + for (String table : batchGetRowRequest.getCriteriasByTable().keySet()) { + MultiRowQueryCriteria criteria = batchGetRowRequest.getCriteria(table); + for (int i = 0; i < criteria.getRowKeys().size(); i++) { + PrimaryKey primaryKey = criteria.get(i); + GetRowResponse getRowResponse = allResults.get(table).get(primaryKey).next(); + response.addResult(new BatchGetRowResponse.RowResult(table, getRowResponse.getRow(), getRowResponse.getConsumedCapacity(), i, getRowResponse.getNextToken())); + } + } + completion.handleResult(response); + completion.buildNextRequest(); + batchGetRowRequest = completion.nextRequest; + } + BatchGetRowResponse batchGetRowResponse = completion.buildFinalResult(); + assertEquals(100, batchGetRowResponse.getSucceedRows().size()); + assertEquals(0, batchGetRowResponse.getFailedRows().size()); + for (BatchGetRowResponse.RowResult rowResult : batchGetRowResponse.getSucceedRows()) { + Row expect = finalResults.get(rowResult.getTableName()).get(rowResult.getRow().getPrimaryKey()); + assertEquals(expect.toString(), rowResult.getRow().toString()); + } + } + } + + @Test + public void testBuildNextRequest() { + Random random = new Random(); + for (int t = 0; t < 100; t++) { + BatchGetRowRequest batchGetRowRequest = generateBatchGetRowRequest(10, 10); + BatchGetRowCompletion completion = buildBatchGetRowCompletion(batchGetRowRequest); + + BatchGetRowResponse response = new BatchGetRowResponse(new Response("requestId")); + BatchGetRowRequest nextRequest = new BatchGetRowRequest(); + for (int i = 0; i < 10; i++) { + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria("Table" + i); + multiRowQueryCriteria.setMaxVersions(i + 1); // test set parameters for next request. + for (int j = 0; j < 10; j++) { + BatchGetRowResponse.RowResult rowResult; + if (random.nextBoolean()) { + if (random.nextBoolean()) { + rowResult = new BatchGetRowResponse.RowResult("Table" + i, null, new ConsumedCapacity(new CapacityUnit(1, 1)), j, ("token" + i + j).getBytes()); + multiRowQueryCriteria.addRow(batchGetRowRequest.getPrimaryKey("Table" + i, j), ("token" + i + j).getBytes()); + } else { + rowResult = new BatchGetRowResponse.RowResult("Table" + i, null, new ConsumedCapacity(new CapacityUnit(1, 1)), j); + } + } else { + rowResult = new BatchGetRowResponse.RowResult("Table" + i, new Error("", ""), j); + } + response.addResult(rowResult); + } + if (!multiRowQueryCriteria.isEmpty()) { + nextRequest.addMultiRowQueryCriteria(multiRowQueryCriteria); + } + } + completion.handleResult(response); + completion.buildNextRequest(); + + assertEquals(nextRequest.getCriteriasByTable().size(), completion.nextRequest.getCriteriasByTable().size()); + for (String tableName : nextRequest.getCriteriasByTable().keySet()) { + MultiRowQueryCriteria expectCriteria = nextRequest.getCriteria(tableName); + MultiRowQueryCriteria criteria = completion.nextRequest.getCriteria(tableName); + assertEquals(expectCriteria.getRowKeys().size(), criteria.getRowKeys().size()); + assertEquals(expectCriteria.getMaxVersions(), criteria.getMaxVersions()); // test set parameters in next request. + for (int i = 0; i < expectCriteria.getRowKeys().size(); i++) { + assertEquals(expectCriteria.getRowKeys().get(i), criteria.getRowKeys().get(i)); + assertTrue(Arrays.equals(expectCriteria.getTokens().get(i), criteria.getTokens().get(i))); + } + } + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRangeCompletion.java b/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRangeCompletion.java new file mode 100644 index 0000000..d6e9536 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRangeCompletion.java @@ -0,0 +1,169 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.BasicCredentials; +import com.alicloud.openservices.tablestore.core.auth.DefaultCredentialProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import org.apache.http.concurrent.FutureCallback; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TestAsyncGetRangeCompletion { + + static class GetRangeCompletion extends AsyncGetRangeCompletion { + + GetRangeResponse finalResult; + + public GetRangeCompletion(OperationLauncher launcher, + GetRangeRequest request, + TraceLogger tracer, + ExecutorService callbackExecutor, + RetryStrategy retry, + ScheduledExecutorService retryExecutor) { + super(launcher, request, tracer, callbackExecutor, retry, retryExecutor); + } + + @Override + public void onCompleted(final GetRangeRequest req, final GetRangeResponse res) { + finalResult = res; + } + } + + private GetRangeCompletion buildGetRangeCompletion(GetRangeRequest getRangeRequest) { + TraceLogger traceLogger = new TraceLogger("traceId", 1000); + RetryStrategy retryStrategy = new DefaultRetryStrategy(); + ExecutorService callbackExecutor = Executors.newFixedThreadPool(1); + ScheduledExecutorService retryExecutor = Executors.newSingleThreadScheduledExecutor(); + AsyncServiceClient client = new AsyncServiceClient(new ClientConfiguration()); + + callbackExecutor.shutdown(); + retryExecutor.shutdown(); + client.shutdown(); + + GetRangeCompletion completion = new GetRangeCompletion(new OperationLauncher("", client, + new DefaultCredentialProvider("accessid", "accesskey"), new ClientConfiguration(), getRangeRequest) { + @Override + public void fire(GetRangeRequest request, FutureCallback cb) { + + } + }, getRangeRequest, traceLogger, callbackExecutor, retryStrategy, retryExecutor); + return completion; + } + + private List generateColumn(int colNum, int verNum) { + Random random = new Random(); + List columns = new ArrayList(); + for (int i = 0; i < colNum; i++) { + for (int j = 0; j < verNum; j++) { + columns.add(new Column("Col" + i, ColumnValue.fromLong(random.nextInt()), j)); + } + } + return columns; + } + + @Test + public void testMoreThanOneRow() { + GetRangeRequest getRangeRequest = new GetRangeRequest(); + GetRangeCompletion completion = buildGetRangeCompletion(getRangeRequest); + GetRangeResponse getRangeResponse = new GetRangeResponse(new Response("reqId"), new ConsumedCapacity(new CapacityUnit(1, 1))); + List rows = new ArrayList(); + + PrimaryKey primaryKey = new PrimaryKey(new PrimaryKeyColumn[] {new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(1))}); + Row row1 = new Row(primaryKey, generateColumn(10, 10)); + primaryKey = new PrimaryKey(new PrimaryKeyColumn[]{new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(2))}); + Row row2 = new Row(primaryKey, generateColumn(10, 10)); + rows.add(row1); + rows.add(row2); + getRangeResponse.setRows(rows); + getRangeResponse.setNextToken("token".getBytes()); + + completion.completed(getRangeResponse); + assertEquals(2, completion.finalResult.getRows().size()); + assertEquals(row1, completion.finalResult.getRows().get(0)); + assertEquals(row2, completion.finalResult.getRows().get(1)); + + completion = buildGetRangeCompletion(getRangeRequest); + getRangeResponse.setNextStartPrimaryKey(row2.getPrimaryKey()); + completion.completed(getRangeResponse); + assertEquals(1, completion.finalResult.getRows().size()); + assertEquals(row1, completion.finalResult.getRows().get(0)); + } + + @Test + public void testBuildNextRequest() { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria("Table"); + PrimaryKey primaryKey = new PrimaryKey(new PrimaryKeyColumn[] {new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(1))}); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKey); + primaryKey = new PrimaryKey(new PrimaryKeyColumn[] {new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(2))}); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKey); + rangeRowQueryCriteria.setMaxVersions(10); + rangeRowQueryCriteria.setTimeRange(new TimeRange(0, 100)); + rangeRowQueryCriteria.setFilter(new SingleColumnValueFilter("Col", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(1))); + rangeRowQueryCriteria.setLimit(10); + rangeRowQueryCriteria.setDirection(Direction.BACKWARD); + rangeRowQueryCriteria.setStartColumn("Col1"); + rangeRowQueryCriteria.setEndColumn("Col2"); + GetRangeRequest getRangeRequest = new GetRangeRequest(rangeRowQueryCriteria); + + GetRangeCompletion completion = buildGetRangeCompletion(getRangeRequest); + primaryKey = new PrimaryKey(new PrimaryKeyColumn[] {new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(3))}); + completion.buildNextRequest(primaryKey, "token".getBytes()); + + GetRangeRequest nextRequest = completion.nextRequest; + + assertEquals(primaryKey, nextRequest.getRangeRowQueryCriteria().getInclusiveStartPrimaryKey()); + assertEquals(rangeRowQueryCriteria.getExclusiveEndPrimaryKey(), nextRequest.getRangeRowQueryCriteria().getExclusiveEndPrimaryKey()); + assertEquals(10, nextRequest.getRangeRowQueryCriteria().getMaxVersions()); + assertEquals(rangeRowQueryCriteria.getTimeRange(), nextRequest.getRangeRowQueryCriteria().getTimeRange()); + assertTrue(nextRequest.getRangeRowQueryCriteria().getFilter() instanceof SingleColumnValueFilter); + assertEquals(10, nextRequest.getRangeRowQueryCriteria().getLimit()); + assertEquals(Direction.BACKWARD, nextRequest.getRangeRowQueryCriteria().getDirection()); + assertEquals("Col1", nextRequest.getRangeRowQueryCriteria().getStartColumn()); + assertEquals("Col2", nextRequest.getRangeRowQueryCriteria().getEndColumn()); + assertTrue(Arrays.equals("token".getBytes(), nextRequest.getRangeRowQueryCriteria().getToken())); + } + + @Test + public void testHandleResult() { + GetRangeRequest getRangeRequest = new GetRangeRequest(); + GetRangeCompletion completion = buildGetRangeCompletion(getRangeRequest); + GetRangeResponse getRangeResponse = new GetRangeResponse(new Response("reqId"), new ConsumedCapacity(new CapacityUnit(1, 1))); + List rows = new ArrayList(); + + PrimaryKey primaryKey = new PrimaryKey(new PrimaryKeyColumn[] {new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(1))}); + Row row1 = new Row(primaryKey, generateColumn(10, 10)); + primaryKey = new PrimaryKey(new PrimaryKeyColumn[]{new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(2))}); + Row row2 = new Row(primaryKey, generateColumn(10, 10)); + rows.add(row1); + rows.add(row2); + getRangeResponse.setRows(rows); + getRangeResponse.setNextToken("token".getBytes()); + + completion.handleResult(getRangeResponse); + assertEquals(2, completion.completeRows.size()); + assertEquals(row1, completion.completeRows.get(0)); + assertEquals(row2, completion.completeRows.get(1)); + + completion = buildGetRangeCompletion(getRangeRequest); + + getRangeResponse.setNextStartPrimaryKey(row2.getPrimaryKey()); + completion.handleResult(getRangeResponse); + assertEquals(1, completion.completeRows.size()); + assertEquals(row1, completion.completeRows.get(0)); + assertEquals(row2.getPrimaryKey(), completion.lastRowPK); + assertEquals(100, completion.lastRowColumns.size()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRowCompletion.java b/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRowCompletion.java new file mode 100644 index 0000000..cea3590 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/TestAsyncGetRowCompletion.java @@ -0,0 +1,146 @@ +package com.alicloud.openservices.tablestore.core; + +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.core.auth.DefaultCredentialProvider; +import com.alicloud.openservices.tablestore.core.auth.ServiceCredentials; +import com.alicloud.openservices.tablestore.core.http.AsyncServiceClient; +import com.alicloud.openservices.tablestore.model.*; +import org.apache.http.concurrent.FutureCallback; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; + +import static org.junit.Assert.assertEquals; + +public class TestAsyncGetRowCompletion { + + static class GetRowCompletion extends AsyncGetRowCompletion { + + public GetRowCompletion(OperationLauncher launcher, + GetRowRequest request, + TraceLogger tracer, + ExecutorService callbackExecutor, + RetryStrategy retry, + ScheduledExecutorService retryExecutor) { + super(launcher, request, tracer, callbackExecutor, retry, retryExecutor); + } + + @Override + public void onCompleted(final GetRowRequest req, final GetRowResponse res) { + } + } + + private GetRowCompletion buildGetRowCompletion() { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(1)); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria("Table", primaryKeyBuilder.build()); + GetRowRequest getRowRequest = new GetRowRequest(criteria); + TraceLogger traceLogger = new TraceLogger("traceId", 1000); + RetryStrategy retryStrategy = new DefaultRetryStrategy(); + ExecutorService callbackExecutor = Executors.newFixedThreadPool(1); + ScheduledExecutorService retryExecutor = Executors.newSingleThreadScheduledExecutor(); + AsyncServiceClient client = new AsyncServiceClient(new ClientConfiguration()); + + callbackExecutor.shutdown(); + retryExecutor.shutdown(); + client.shutdown(); + + GetRowCompletion completion = new GetRowCompletion(new OperationLauncher("", client, + new DefaultCredentialProvider("accessid", "accesskey"), new ClientConfiguration(), getRowRequest) { + @Override + public void fire(GetRowRequest request, FutureCallback cb) { + + } + }, getRowRequest, traceLogger, callbackExecutor, retryStrategy, retryExecutor); + return completion; + } + + private List generateResponseList(Row row) { + Random random = new Random(); + List responseList = new ArrayList(); + Response response = new Response("requestId"); + if (row == null) { + while (random.nextBoolean()) { + GetRowResponse getRowResponse = new GetRowResponse(response, null, new ConsumedCapacity(new CapacityUnit(1, 0))); + getRowResponse.setNextToken("token".getBytes()); + responseList.add(getRowResponse); + } + responseList.add(new GetRowResponse(response, null, new ConsumedCapacity(new CapacityUnit(1, 0)))); + return responseList; + } else { + PrimaryKey primaryKey = row.getPrimaryKey(); + List columns = Arrays.asList(row.getColumns()); + while (random.nextBoolean()) { + GetRowResponse getRowResponse = new GetRowResponse(response, null, new ConsumedCapacity(new CapacityUnit(1, 0))); + getRowResponse.setNextToken("token".getBytes()); + responseList.add(getRowResponse); + } + int cur = 0; + boolean finished = false; + while (!finished) { + int size = random.nextInt(columns.size() + 1 - cur); + Row rowSlice = null; + if (size > 0) { + rowSlice = new Row(primaryKey, columns.subList(cur, cur + size)); + } + GetRowResponse getRowResponse = new GetRowResponse(response, rowSlice, new ConsumedCapacity(new CapacityUnit(1, 0))); + cur += size; + if (cur == columns.size()) { + finished = random.nextBoolean(); + } + if (!finished) { + getRowResponse.setNextToken("token".getBytes()); + } else if (columns.isEmpty()) { + rowSlice = new Row(primaryKey, new ArrayList()); + getRowResponse = new GetRowResponse(response, rowSlice, new ConsumedCapacity(new CapacityUnit(1, 0))); + } + responseList.add(getRowResponse); + } + return responseList; + } + } + + private List generateColumn(int colNum, int verNum) { + Random random = new Random(); + List columns = new ArrayList(); + for (int i = 0; i < colNum; i++) { + for (int j = 0; j < verNum; j++) { + columns.add(new Column("Col" + i, ColumnValue.fromLong(random.nextInt()), j)); + } + } + return columns; + } + + @Test + public void testHandleResult() { + for (int i = 0; i < 1000; i++) { + GetRowCompletion completion = buildGetRowCompletion(); + List responseList = generateResponseList(null); + for (GetRowResponse getRowResponse : responseList) { + completion.handleResult(getRowResponse); + } + GetRowResponse getRowResponse = completion.buildFinalResult(); + assertEquals(null, getRowResponse.getRow()); + } + + for (int i = 0; i < 1000; i++) { + GetRowCompletion completion = buildGetRowCompletion(); + Random random = new Random(); + PrimaryKey primaryKey = new PrimaryKey(new PrimaryKeyColumn[] {new PrimaryKeyColumn("PK", PrimaryKeyValue.fromLong(1))}); + List columns = generateColumn(random.nextInt(100), random.nextInt(10) + 1); + Row row = new Row(primaryKey, columns); + List responseList = generateResponseList(row); + for (GetRowResponse getRowResponse : responseList) { + completion.handleResult(getRowResponse); + } + GetRowResponse getRowResponse = completion.buildFinalResult(); + assertEquals(row.toString(), getRowResponse.getRow().toString()); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestCredentials.java b/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestCredentials.java new file mode 100644 index 0000000..21b06fd --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestCredentials.java @@ -0,0 +1,178 @@ +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.common.TestUtil; +import org.junit.Test; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +import static org.junit.Assert.*; + +public class TestCredentials { + + @Test + public void testBasicCredentials() throws Exception { + BasicCredentials bc = new BasicCredentials("accessid", "accesskey", "token", 0); + assertEquals(bc.getAccessKeyId(), "accessid"); + assertEquals(bc.getAccessKeySecret(), "accesskey"); + assertEquals(bc.getSecurityToken(), "token"); + + assertFalse(bc.willSoonExpire()); + + bc = new BasicCredentials("accessid", "accesskey", "token").withExpiredDuration(10).withExpiredFactor(0.8); + assertFalse(bc.willSoonExpire()); + + Thread.sleep(2000); + assertFalse(bc.willSoonExpire()); + + Thread.sleep(6100); + assertTrue(bc.willSoonExpire()); + + Thread.sleep(3000); + assertTrue(bc.willSoonExpire()); + } + + @Test + public void testBasicCredentialsDefaultValue() throws Exception { + BasicCredentials bc = new BasicCredentials("accessid", "accesskey", "token"); + assertEquals(bc.getAccessKeyId(), "accessid"); + assertEquals(bc.getAccessKeySecret(), "accesskey"); + assertEquals(bc.getSecurityToken(), "token"); + assertEquals(bc.expiredDurationSeconds, 0); + assertFalse(bc.willSoonExpire()); + + Thread.sleep(10000); + assertFalse(bc.willSoonExpire()); + + bc.withExpiredDuration(10); + assertTrue(bc.willSoonExpire()); + } + + @Test + public void testDefaultCredentialProvider() { + try { + CredentialsProviderFactory.newDefaultCredentialProvider("", "a"); + fail("expect failure"); + } catch (InvalidCredentialsException e) { + assertEquals(e.getMessage(), "Access key id should not be null or empty."); + } + try { + CredentialsProviderFactory.newDefaultCredentialProvider(null, "a"); + fail("expect failure"); + } catch (InvalidCredentialsException e) { + assertEquals(e.getMessage(), "Access key id should not be null or empty."); + } + try { + CredentialsProviderFactory.newDefaultCredentialProvider("a", ""); + fail("expect failure"); + } catch (InvalidCredentialsException e) { + assertEquals(e.getMessage(), "Access key secret should not be null or empty."); + } + try { + CredentialsProviderFactory.newDefaultCredentialProvider("a", null); + fail("expect failure"); + } catch (InvalidCredentialsException e) { + assertEquals(e.getMessage(), "Access key secret should not be null or empty."); + } + + CredentialsProvider cp = CredentialsProviderFactory.newDefaultCredentialProvider("accessid", "accesskey", "token"); + assertEquals(cp.getCredentials().getAccessKeyId(), "accessid"); + assertEquals(cp.getCredentials().getAccessKeySecret(), "accesskey"); + assertEquals(cp.getCredentials().getSecurityToken(), "token"); + + cp = CredentialsProviderFactory.newDefaultCredentialProvider("accessid", "accesskey"); + assertEquals(cp.getCredentials().getSecurityToken(), null); + assertEquals(cp.getCredentials().getAccessKeyId(), "accessid"); + assertEquals(cp.getCredentials().getAccessKeySecret(), "accesskey"); + } + + @Test + public void testEnvCredentialsProvider() throws Exception { + TestUtil.injectEnvironmentVariable(AuthUtils.ACCESS_KEY_ENV_VAR, "accessid"); + TestUtil.injectEnvironmentVariable(AuthUtils.SECRET_KEY_ENV_VAR, "accesskey"); + + CredentialsProvider cp = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider(); + assertEquals(cp.getCredentials().getAccessKeyId(), "accessid"); + assertEquals(cp.getCredentials().getAccessKeySecret(), "accesskey"); + + TestUtil.injectEnvironmentVariable(AuthUtils.SESSION_TOKEN_ENV_VAR, "token"); + cp = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider(); + assertEquals(cp.getCredentials().getAccessKeyId(), "accessid"); + assertEquals(cp.getCredentials().getAccessKeySecret(), "accesskey"); + assertEquals(cp.getCredentials().getSecurityToken(), "token"); + } + + @Test + public void testSystemPropertiesCredentialsProvider() throws Exception { + try { + CredentialsProvider cp = CredentialsProviderFactory.newSystemPropertiesCredentialsProvider(); + cp.getCredentials(); + fail("expect failure."); + } catch (InvalidCredentialsException e) { + assertEquals(e.getMessage(), "Access key id should not be null or empty."); + } + + try { + System.setProperty(AuthUtils.ACCESS_KEY_SYSTEM_PROPERTY, "accessid"); + CredentialsProvider cp = CredentialsProviderFactory.newSystemPropertiesCredentialsProvider(); + cp.getCredentials(); + fail("expect failure."); + } catch (InvalidCredentialsException e) { + assertEquals(e.getMessage(), "Access key secret should not be null or empty."); + } + + System.setProperty(AuthUtils.ACCESS_KEY_SYSTEM_PROPERTY, "accessid"); + System.setProperty(AuthUtils.SECRET_KEY_SYSTEM_PROPERTY, "accesskey"); + CredentialsProvider cp = CredentialsProviderFactory.newSystemPropertiesCredentialsProvider(); + assertEquals(cp.getCredentials().getAccessKeyId(), "accessid"); + assertEquals(cp.getCredentials().getAccessKeySecret(), "accesskey"); + assertEquals(cp.getCredentials().getSecurityToken(), null); + + System.setProperty(AuthUtils.SESSION_TOKEN_SYSTEM_PROPERTY, "token"); + cp = CredentialsProviderFactory.newSystemPropertiesCredentialsProvider(); + assertEquals(cp.getCredentials().getAccessKeyId(), "accessid"); + assertEquals(cp.getCredentials().getAccessKeySecret(), "accesskey"); + assertEquals(cp.getCredentials().getSecurityToken(), "token"); + } + + @Test + public void testInstanceProfileCredentialsBasic() { + InstanceProfileCredentials c = new InstanceProfileCredentials("accessid", "accesskey", "token", "2018-12-25T07:06:37Z"); + assertEquals(c.expiredDurationSeconds, AuthUtils.DEFAULT_ECS_SESSION_TOKEN_DURATION_SECONDS); + assertEquals(c.getAccessKeyId(), "accessid"); + assertEquals(c.getAccessKeySecret(), "accesskey"); + assertEquals(c.getSecurityToken(), "token"); + } + + @Test + public void testInstanceProfileCredentials() throws Exception { + SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + parser.setTimeZone(TimeZone.getTimeZone("GMT")); + Date expireTime = new Date(System.currentTimeMillis() + 10000); // 10s later + String expireTimeStr = parser.format(expireTime); + + InstanceProfileCredentials c = new InstanceProfileCredentials("accessid", "accesskey", "token", expireTimeStr); + c.withExpiredDuration(10).withExpiredFactor(0.6).withRefreshIntervalInMilliseconds(2000); + + Thread.sleep(1000); + assertFalse(c.isExpired()); + assertFalse(c.willSoonExpire()); + assertTrue(c.shouldRefresh()); + + Thread.sleep(5100); + assertFalse(c.isExpired()); + assertTrue(c.willSoonExpire()); + assertTrue(c.shouldRefresh()); + + Thread.sleep(2000); + assertTrue(c.isExpired()); + assertTrue(c.willSoonExpire()); + assertTrue(c.shouldRefresh()); + + Thread.sleep(5000); + assertTrue(c.isExpired()); + assertTrue(c.willSoonExpire()); + assertTrue(c.shouldRefresh()); + } +} \ No newline at end of file diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestInstanceProfileCredentialsProvider.java b/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestInstanceProfileCredentialsProvider.java new file mode 100644 index 0000000..6c79f92 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestInstanceProfileCredentialsProvider.java @@ -0,0 +1,162 @@ +package com.alicloud.openservices.tablestore.core.auth; + +import com.alicloud.openservices.tablestore.ClientException; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.TimeZone; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class TestInstanceProfileCredentialsProvider { + + private volatile String accessId = ""; + private volatile String accessKey = ""; + private volatile String token = ""; + private volatile String code = ""; + private volatile String expiration = ""; + + private volatile String responseJson = ""; + private AtomicLong accessCount = new AtomicLong(0); + private AtomicBoolean failInjection = new AtomicBoolean(false); + private volatile HttpServer server; + + @Before + public void init() throws IOException { + failInjection.set(false); + accessCount.set(0); + responseJson = ""; + startMockServer(); + } + + @After + public void tearDown() { + if (server != null) { + server.stop(5); + } + } + + private void startMockServer() throws IOException { + accessCount.set(0); + server = HttpServer.create(new InetSocketAddress(9999), 0); + server.createContext("/refreshToken/", new HttpHandler() { + @Override + public void handle(HttpExchange httpExchange) throws IOException { + accessCount.incrementAndGet(); + if (!failInjection.get()) { + refreshCredentials(accessCount.get()); + } + byte[] bs = responseJson.getBytes(); + httpExchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, bs.length); + httpExchange.getResponseBody().write(bs); + httpExchange.close(); + } + }); + server.start(); + } + + class InstanceProfileCredentialsFetcherForTest extends InstanceProfileCredentialsFetcher { + @Override + public URL buildUrl() throws ClientException { + try { + return new URL("http://127.0.0.1:9999/refreshToken/"); + } catch (MalformedURLException e) { + throw new ClientException(e); + } + } + + @Override + public ServiceCredentials fetch() throws ClientException { + InstanceProfileCredentials ipc = (InstanceProfileCredentials) super.fetch(); + ipc.withRefreshIntervalInMilliseconds(1000).withExpiredDuration(5).withExpiredFactor(0.6); + return ipc; + } + } + + private void setResponse(String code, String accessId, String accessKey, String token, String expiration) { + this.responseJson = String.format("{\"Code\":\"%s\",\"AccessKeyId\":\"%s\",\"AccessKeySecret\":\"%s\",\"SecurityToken\":\"%s\",\"Expiration\":\"%s\"}", + code, accessId, accessKey, token, expiration); + } + + @Test + public void testHttpCredentialsFetcher() throws Exception { + InstanceProfileCredentialsFetcherForTest fetcher = new InstanceProfileCredentialsFetcherForTest(); + + // invalid response + try { + failInjection.set(true); + fetcher.fetch(3); + fail("expect failure."); + } catch (Exception e) { + e.printStackTrace(); + } + assertEquals(accessCount.get(), 3); + + setResponse("Success", "accessid", "accesskey", "token", "2018-12-25T00:00:00Z"); + ServiceCredentials credentials = fetcher.fetch(); + assertEquals(accessCount.get(), 4); + + assertEquals(credentials.getAccessKeyId(), "accessid"); + assertEquals(credentials.getAccessKeySecret(), "accesskey"); + assertEquals(credentials.getSecurityToken(), "token"); + } + + @Test + public void testInstanceProfileCredentialsProvider() throws Exception { + final InstanceProfileCredentialsProvider cp = CredentialsProviderFactory.newInstanceProfileCredentialsProvider("role"); + InstanceProfileCredentialsFetcherForTest fetcher = new InstanceProfileCredentialsFetcherForTest(); + cp.withCredentialsFetcher(fetcher); + + final AtomicBoolean stop = new AtomicBoolean(false); + List threadsTryGetCreds = new ArrayList(); + for (int i = 0; i < 1; i++) { + Thread t = new Thread(new Runnable() { + @Override + public void run() { + while (!stop.get()) { + InstanceProfileCredentials cd = cp.getCredentials(); + } + } + }); + threadsTryGetCreds.add(t); + } + + for (Thread t : threadsTryGetCreds) { + t.start(); + } + + Thread.sleep(13000); + + stop.set(true); + for (Thread t : threadsTryGetCreds) { + t.join(); + } + + // refresh every 3s + assertEquals(accessCount.get(), 5); + } + + private void refreshCredentials(long i) { + Date d = new Date(System.currentTimeMillis() + 5000); // 5s duration + SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + parser.setTimeZone(TimeZone.getTimeZone("GMT")); + + setResponse("Success", "accessid" + i, "accesskey" + i, "token" + i, parser.format(d)); + } +} diff --git a/src/test/java/com/aliyun/openservices/ots/auth/ServiceSignatureTest.java b/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestServiceSigner.java similarity index 59% rename from src/test/java/com/aliyun/openservices/ots/auth/ServiceSignatureTest.java rename to src/test/java/com/alicloud/openservices/tablestore/core/auth/TestServiceSigner.java index 07da618..cf8ca66 100644 --- a/src/test/java/com/aliyun/openservices/ots/auth/ServiceSignatureTest.java +++ b/src/test/java/com/alicloud/openservices/tablestore/core/auth/TestServiceSigner.java @@ -1,26 +1,21 @@ -package com.aliyun.openservices.ots.auth; +package com.alicloud.openservices.tablestore.core.auth; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import com.alicloud.openservices.tablestore.core.Constants; +import com.alicloud.openservices.tablestore.core.utils.Bytes; +import com.alicloud.openservices.tablestore.core.utils.HttpUtil; +import com.alicloud.openservices.tablestore.core.utils.DateUtil; +import org.junit.Test; import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; -import org.junit.Test; - -import com.aliyun.openservices.ots.utils.DateUtil; -import com.aliyun.openservices.ots.utils.HttpUtil; -import com.aliyun.openservices.ots.utils.ServiceConstants; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; -public class ServiceSignatureTest { - /** - * Test method for {@link com.aliyun.common.auth.ServiceSignature#computeSignature(java.lang.String, java.lang.String)}. - * @throws Exception - */ +public class TestServiceSigner { @Test public void testComputeSignature() throws Exception { - ServiceSignature sign = ServiceSignature.create(); String key = "csdev"; String data = "/ListTable\n" + "Date=Mon%2C%2028%20Nov%202011%2014%3A02%3A46%20GMT" @@ -28,7 +23,13 @@ public void testComputeSignature() throws Exception { + "&SignatureMethod=HmacSHA1&SignatureVersion=1"; String expected = "3mAoxRc8hd7WdaFB5Ii7dGNcwx0="; - String signature = sign.computeSignature(key, data); + ServiceSignature sign = new HmacSHA1Signature(Bytes.toBytes(key)); + sign.updateUTF8String("/ListTable\n"); + sign.updateUTF8String("Date=Mon%2C%2028%20Nov%202011%2014%3A02%3A46%20GMT"); + sign.updateUTF8String("&OTSAccessKeyId=csdev&APIVersion=1"); + sign.updateUTF8String("&SignatureMethod=HmacSHA1&SignatureVersion=1"); + + String signature = sign.computeSignature(); assertEquals(expected, signature); Map parameters = new LinkedHashMap(); @@ -47,8 +48,11 @@ public void testComputeSignature() throws Exception { parameters.put("APIVersion", "1"); parameters.put("SignatureMethod", "HmacSHA1"); parameters.put("SignatureVersion", "1"); - data = "/ListTable\n" + HttpUtil.paramToQueryString(parameters, ServiceConstants.DEFAULT_ENCODING); //OTSUtil.buildRequestParamString(parameters); - signature = sign.computeSignature("csdev", data); + data = "/ListTable\n" + HttpUtil.paramToQueryString(parameters, Constants.UTF8_ENCODING); //OTSUtil.buildRequestParamString(parameters); + + sign = new HmacSHA1Signature(Bytes.toBytes(key)); + sign.updateUTF8String(data); + signature = sign.computeSignature(); assertEquals(expected, signature); } } diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/http/TestOTSUri.java b/src/test/java/com/alicloud/openservices/tablestore/core/http/TestOTSUri.java new file mode 100644 index 0000000..34519fe --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/http/TestOTSUri.java @@ -0,0 +1,38 @@ +package com.alicloud.openservices.tablestore.core.http; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class TestOTSUri { + + @Test + public void testInvalidEndpoint() { + try { + OTSUri uri = new OTSUri("invalid uri", "ListTable"); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } + } + + @Test + public void testValidEndpoint() { + // not with '/' in the end + OTSUri uri = new OTSUri("http://test-java-sdk.ots.aliyuncs.com", "ListTable"); + assertEquals(uri.getUri().toString(), "http://test-java-sdk.ots.aliyuncs.com/ListTable"); + assertEquals(uri.getHost().toHostString(), "test-java-sdk.ots.aliyuncs.com"); + assertEquals(uri.getAction(), "ListTable"); + + // with '/' in the end + uri = new OTSUri("http://test-java-sdk.ots.aliyuncs.com/", "GetRow"); + assertEquals(uri.getUri().toString(), "http://test-java-sdk.ots.aliyuncs.com/GetRow"); + assertEquals(uri.getHost().toHostString(), "test-java-sdk.ots.aliyuncs.com"); + assertEquals(uri.getAction(), "GetRow"); + + // with more than one '/' in the end + uri = new OTSUri("http://test-java-sdk.ots.aliyuncs.com/////", "UpdateRow"); + assertEquals(uri.getUri().toString(), "http://test-java-sdk.ots.aliyuncs.com/UpdateRow"); + assertEquals(uri.getHost().toHostString(), "test-java-sdk.ots.aliyuncs.com"); + assertEquals(uri.getAction(), "UpdateRow"); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferCrc8.java b/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferCrc8.java new file mode 100644 index 0000000..738d190 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferCrc8.java @@ -0,0 +1,26 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +import static com.alicloud.openservices.tablestore.core.protocol.PlainBufferCrc8.*; + +public class TestPlainBufferCrc8 { + + @Test + public void testByte() { + byte c8 = 0; + c8 = crc8(c8, (byte)1); + assertEquals(7, c8); + c8 = crc8(c8, (byte)3); + assertEquals(28, c8); + c8 = crc8(c8, (byte)7); + assertEquals(65, c8); + c8 = crc8(c8, (byte)255); + assertEquals(51, c8); + c8 = crc8(c8, (byte)128); + assertEquals(16, c8); + c8 = crc8(c8, (byte)0); + assertEquals(112, c8); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferInputStream.java b/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferInputStream.java new file mode 100644 index 0000000..8dd4b68 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferInputStream.java @@ -0,0 +1,223 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import com.alicloud.openservices.tablestore.core.utils.Bytes; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import static org.junit.Assert.*; + +public class TestPlainBufferInputStream { + + private static interface CheckValue { + public void check(PlainBufferInputStream input) throws Exception; + } + + @Test + public void testVariousType() throws Exception { + PlainBufferOutputStream output = new PlainBufferOutputStream(50000); + + List checkings = new ArrayList(); + Random random = new Random(System.currentTimeMillis()); + // insert multi elements with various type + for (int i = 0; i < 1000; i++) { + int type = Math.abs(random.nextInt()) % 9; + switch (type) { + case 0: // varint 32 + { + final int value = random.nextInt(); + output.writeRawLittleEndian32(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawLittleEndian32(), value); + } + }); + break; + } + case 1: // varint 64 + { + final long value = random.nextLong(); + output.writeRawLittleEndian64(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawLittleEndian64(), value); + } + }); + break; + } + case 2: // int32 + { + final int value = random.nextInt(); + output.writeRawLittleEndian32(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawLittleEndian32(), value); + } + }); + break; + } + case 3: // int64 + { + final long value = random.nextLong(); + output.writeRawLittleEndian64(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawLittleEndian64(), value); + } + }); + break; + } + case 4: // double + { + final long value = random.nextLong(); + output.writeRawLittleEndian64(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawLittleEndian64(), value); + } + }); + break; + } + case 5: // boolean + { + final boolean value = i % 2 == 0; + output.writeBoolean(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readBoolean(), value); + } + }); + break; + } + case 6: // byte + { + final byte value = (byte)random.nextInt(); + output.writeRawByte(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawByte(), value); + } + }); + break; + } + case 7: // String + { + final String str = "Hello World"; + final byte[] value = Bytes.toBytes(str); + output.writeRawLittleEndian32(value.length); + output.writeBytes(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawLittleEndian32(), value.length); + assertEquals(input.readUTFString(value.length), str); + } + }); + break; + } + case 8: // bytes + { + final byte[] value = new byte[random.nextInt(100)]; + random.nextBytes(value); + output.writeRawLittleEndian32(value.length); + output.writeBytes(value); + checkings.add(new CheckValue() { + @Override + public void check(PlainBufferInputStream input) throws Exception { + assertEquals(input.readRawLittleEndian32(), value.length); + assertArrayEquals(input.readBytes(value.length), value); + } + }); + break; + } + } + } + + byte[] buffer = Arrays.copyOf(output.getBuffer(), output.count()); + PlainBufferInputStream input = new PlainBufferInputStream(buffer); + for (CheckValue c : checkings) { + c.check(input); + } + + assertTrue(input.isAtEnd()); + } + + + @Test + public void testReadTag() throws Exception { + byte[] data = new byte[] {PlainBufferConsts.TAG_CELL, PlainBufferConsts.TAG_CELL_NAME, PlainBufferConsts.TAG_CELL_TYPE, + PlainBufferConsts.TAG_CELL_TIMESTAMP, PlainBufferConsts.TAG_CELL_VALUE, PlainBufferConsts.TAG_ROW_DATA, + PlainBufferConsts.TAG_ROW_PK}; + + PlainBufferInputStream input = new PlainBufferInputStream(data); + for (byte tag : data) { + assertEquals(tag, input.readTag()); + assertTrue(input.checkLastTagWas(tag)); + } + + assertTrue(input.isAtEnd()); + assertEquals(0, input.readTag()); + } + + @Test + public void testReadOverflow() { + int capacity = 100; + byte[] data = new byte[capacity]; + PlainBufferInputStream input = new PlainBufferInputStream(data); + + try { + input.readBytes(capacity + 1); + fail(); + } catch (IOException e) { + } + + input = new PlainBufferInputStream(new byte[0]); + try { + input.readRawLittleEndian32(); + fail(); + } catch (IOException e) { + + } + try { + input.readRawByte(); + fail(); + } catch (IOException e) { + + } + try { + input.readBoolean(); + fail(); + } catch (IOException e) { + + } + try { + input.readDouble(); + fail(); + } catch (IOException e) { + + } + try { + input.readInt64(); + fail(); + } catch (IOException e) { + + } + try { + input.readRawLittleEndian64(); + fail(); + } catch (IOException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferOutputStream.java b/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferOutputStream.java new file mode 100644 index 0000000..82225bf --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/protocol/TestPlainBufferOutputStream.java @@ -0,0 +1,100 @@ +package com.alicloud.openservices.tablestore.core.protocol; + +import org.junit.Test; + +import java.io.IOException; +import java.util.Random; + +import static org.junit.Assert.*; + +public class TestPlainBufferOutputStream { + + @Test + public void testRemainCalculation() throws Exception { + Random random = new Random(System.currentTimeMillis()); + + int capacity = 10000; + PlainBufferOutputStream output = new PlainBufferOutputStream(capacity); + + // write double + capacity -= 8; + output.writeDouble(0.11); + assertEquals(capacity, output.remain()); + assertTrue(!output.isFull()); + + // write bytes + for (int i = 0; i < 10; i++) { + int l = random.nextInt(100); + capacity -= l; + byte[] bs = new byte[l]; + output.writeBytes(bs); + assertEquals(capacity, output.remain()); + assertTrue(!output.isFull()); + } + + // write boolean + for (int i = 0; i < 100; i++) { + output.writeBoolean(i % 2 == 0); + capacity -= 1; + assertEquals(capacity, output.remain()); + assertTrue(!output.isFull()); + } + + // write raw byte + for (int i = 0; i < 100; i++) { + output.writeRawByte((byte) i); + capacity -= 1; + assertEquals(capacity, output.remain()); + assertTrue(!output.isFull()); + } + + // write fixed int32 + for (int i = 0; i < 100; i++) { + output.writeRawLittleEndian32(i * 19); + capacity -= 4; + assertEquals(capacity, output.remain()); + assertTrue(!output.isFull()); + } + + // write fixed int64 + for (int i = 0; i < 100; i++) { + output.writeRawLittleEndian64(i * 19); + capacity -= 8; + assertEquals(capacity, output.remain()); + assertTrue(!output.isFull()); + } + + // fill full + byte[] bs = new byte[capacity]; + output.writeBytes(bs); + assertEquals(0, output.remain()); + assertTrue(output.isFull()); + } + + @Test + public void testBufferOverflow() throws Exception { + int capacity = 100; + PlainBufferOutputStream output = new PlainBufferOutputStream(capacity); + + // write (fixed 4 bytes int) * 10 + (fixed 8 bytes int) * 5 + 10 bytes + for (int i = 0; i < 10; i++) { + output.writeRawLittleEndian32(i); + } + for (int i = 0; i < 5; i++) { + output.writeRawLittleEndian64(i); + } + output.writeBytes(new byte[10]); + + // remain 10 bytes + assertEquals(10, output.remain()); + assertTrue(!output.isFull()); + + // fill overflow + try { + output.writeBytes(new byte[11]); + fail(); + } catch (IOException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/core/utils/ParamCheckerTest.java b/src/test/java/com/alicloud/openservices/tablestore/core/utils/ParamCheckerTest.java new file mode 100644 index 0000000..17d1890 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/core/utils/ParamCheckerTest.java @@ -0,0 +1,266 @@ +package com.alicloud.openservices.tablestore.core.utils; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.writer.WriterConfig; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class ParamCheckerTest { + private String tableName = "testTable"; + + WriterConfig getWriterConfig() { + WriterConfig config = new WriterConfig(); + config.setMaxAttrColumnSize(1024); + config.setMaxBatchSize(4 * 1024); + config.setMaxColumnsCount(10); + config.setMaxPKColumnSize(1024); + + return config; + } + + TableMeta getTableMeta() { + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.BINARY); + + return tableMeta; + } + + String getString(int size) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < size; i++) { + sb.append('a'); + } + return sb.toString(); + } + + @Test + public void testTableNameInvalid() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abc")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + RowPutChange rowChange = new RowPutChange("testTable1", primaryKey); + rowChange.addColumn("col", ColumnValue.fromLong(1)); + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The row to write belongs to another table."); + } + } + + @Test + public void testRowSizeExceed() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abc")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + + rowChange.addColumn("col0", ColumnValue.fromString(getString(1024))); + rowChange.addColumn("col1", ColumnValue.fromString(getString(1024))); + rowChange.addColumn("col2", ColumnValue.fromString(getString(1024))); + rowChange.addColumn("col3", ColumnValue.fromString(getString(1024))); + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The row size exceeds the max batch size: 4096."); + } + } + + @Test + public void testInvalidPrimaryKeySchema() { + { + // test auto increment + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.BINARY); + tableMeta.addPrimaryKeyColumn("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abc")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .addPrimaryKeyColumn("pk3", PrimaryKeyValue.AUTO_INCREMENT) + .build(); + + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + + rowChange.addColumn("col0", ColumnValue.fromString(getString(100))); + + ParamChecker.checkRowChange(tableMeta, rowChange, getWriterConfig()); + } + { + // test auto increment + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.BINARY); + tableMeta.addPrimaryKeyColumn("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abc")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .addPrimaryKeyColumn("pk3", PrimaryKeyValue.fromLong(100)) + .build(); + + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + + rowChange.addColumn("col0", ColumnValue.fromString(getString(100))); + + ParamChecker.checkRowChange(tableMeta, rowChange, getWriterConfig()); + } + { + // test auto increment + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.BINARY); + tableMeta.addPrimaryKeyColumn("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abc")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .addPrimaryKeyColumn("pk3", PrimaryKeyValue.fromString("")) + .build(); + + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + + rowChange.addColumn("col0", ColumnValue.fromString(getString(100))); + + try { + ParamChecker.checkRowChange(tableMeta, rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The type of primary key column 'pk3' is STRING, but it's defined as INTEGER in table meta."); + } + } + + { + // pk count not equal + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abc")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .addPrimaryKeyColumn("pk3", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + + rowChange.addColumn("col0", ColumnValue.fromString(getString(100))); + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The primary key schema is not match which defined in table meta."); + } + } + + { + // invalid primary key column schema + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abc")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromString("cde")) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + + rowChange.addColumn("col0", ColumnValue.fromString(getString(100))); + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The type of primary key column 'pk2' is STRING, but it's defined as BINARY in table meta."); + } + } + } + + @Test + public void testPrimaryKeyColumnSizeExceed() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(getString(1025))) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + + rowChange.addColumn("col0", ColumnValue.fromString(getString(100))); + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The size of primary key column 'pk1' has exceeded the max length:1024."); + } + } + + @Test + public void testColumnCountExceed() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(getString(5))) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + for (int i = 0; i < getWriterConfig().getMaxColumnsCount() + 1; i++) { + rowChange.addColumn("col" + i, ColumnValue.fromLong(i)); + } + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The count of attribute columns exceeds the maximum: 10."); + } + } + + @Test + public void testColumnNameEqualWithPrimaryKeyColumn() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(getString(5))) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + rowChange.addColumn("pk0", ColumnValue.fromLong(0)); + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The attribute column's name duplicate with primary key column, which is 'pk0'."); + } + } + + @Test + public void testColumnSizeExceed() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(getString(5))) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, primaryKey); + rowChange.addColumn("col0", ColumnValue.fromString(getString(getWriterConfig().getMaxAttrColumnSize() + 1))); + + try { + ParamChecker.checkRowChange(getTableMeta(), rowChange, getWriterConfig()); + fail("Expect exception happened."); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The size of attribute column 'col0' has exceeded the max length: 1024."); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/APITest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/APITest.java new file mode 100644 index 0000000..192ba3d --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/APITest.java @@ -0,0 +1,459 @@ +package com.alicloud.openservices.tablestore.functiontest; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.google.gson.JsonSyntaxException; + +public class APITest { + + private static String tableName = "APIFunctiontest"; + private static SyncClientInterface ots; + private static final Logger LOG = LoggerFactory.getLogger(APITest.class); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + ots.shutdown(); + } + + @Before + public void setup() throws Exception { + // 清理环境 + OTSHelper.deleteAllTable(ots); + } + + @After + public void teardown() { + + } + + /** + * 建表MaxVersion=3, UpdateRow重复100次,每次写入128个不同的列,每列包含1个版本。 + * GetRow每次指定不同的列名,每次读取128个列,数据校验通过。这个CASE要针对 + * BINARY/INTEGER/STRING/BOOLEAN/DOUBLE类型的列值都做一遍。 + * @throws UnsupportedEncodingException + */ + @Test + public void testCase1() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + // 建表MaxVersion=3 + OTSHelper.createTable(ots, tableName, scheme, Integer.MAX_VALUE, 3); + + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("a")) + .build(); + + List puts = new ArrayList(); + + long ts = (new Date()).getTime(); + + LOG.info("Begin time stamp : " + ts); + + int columnIndex = 0; + for (int p = 0; p < 100; p++) { // 100次 + puts.clear(); + // 每次写入128个不同的列 + for (int i = 0; i < 128; i++) { + String columnName = String.format("attr_%06d", columnIndex++); + if (i == 0 ) { // integer + for (int k = 0; k < 1; k++) { + Column c = new Column(columnName, ColumnValue.fromLong(i), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else if (i == 1) { // double + for (int k = 0; k < 1; k++) { + Column c = new Column(columnName, ColumnValue.fromDouble(i), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else if (i == 2) { // boolean + for (int k = 0; k < 1; k++) { + Column c = new Column(columnName, ColumnValue.fromBoolean(true), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else if (i == 3) { // binary + for (int k = 0; k < 1; k++) { + Column c = new Column(columnName, ColumnValue.fromBinary("a".getBytes("UTF-8")), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else { // string + for (int k = 0; k < 1; k++) { + Column c = new Column(columnName, ColumnValue.fromString("" + i), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } + } + // + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + } + columnIndex = 0; + for (int p = 0; p < 100; p++) { + List columnToGet = new ArrayList(); + for (int i = 0; i < 128; i++) { + String columnName = String.format("attr_%06d", (columnIndex + i)); + columnToGet.add(columnName); + } + + Row row = OTSHelper.getRow(ots, tableName, pk, null, Integer.MAX_VALUE, columnToGet).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(128, cols.length); + for (int i = 0; i < 128; i++) { + String columnName = String.format("attr_%06d", (columnIndex++)); + Column col = cols[i]; + assertEquals(columnName, col.getName()); + if (i == 0 ) { // integer + assertEquals(i, col.getValue().asLong()); + } else if (i == 1) { // double + assertTrue(i == col.getValue().asDouble()); + } else if (i == 2) { // boolean + assertEquals(true, col.getValue().asBoolean()); + } else if (i == 3) { // binary + assertEquals("a", new String(col.getValue().asBinary(), "UTF-8")); + } else { // string + assertEquals("" + i, col.getValue().asString()); + } + } + } + } + + /** + * 建表MaxVersion=100000, UpdateRow重复100次,每次写入1列,每列包含128个新的版本。 + * GetRow每次指定不同的版本,每次读取128个版本,数据校验通过。这个CASE要针对 + * BINARY/INTEGER/STRING/BOOLEAN/DOUBLE类型的列值都做一遍 + * @throws UnsupportedEncodingException + */ + @Test + public void testCase2() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + // 建表MaxVersion=100000 + OTSHelper.createTable(ots, tableName, scheme, Integer.MAX_VALUE, 100000); + + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("a")) + .build(); + + List puts = new ArrayList(); + + long ts = (new Date()).getTime(); + + LOG.info("Begin time stamp : " + ts); + + int columnIndex = 0; + for (int p = 0; p < 100; p++) { // 100次 + puts.clear(); + // 每次写入1个不同的列 + for (int i = 0; i < 1; i++) { + String columnName = String.format("attr_%06d", columnIndex++); + if (columnIndex%5 == 0 ) { // integer + for (int k = 0; k < 128; k++) { + Column c = new Column(columnName, ColumnValue.fromLong(k), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else if (columnIndex%5 == 1) { // double + for (int k = 0; k < 128; k++) { + Column c = new Column(columnName, ColumnValue.fromDouble(k), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else if (columnIndex%5 == 2) { // boolean + for (int k = 0; k < 128; k++) { + Column c = new Column(columnName, ColumnValue.fromBoolean(true), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else if (columnIndex%5 == 3) { // binary + for (int k = 0; k < 128; k++) { + Column c = new Column(columnName, ColumnValue.fromBinary("a".getBytes("UTF-8")), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } else { // string + for (int k = 0; k < 128; k++) { + Column c = new Column(columnName, ColumnValue.fromString("" + k), ts + k); + LOG.info(c.toString()); + puts.add(c); + } + } + } + // + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + } + columnIndex = 0; + for (int p = 0; p < 100; p++) { + List columnToGet = new ArrayList(); + String columnName = String.format("attr_%06d", columnIndex++); + columnToGet.add(columnName); + + Row row = OTSHelper.getRow(ots, tableName, pk, null, Integer.MAX_VALUE, columnToGet).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(128, cols.length); + for (int i = 0; i < 128; i++) { + Column col = cols[i]; + assertEquals(columnName, col.getName()); + if (columnIndex%5 == 0 ) { // integer + assertEquals(127 - i, col.getValue().asLong()); + } else if (columnIndex%5 == 1) { // double + assertTrue((127 - i) == col.getValue().asDouble()); + } else if (columnIndex%5 == 2) { // boolean + assertEquals(true, col.getValue().asBoolean()); + } else if (columnIndex%5 == 3) { // binary + assertEquals("a", new String(col.getValue().asBinary(), "UTF-8")); + } else { // string + assertEquals("" + (127 - i), col.getValue().asString()); + } + } + } + } + + private String getString(char c, int size) { + StringBuilder sb = new StringBuilder(); + for (int i = 0 ; i < size; i++) { + sb.append(c); + } + return sb.toString(); + } + + /** + * MaxVersion=100, PutRow包含16个列,列名长度为255,每列包含8个cell,timestamp相同, + * GetRow读出校验,期望每个cell返回最后一次数据。然后再UpdateRow,包含同样的行和列和timestamp, + * 再次GetRow读出校验。 + */ + @Test + public void testCase5() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.INTEGER)); + OTSHelper.createTable(ots, tableName, scheme, Integer.MAX_VALUE, 100); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(0)) + .build(); + + long ts = (new Date()).getTime(); + + List columns = new ArrayList(); + for (int i = 0; i < 16; i++) { + for (int j = 0; j < 8; j++) { + columns.add(new Column(String.format("%s%02d", getString('p', 253), i), ColumnValue.fromLong(j), ts)); + } + } + + OTSHelper.putRow(ots, tableName, pk, columns); + + { + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + Column[] cols = row.getColumns(); + assertEquals(16, cols.length); + + for (int i = 0; i < 16; i++) { + assertEquals(String.format("%s%02d", getString('p', 253), i), cols[i].getName()); + assertEquals(7, cols[i].getValue().asLong()); + assertEquals(ts, cols[i].getTimestamp()); + } + } + + // 然后再UpdateRow,包含同样的行和列和timestamp,再次GetRow读出校验。 + OTSHelper.updateRow(ots, tableName, pk, columns, null, null); + { + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + Column[] cols = row.getColumns(); + assertEquals(16, cols.length); + + for (int i = 0; i < 16; i++) { + assertEquals(String.format("%s%02d", getString('p', 253), i), cols[i].getName()); + assertEquals(7, cols[i].getValue().asLong()); + assertEquals(ts, cols[i].getTimestamp()); + } + } + } + + /** + * MaxVersion=100,BatchWriteRow包含10行,每行包含16个列,列名长度为255,每列包含8个 + * cell,timestamp相同,先put后update再delete,每次都BatchGetRow读取校验。 + */ + + @Test + public void testCase6() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.INTEGER)); + OTSHelper.createTable(ots, tableName, scheme, Integer.MAX_VALUE, 100); + Utils.waitForPartitionLoad(tableName); + + List puts = new ArrayList(); + List updates = new ArrayList(); + List deletes = new ArrayList(); + + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + + long ts = (new Date()).getTime(); + + // BatchWriteRow包含10行,每行包含16个列,列名长度为255,每列包含8个cell,timestamp相同 + { + for (int k = 0; k < 10; k++) { + List columns = new ArrayList(); + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(k)) + .build(); + + multiRowQueryCriteria.addRow(pk); + + RowPutChange put = new RowPutChange(tableName, pk); + + for (int i = 0; i < 16; i++) { + for (int j = 0; j < 8; j++) { + columns.add(new Column(String.format("%s%02d", getString('p', 253), i), ColumnValue.fromLong(j), ts)); + } + } + + put.addColumns(columns); + + // + puts.add(put); + } + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + } + + multiRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + List multiRowQueryCriterias = new ArrayList(); + multiRowQueryCriterias.add(multiRowQueryCriteria); + BatchGetRowResponse batchGetRowResult = OTSHelper.batchGetRow(ots, multiRowQueryCriterias); + assertEquals(10, batchGetRowResult.getSucceedRows().size()); + assertEquals(0, batchGetRowResult.getFailedRows().size()); + for (int i = 0; i < 10; i++) { + BatchGetRowResponse.RowResult rowResult = batchGetRowResult.getSucceedRows().get(i); + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(rowResult.getIndex())) + .build(); + assertEquals(pk, rowResult.getRow().getPrimaryKey()); + Column[] cols = rowResult.getRow().getColumns(); + assertEquals(16, cols.length); + for (int j = 0; j < 16; j++) { + assertEquals(String.format("%s%02d", getString('p', 253), j), cols[j].getName()); + assertEquals(7, cols[j].getValue().asLong()); + assertEquals(ts, cols[j].getTimestamp()); + } + } + + { + for (int k = 0; k < 10; k++) { + List columns = new ArrayList(); + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(k)) + .build(); + + RowUpdateChange update = new RowUpdateChange(tableName, pk); + + for (int i = 0; i < 16; i++) { + for (int j = 0; j < 8; j++) { + columns.add(new Column(String.format("%s%02d", getString('p', 253), i), ColumnValue.fromLong(-1), ts)); + } + } + + update.put(columns); + + // + updates.add(update); + } + OTSHelper.batchWriteRowNoLimit(ots, null, updates, null); + } + + batchGetRowResult = OTSHelper.batchGetRow(ots, multiRowQueryCriterias); + assertEquals(10, batchGetRowResult.getSucceedRows().size()); + assertEquals(0, batchGetRowResult.getFailedRows().size()); + for (int i = 0; i < 10; i++) { + BatchGetRowResponse.RowResult rowResult = batchGetRowResult.getSucceedRows().get(i); + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(rowResult.getIndex())) + .build(); + assertEquals(pk, rowResult.getRow().getPrimaryKey()); + Column[] cols = rowResult.getRow().getColumns(); + assertEquals(16, cols.length); + for (int j = 0; j < 16; j++) { + assertEquals(String.format("%s%02d", getString('p', 253), j), cols[j].getName()); + assertEquals(-1, cols[j].getValue().asLong()); + assertEquals(ts, cols[j].getTimestamp()); + } + } + + { + for (int k = 0; k < 10; k++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(k)) + .build(); + + RowDeleteChange delete = new RowDeleteChange(tableName, pk); + // + deletes.add(delete); + } + OTSHelper.batchWriteRowNoLimit(ots, null, null, deletes); + } + + batchGetRowResult = OTSHelper.batchGetRow(ots, multiRowQueryCriterias); + assertEquals(10, batchGetRowResult.getSucceedRows().size()); + assertEquals(0, batchGetRowResult.getFailedRows().size()); + for (int i = 0; i < 10; i++) { + BatchGetRowResponse.RowResult rowResult = batchGetRowResult.getSucceedRows().get(i); + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(rowResult.getIndex())) + .build(); + assertEquals(null, rowResult.getRow()); + } + + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN) + .build(); + + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + List rows = OTSHelper.getRange(ots, rangeRowQueryCriteria).getRows(); + assertEquals(0, rows.size()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/DataOperationTest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/DataOperationTest.java new file mode 100644 index 0000000..5d1cbc3 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/DataOperationTest.java @@ -0,0 +1,471 @@ +package com.alicloud.openservices.tablestore.functiontest; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse.RowResult; +import com.alicloud.openservices.tablestore.core.utils.Bytes; +import com.alicloud.openservices.tablestore.core.utils.Pair; +import com.alicloud.openservices.tablestore.common.BaseFT; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.google.gson.JsonSyntaxException; + +public class DataOperationTest extends BaseFT{ + + private static String tableName = "TableOptionsFunctiontest"; + + private static SyncClientInterface ots; + + private static final Logger LOG = LoggerFactory.getLogger(DataOperationTest.class); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + ots.shutdown(); + } + + @Before + public void setup() throws Exception { + // 清理环境 + OTSHelper.deleteAllTable(ots); + } + + @After + public void teardown() { + + } + + /** + * 建一个表,PK为'PK1',类型为STRING/BINARY/INTEGER,测试所有行操作API,PK为'PK2'类型 + * 与建表时的'PK1'相同,期望返回OTSParameterInvalid + * @throws Exception + */ + @Test + public void testCase1() throws Exception { + List> input = new ArrayList>(); + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + input.add(pk); + } + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER)); + input.add(pk); + } + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.BINARY)); + input.add(pk); + } + int index = 0; + for (List scheme : input) { + LOG.info("Index : {}", index++); + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK2", Utils.getPKColumnValue(scheme.get(0).getType(), "1000"))); + + List columns = new ArrayList(); + columns.add(new Column("name", ColumnValue.fromString("value"))); + + try { + OTSHelper.putRow(ots, tableName, new PrimaryKey(pk), columns); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + try { + OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(pk)); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + try { + OTSHelper.updateRow(ots, tableName, new PrimaryKey(pk), columns, new ArrayList(), new ArrayList>()); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + try { + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(pk)); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + { + List criterias = new ArrayList(); + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(pk)); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + } + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List rrs = result.getFailedRows(); + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals("Validate PK name fail. Input: PK2, Meta: PK1.", rrs.get(0).getError().getMessage()); + } + + { + List puts = new ArrayList(); + { + RowPutChange change = new RowPutChange(tableName, new PrimaryKey(pk)); + change.addColumn("attr_0", ColumnValue.fromString("bigbang")); + puts.add(change); + } + List updates = new ArrayList(); + List deletes = new ArrayList(); + BatchWriteRowResponse result = OTSHelper.batchWriteRow(ots, puts, updates, deletes); + List rrs = result.getFailedRows(); + + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals("Validate PK name fail. Input: PK2, Meta: PK1.", rrs.get(0).getError().getMessage()); + } + OTSHelper.deleteTable(ots, tableName); + } + } + + /** + * 建一个表,PK为'PK1',类型为STRING/BINARY/INTEGER,测试所有行操作API,PK为'PK1' 类型与建表时的'PK1'不同,期望返回OTSParameterInvalid + * @throws Exception + */ + @Test + public void testCase2() throws Exception { + List> input = new ArrayList>(); + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + input.add(pk); + } + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER)); + input.add(pk); + } + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.BINARY)); + input.add(pk); + } + int index = 0; + for (List scheme : input) { + LOG.info("Index : {}", index++); + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + String errorMsg; + List pk = new ArrayList(); + PrimaryKeyType type = scheme.get(0).getType(); + if (type == PrimaryKeyType.STRING) { + pk.add(new PrimaryKeyColumn("PK1", Utils.getPKColumnValue(PrimaryKeyType.INTEGER, "1000"))); + errorMsg = "Validate PK type fail. Input: VT_INTEGER, Meta: VT_STRING."; + } else if (type == PrimaryKeyType.INTEGER) { + pk.add(new PrimaryKeyColumn("PK1", Utils.getPKColumnValue(PrimaryKeyType.STRING, "1000"))); + errorMsg = "Validate PK type fail. Input: VT_STRING, Meta: VT_INTEGER."; + } else { + pk.add(new PrimaryKeyColumn("PK1", Utils.getPKColumnValue(PrimaryKeyType.INTEGER, "1000"))); + errorMsg = "Validate PK type fail. Input: VT_INTEGER, Meta: VT_BLOB."; + } + + List columns = new ArrayList(); + columns.add(new Column("name", ColumnValue.fromString("value"))); + + try { + OTSHelper.putRow(ots, tableName, new PrimaryKey(pk), columns); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + try { + OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(pk)); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + try { + OTSHelper.updateRow(ots, tableName, new PrimaryKey(pk), columns, new ArrayList(), new ArrayList>()); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + try { + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(pk)); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + { + List criterias = new ArrayList(); + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(pk)); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + } + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List rrs = result.getFailedRows(); + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals(errorMsg, rrs.get(0).getError().getMessage()); + } + + { + List puts = new ArrayList(); + { + RowPutChange change = new RowPutChange(tableName, new PrimaryKey(pk)); + change.addColumn("attr_0", ColumnValue.fromString("bigbang")); + puts.add(change); + } + List updates = new ArrayList(); + List deletes = new ArrayList(); + BatchWriteRowResponse result = OTSHelper.batchWriteRow(ots, puts, updates, deletes); + List rrs = result.getFailedRows(); + + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals(errorMsg, rrs.get(0).getError().getMessage()); + } + + OTSHelper.deleteTable(ots, tableName); + } + } + + /** + * 建一个表,PK为[('PK1', 'STRING'), ('PK2', 'INTEGER'), ('PK3', 'BINARY')], + * 测试所有行操作API, + * PK为{'PK1' : 'blah'} + * PK为{'PK1' : 'blah', 'PK2' : 123, 'PK4' : 'blah'} + * PK为{'PK1' : 'blah', 'PK2' : 123, 'PK3' : bytearray(3), 'pk4' : 'blah'}, + * 期望返回OTSParameterInvalid + * @throws Exception + */ + @Test + public void testCase3() throws Exception { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + scheme.add(new PrimaryKeySchema("PK2", PrimaryKeyType.INTEGER)); + scheme.add(new PrimaryKeySchema("PK3", PrimaryKeyType.BINARY)); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + List pks = new ArrayList(); + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("blah")) + .build(); + pks.add(pk); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("blah")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(123)) + .build(); + pks.add(pk); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("blah")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(123)) + .addPrimaryKeyColumn("PK3", PrimaryKeyValue.fromBinary(Bytes.toBytes(3))) + .addPrimaryKeyColumn("PK4", PrimaryKeyValue.fromString("blah")) + .build(); + pks.add(pk); + } + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + + for (PrimaryKey pk : pks) { + LOG.info("PK : {}", pk.toString()); + String errorMsg = "Validate PK size fail. Input: " + pk.size() + ", Meta: 3."; + + try { + OTSHelper.putRow(ots, tableName, pk, columns); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + try { + OTSHelper.getRowForAll(ots, tableName, pk); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + try { + OTSHelper.updateRow(ots, tableName, pk, columns, new ArrayList(), new ArrayList>()); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + try { + OTSHelper.deleteRow(ots, tableName, pk); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, errorMsg, 400, e); + } + + { + List criterias = new ArrayList(); + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + List primaryKeys = new ArrayList(); + primaryKeys.add(pk); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + } + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List rrs = result.getFailedRows(); + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals(errorMsg, rrs.get(0).getError().getMessage()); + } + + { + List criterias = new ArrayList(); + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + List primaryKeys = new ArrayList(); + primaryKeys.add(pk); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + } + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List rrs = result.getFailedRows(); + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals(errorMsg, rrs.get(0).getError().getMessage()); + } + } + } + + /** + * 建一个表,PK为[('PK1', 'STRING'), ('PK2', 'INTEGER')], + * 测试所有行操作API, + * PK为{'PK2' : 123, 'PK1', 'blah'}, + * 期望返回OTSParameterInvalid + */ + @Test + public void testCase4() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + scheme.add(new PrimaryKeySchema("PK2", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(123)) + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("blah")) + .build(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + + try { + OTSHelper.putRow(ots, tableName, pk, columns); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + try { + OTSHelper.getRowForAll(ots, tableName, pk); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + try { + OTSHelper.updateRow(ots, tableName, pk, columns, new ArrayList(), new ArrayList>()); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + try { + OTSHelper.deleteRow(ots, tableName, pk); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + + { + List criterias = new ArrayList(); + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + List primaryKeys = new ArrayList(); + primaryKeys.add(pk); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + } + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List rrs = result.getFailedRows(); + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals("Validate PK name fail. Input: PK2, Meta: PK1.", rrs.get(0).getError().getMessage()); + } + + { + List puts = new ArrayList(); + { + RowPutChange change = new RowPutChange(tableName, pk); + change.addColumn("attr_0", ColumnValue.fromString("bigbang")); + puts.add(change); + } + List updates = new ArrayList(); + List deletes = new ArrayList(); + BatchWriteRowResponse result = OTSHelper.batchWriteRow(ots, puts, updates, deletes); + List rrs = result.getFailedRows(); + + assertEquals(1, rrs.size()); + assertEquals(ErrorCode.INVALID_PK, rrs.get(0).getError().getCode()); + assertEquals("Validate PK name fail. Input: PK2, Meta: PK1.", rrs.get(0).getError().getMessage()); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/IncrementRequest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/IncrementRequest.java new file mode 100644 index 0000000..a544cea --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/IncrementRequest.java @@ -0,0 +1,1147 @@ +package com.alicloud.openservices.tablestore.functiontest; + +import com.alicloud.openservices.tablestore.AsyncClient; +import com.alicloud.openservices.tablestore.AsyncClientInterface; +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; +import com.alicloud.openservices.tablestore.model.condition.SingleColumnValueCondition; +import com.alicloud.openservices.tablestore.common.ServiceSettings; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Future; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class IncrementRequest { + private static final String tableName = "IncrementRequestTest002"; + private static final String tableNameWithAutoPK = "IncrementRequestTestWithAutoPK"; + private static final String pk = "pk"; + private static final String autoPk1 = "pk1"; + private static final String autoPk2 = "pk2"; + private AsyncClientInterface ots; + private static ServiceSettings serviceSettings = ServiceSettings.load(); + + public void createTable(AsyncClientInterface ots) throws Exception { + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn(pk, PrimaryKeyType.STRING); + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(-1); + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + request.setReservedThroughput(new ReservedThroughput(new CapacityUnit(0, 0))); + request.setTableOptions(tableOptions); + + Future future = ots.createTable(request, null); + future.get(); + } + + public void createTableWithAutoPK(AsyncClientInterface ots) throws Exception { + TableMeta tableMeta = new TableMeta(tableNameWithAutoPK); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(autoPk1, PrimaryKeyType.STRING)); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(autoPk2, PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + + int maxVersions = 1; // 保存的最大版本数, 设置为1即代表每列上最多保存一个版本(保存最新的版本). + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 假如设置过期时间为一年, 即为 365 * 24 * 3600. + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + Future future = ots.createTable(request, null); + future.get(); + } + + @Before + public void setUp() throws Exception { + ClientConfiguration cc = new ClientConfiguration(); + cc.setMaxConnections(1000); + cc.setRetryStrategy(new DefaultRetryStrategy()); + ots = new AsyncClient(serviceSettings.getOTSEndpoint(), + serviceSettings.getOTSAccessKeyId(), serviceSettings.getOTSAccessKeySecret(), + serviceSettings.getOTSInstanceName(), cc); + + try { + DeleteTableRequest request = new DeleteTableRequest(tableName); + Future future = ots.deleteTable(request, null); + future.get(); + } catch (Exception e) { + // pass + } + createTable(ots); + + try { + DeleteTableRequest request = new DeleteTableRequest(tableNameWithAutoPK); + Future future = ots.deleteTable(request, null); + future.get(); + } catch (Exception e) { + // pass + } + createTableWithAutoPK(ots); + + Thread.sleep(3000); + } + + @After + public void after() { + ots.shutdown(); + } + + @Test + public void testDefaultLongValue() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testDefaultLongValue")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + System.out.println("更新结果(add price): start"); + System.out.println(rRow); + System.out.println("更新结果(add price): end"); + // 读取数据 + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10L, row.getColumn("price").get(0).getValue().asLong()); + } + + @Test + public void testReturnColumnNames() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testReturnColumnNames")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + // 一行单个原子加 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + rowUpdateChange.increment(new Column("price-2", ColumnValue.fromLong(100))); + + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + System.out.println("更新结果(add price): start"); + System.out.println(rRow); + System.out.println("更新结果(add price): end"); + assertEquals(1, rRow.getColumn("price").size()); + assertEquals(10L, rRow.getColumn("price").get(0).getValue().asLong()); + assertEquals(0, rRow.getColumn("price-2").size()); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10L, row.getColumn("price").get(0).getValue().asLong()); + assertEquals(0, row.getColumn("price-2").size()); + } + + // 一行2个原子加 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + rowUpdateChange.increment(new Column("price-2", ColumnValue.fromLong(100))); + rowUpdateChange.addReturnColumn("price-2"); + + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + System.out.println("更新结果(add price): start"); + System.out.println(rRow); + System.out.println("更新结果(add price): end"); + assertEquals(1, rRow.getColumn("price").size()); + assertEquals(20L, rRow.getColumn("price").get(0).getValue().asLong()); + assertEquals(1, rRow.getColumn("price-2").size()); + assertEquals(200L, rRow.getColumn("price-2").get(0).getValue().asLong()); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + criteria.addColumnsToGet("price-2"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(20L, row.getColumn("price").get(0).getValue().asLong()); + assertEquals(1, row.getColumn("price-2").size()); + assertEquals(200L, row.getColumn("price-2").get(0).getValue().asLong()); + } + + // returnColumnNames增加非原子加列,报错 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + rowUpdateChange.put(new Column("price-3", ColumnValue.fromLong(100))); + rowUpdateChange.addReturnColumn("price-3"); + + try { + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + } catch (Exception e){ + // 捕获return column设置异常 + System.out.println(e); + } + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + criteria.addColumnsToGet("price-3"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(20L, row.getColumn("price").get(0).getValue().asLong()); + assertEquals(0, row.getColumn("price-3").size()); + } + + // returnColumnNames增加非更新列,报错 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + rowUpdateChange.addReturnColumn("price-4"); + + try { + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + } catch (Exception e){ + // 捕获return column设置异常 + System.out.println(e); + } + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(20L, row.getColumn("price").get(0).getValue().asLong()); + assertEquals(0, row.getColumn("price-4").size()); + System.out.println("GetRow: "); + System.out.println(row); + } + + // returnType为RT_PK,returnColumnNames非空,报错 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.put(new Column("price-5", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_PK); + rowUpdateChange.addReturnColumn("price-5"); + + try { + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + } catch (Exception e){ + // 捕获return column设置异常 + System.out.println(e); + } + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(0, row.getColumn("price-5").size()); + System.out.println("GetRow: "); + System.out.println(row); + } + } + + @Test + public void testNormalUpdateReturnPK() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testNormalUpdateReturnPK001")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.put(new Column("price", ColumnValue.fromLong(20))); + rowUpdateChange.put(new Column("price", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_PK); + + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + System.out.println("更新结果(add price): start"); + System.out.println(rRow); + System.out.println("更新结果(add price): end"); + // 读取数据 + + // 读一行 + { + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + //criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + System.out.println("GetRow: "); + System.out.println(rRow); + } + + { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + + // 设置起始主键 + PrimaryKeyBuilder primaryKeyBuilder1 = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder1.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("a")); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKeyBuilder1.build()); + + // 设置结束主键 + primaryKeyBuilder1 = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder1.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("z")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKeyBuilder1.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + System.out.println("GetRange的结果为:"); + while (true) { + GetRangeResponse getRangeResponse = ots.getRange(new GetRangeRequest(rangeRowQueryCriteria), null).get(); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + } + + @Test + public void testAddSameKey() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testAddSameKey")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + long num = 500; + for (long i = 0; i < num; i++) { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(1))); + rowUpdateChange.setReturnType(ReturnType.RT_PK); + //rowUpdateChange.addReturnColumn("price"); + + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + if (i % 20 == 0) { + System.out.println(rRow); + } + } + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(num, row.getColumn("price").get(0).getValue().asLong()); + } + + @Test + public void testBatchWrite() throws Exception { + long rowNum = 10; + long colNum = 3; + for (long j = 0; j < colNum; j++) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + for (long i = 0; i < rowNum; i++) { + // 原子加 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + i)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(1))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + Future resp = ots.batchWriteRow(batchWriteRowRequest, null); + BatchWriteRowResponse r = resp.get(); + Map> rs = r.getRowStatus(); + System.out.println("================"); + for (Map.Entry> entry : rs.entrySet()) { + for (BatchWriteRowResponse.RowResult rowRes : entry.getValue()) { + Row row = rowRes.getRow(); + System.out.println(row); + } + } + } + + // 读一行 + { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + 1)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(colNum, row.getColumn("price").get(0).getValue().asLong()); + } + } + + @Test + public void testAtomicAddWithCondition() throws Exception { + long rowNum = 2; + long colNum = 2; + for (long j = 0; j < colNum; j++) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + for (long i = 0; i < rowNum; i++) { + // 原子加 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + i)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(1))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + + Condition condition = new Condition(RowExistenceExpectation.EXPECT_NOT_EXIST); + ColumnCondition columnCondition = new SingleColumnValueCondition( + "price", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromLong(0)); + condition.setColumnCondition(columnCondition); + rowUpdateChange.setCondition(condition); + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + Future resp = ots.batchWriteRow(batchWriteRowRequest, null); + BatchWriteRowResponse r = resp.get(); + Map> rs = r.getRowStatus(); + System.out.println("================"); + for (Map.Entry> entry : rs.entrySet()) { + for (BatchWriteRowResponse.RowResult rowRes : entry.getValue()) { + Row row = rowRes.getRow(); + System.out.println("error: " + rowRes.getError() + ", " + row); + } + } + } + + // 读一行 + { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + 1)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(1, row.getColumn("price").get(0).getValue().asLong()); + } + } + + @Test + public void testRowDeleteAndReplace() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testRowDeleteAndReplace")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(10))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + System.out.println("更新结果(add price): start"); + System.out.println(rRow); + System.out.println("更新结果(add price): end"); + // 读取数据 + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10L, row.getColumn("price").get(0).getValue().asLong()); + } + } + + @Test + public void testAutoPkWrite() throws Exception { + { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + // 先写入第一个pk自增行和原子加 + PrimaryKey rPKs; + { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(autoPk1, PrimaryKeyValue.fromString("autoPK")); + primaryKeyBuilder.addPrimaryKeyColumn(autoPk2, PrimaryKeyValue.AUTO_INCREMENT); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableNameWithAutoPK, primaryKey); + //rowUpdateChange.put(new Column("price", ColumnValue.fromLong(1))); + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(1))); + rowUpdateChange.setReturnType(ReturnType.RT_PK); + //rowUpdateChange.addReturnColumn("price"); + + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + + rPKs = rRow.getPrimaryKey(); + System.out.println(rPKs); + } + + // pk自增与原子加 + { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(rPKs.getPrimaryKeyColumn(0)); + primaryKeyBuilder.addPrimaryKeyColumn(rPKs.getPrimaryKeyColumn(1)); + System.out.println(rPKs.getPrimaryKeyColumn(0)); + System.out.println(rPKs.getPrimaryKeyColumn(1)); + + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableNameWithAutoPK, primaryKey); + rowUpdateChange.put(new Column("item", ColumnValue.fromLong(12))); + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(15))); + rowUpdateChange.addReturnColumn("price"); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + + Condition condition = new Condition(RowExistenceExpectation.EXPECT_EXIST); + rowUpdateChange.setCondition(condition); + + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + Future resp = ots.batchWriteRow(batchWriteRowRequest, null); + BatchWriteRowResponse r = resp.get(); + Map> rs = r.getRowStatus(); + System.out.println("Update的结果为"); + for (Map.Entry> entry : rs.entrySet()) { + for (BatchWriteRowResponse.RowResult rowRes : entry.getValue()) { + Row row = rowRes.getRow(); + System.out.println("error: " + rowRes.getError() + ", " + row); + assertEquals(16L, row.getColumn("price").get(0).getValue().asLong()); + } + } + System.out.println(""); + } + + { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableNameWithAutoPK); + + // 设置起始主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(autoPk1, PrimaryKeyValue.fromString("autoPK")); + primaryKeyBuilder.addPrimaryKeyColumn(autoPk2, PrimaryKeyValue.fromLong(0)); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKeyBuilder.build()); + + // 设置结束主键 + primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(autoPk1, PrimaryKeyValue.fromString("autoPK")); + primaryKeyBuilder.addPrimaryKeyColumn(autoPk2, PrimaryKeyValue.fromLong(Long.MAX_VALUE)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + System.out.println("GetRange的结果为:"); + while (true) { + GetRangeResponse getRangeResponse = ots.getRange(new GetRangeRequest(rangeRowQueryCriteria), null).get(); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + } + + @Test + public void testBatchWriteError() throws Exception { + long rowNum = 2; + long colNum = 3; + for (long j = 0; j < colNum; j++) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + for (long i = 0; i < rowNum; i++) { + // 原子加 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + 0)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + //rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(1))); + rowUpdateChange.increment(new Column("price_" + i, ColumnValue.fromLong(1))); + //rowUpdateChange.put(new Column("price", ColumnValue.fromLong(12))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price_" + i); + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + Future resp = ots.batchWriteRow(batchWriteRowRequest, null); + BatchWriteRowResponse r = resp.get(); + Map> rs = r.getRowStatus(); + System.out.println("================"); + for (Map.Entry> entry : rs.entrySet()) { + for (BatchWriteRowResponse.RowResult rowRes : entry.getValue()) { + Row row = rowRes.getRow(); + System.out.println("error: " + rowRes.getError() + ", " + row); + } + } + } + + // 读一行 + { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + 1)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + System.out.println(row); + //assertEquals(1, row.getColumn("price").size()); + //assertEquals(colNum, row.getColumn("price").get(0).getValue().asLong()); + } + } + + @Test + public void testBatchWriteError2() throws Exception { + /* + long rowNum = 2; + long colNum = 3; + for (long j = 0; j < colNum; j++) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + for (long i = 0; i < rowNum; i++) { + // 原子加 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + 0)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + if (i % 2 == 0) { + Condition condition = new Condition(RowExistenceExpectation.EXPECT_NOT_EXIST); + ColumnCondition columnCondition = new SingleColumnValueCondition( + "price", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromLong(0)); + condition.setColumnCondition(columnCondition); + rowUpdateChange.setCondition(condition); + rowUpdateChange.put(new Column("price", ColumnValue.fromLong(j))); + } else { + Condition condition = new Condition(RowExistenceExpectation.IGNORE); + ColumnCondition columnCondition = new SingleColumnValueCondition( + "price", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromLong(j)); + condition.setColumnCondition(columnCondition); + rowUpdateChange.setCondition(condition); + rowUpdateChange.put(new Column("price", ColumnValue.fromLong(j * rowNum))); + } + + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + Future resp = ots.batchWriteRow(batchWriteRowRequest, null); + BatchWriteRowResponse r = resp.get(); + Map> rs = r.getRowStatus(); + System.out.println("================"); + for (Map.Entry> entry : rs.entrySet()) { + for (BatchWriteRowResponse.RowResult rowRes : entry.getValue()) { + Row row = rowRes.getRow(); + System.out.println("error: " + rowRes.getError() + ", " + row); + } + } + } + + // 读一行 + { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("bw_" + 1)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + System.out.println(row); + //assertEquals(1, row.getColumn("price").size()); + //assertEquals(colNum, row.getColumn("price").get(0).getValue().asLong()); + } + */ + } + + @Test + public void testMultiThread() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testMultiThread")); + final PrimaryKey primaryKey = primaryKeyBuilder.build(); + + List threads = new ArrayList(); + long numThreads = 20; + final long num = 25; + for (long t = 1; t <= numThreads; t++) { + final long tid = t; + Thread th = new Thread(new Runnable() { + @Override + public void run() { + for (long i = 0; i < num; i++) { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(tid))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("price"); + + try { + Future resp = ots.updateRow(new UpdateRowRequest(rowUpdateChange), null); + UpdateRowResponse r = resp.get(); + Row rRow = r.getRow(); + //if (i % 20 == 0) { + System.out.println("thread id: " + tid + ", " + rRow); + //} + } catch (Exception e) { + System.out.println("write error"); + } + } + } + }); + threads.add(th); + } + for (Thread th : threads) { + th.start(); + } + for (Thread th : threads) { + th.join(); + } + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(num * (numThreads * (numThreads + 1) / 2), row.getColumn("price").get(0).getValue().asLong()); + } + + @Test + public void testDefaultDoubleValue() throws Exception { + /* + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testDefaultDoubleValue")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.increment(new Column("price", ColumnValue.fromDouble(10.54))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读取数据 + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10.54, row.getColumn("price").get(0).getValue().asDouble(), 0.0000001); + */ + } + + @Test + public void testLongValueIncrement() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testLongValueIncrement")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加10 + rowUpdateChange.put(new Column("price", ColumnValue.fromLong(10))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10L, row.getColumn("price").get(0).getValue().asLong()); + } + // 递增 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(515))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(525L, row.getColumn("price").get(0).getValue().asLong()); + } + } + + @Test + public void testLongValueDecrease() throws Exception { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testLongValueDecrease")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.put(new Column("price", ColumnValue.fromLong(10))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10L, row.getColumn("price").get(0).getValue().asLong()); + } + // 递增 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(-3))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(7L, row.getColumn("price").get(0).getValue().asLong()); + } + } + + @Test + public void testDoubleValueIncrement() throws Exception { + /* + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testDoubleValueIncrement")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.put(new Column("price", ColumnValue.fromDouble(10.9))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10.9, row.getColumn("price").get(0).getValue().asLong(), 0.000001); + } + // 递增 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.increment(new Column("price", ColumnValue.fromDouble(1.8))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(12.7, row.getColumn("price").get(0).getValue().asDouble(), 0.0000001); + } + */ + } + + @Test + public void testDoubleValueDecrease() throws Exception { + /* + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testDoubleValueDecrease")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.put(new Column("price", ColumnValue.fromDouble(10.1))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(10.1, row.getColumn("price").get(0).getValue().asDouble(), 0.000001); + } + // 递增 + { + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, primaryKey); + + // 首次写入,price值加1 + rowUpdateChange.increment(new Column("price", ColumnValue.fromDouble(-3.2))); + + ots.updateRow(new UpdateRowRequest(rowUpdateChange), null).get(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + criteria.addColumnsToGet("price"); + GetRowResponse getRowResponse = ots.getRow(new GetRowRequest(criteria), null).get(); + Row row = getRowResponse.getRow(); + assertEquals(1, row.getColumn("price").size()); + assertEquals(6.9, row.getColumn("price").get(0).getValue().asDouble(), 0.000001); + } + */ + } + + @Test + public void testBatchIncrement() throws Exception { + // 第一次写入,作为默认值 + { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + // 构造rowUpdateChange + { + PrimaryKeyBuilder pk3Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk3Builder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testBatchIncrement-1")); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, pk3Builder.build()); + // 添加一些列 + rowUpdateChange.increment(new Column("long", ColumnValue.fromLong(100))); + rowUpdateChange.setReturnType(ReturnType.RT_AFTER_MODIFY); + rowUpdateChange.addReturnColumn("long"); + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + // 构造rowUpdateChange + { + PrimaryKeyBuilder pk3Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk3Builder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testBatchIncrement-2")); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, pk3Builder.build()); + // 添加一些列 + rowUpdateChange.increment(new Column("long", ColumnValue.fromLong(300))); + rowUpdateChange.setReturnType(ReturnType.RT_PK); + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + BatchWriteRowResponse response = ots.batchWriteRow(batchWriteRowRequest, null).get(); + assertTrue(response.isAllSucceed()); + Map> res = response.getRowStatus(); + for (Map.Entry> entry : res.entrySet()) { + for (BatchWriteRowResponse.RowResult rs : entry.getValue()) { + System.out.println("结果:"); + System.out.println(rs.getRow()); + } + } + } + + // 查询检查结果 + { + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + for (int i = 1; i < 3; i++) { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testBatchIncrement-" + i)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + multiRowQueryCriteria.addRow(primaryKey); + } + + multiRowQueryCriteria.setMaxVersions(1); + multiRowQueryCriteria.addColumnsToGet("long"); + + BatchGetRowRequest batchGetRowRequest = new BatchGetRowRequest(); + batchGetRowRequest.addMultiRowQueryCriteria(multiRowQueryCriteria); + + BatchGetRowResponse batchGetRowResponse = ots.batchGetRow(batchGetRowRequest, null).get(); + + assertTrue(batchGetRowResponse.isAllSucceed()); + + BatchGetRowResponse.RowResult rowResult = batchGetRowResponse.getSucceedRows().get(0); + assertEquals("testBatchIncrement-1", rowResult.getRow().getPrimaryKey().getPrimaryKeyColumn(0).getValue().asString()); + assertEquals(100L, rowResult.getRow().getColumn("long").get(0).getValue().asLong()); + + rowResult = batchGetRowResponse.getSucceedRows().get(1); + assertEquals("testBatchIncrement-2", rowResult.getRow().getPrimaryKey().getPrimaryKeyColumn(0).getValue().asString()); + assertEquals(300L, rowResult.getRow().getColumn("long").get(0).getValue().asLong()); + } + + // 第二次写入,增加值 + { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + // 构造rowUpdateChange + { + PrimaryKeyBuilder pk3Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk3Builder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testBatchIncrement-1")); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, pk3Builder.build()); + // 添加一些列 + rowUpdateChange.increment(new Column("long", ColumnValue.fromLong(10))); + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + // 构造rowUpdateChange + { + PrimaryKeyBuilder pk3Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk3Builder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testBatchIncrement-2")); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, pk3Builder.build()); + // 添加一些列 + rowUpdateChange.increment(new Column("long", ColumnValue.fromLong(-50))); + batchWriteRowRequest.addRowChange(rowUpdateChange); + } + + BatchWriteRowResponse response = ots.batchWriteRow(batchWriteRowRequest, null).get(); + assertTrue(response.isAllSucceed()); + } + + // 查询检查结果 + { + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + for (int i = 1; i < 3; i++) { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(pk, PrimaryKeyValue.fromString("testBatchIncrement-" + i)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + multiRowQueryCriteria.addRow(primaryKey); + } + + multiRowQueryCriteria.setMaxVersions(1); + multiRowQueryCriteria.addColumnsToGet("long"); + + BatchGetRowRequest batchGetRowRequest = new BatchGetRowRequest(); + batchGetRowRequest.addMultiRowQueryCriteria(multiRowQueryCriteria); + + BatchGetRowResponse batchGetRowResponse = ots.batchGetRow(batchGetRowRequest, null).get(); + + assertTrue(batchGetRowResponse.isAllSucceed()); + + BatchGetRowResponse.RowResult rowResult = batchGetRowResponse.getSucceedRows().get(0); + assertEquals("testBatchIncrement-1", rowResult.getRow().getPrimaryKey().getPrimaryKeyColumn(0).getValue().asString()); + assertEquals(110L, rowResult.getRow().getColumn("long").get(0).getValue().asLong()); + + rowResult = batchGetRowResponse.getSucceedRows().get(1); + assertEquals("testBatchIncrement-2", rowResult.getRow().getPrimaryKey().getPrimaryKeyColumn(0).getValue().asString()); + assertEquals(250L, rowResult.getRow().getColumn("long").get(0).getValue().asLong()); + } + } +} + diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/LocalTxnTest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/LocalTxnTest.java new file mode 100644 index 0000000..3adc7ca --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/LocalTxnTest.java @@ -0,0 +1,489 @@ +package com.alicloud.openservices.tablestore.functiontest; + + +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.common.ServiceSettings; +import org.junit.Before; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class LocalTxnTest { + String tableName = "test_local_txn"; + + SyncClient client = null; + + @Before + public void setUp() { + ServiceSettings settings = ServiceSettings.load(); + + client = new SyncClient(settings.getOTSEndpoint(), settings.getOTSAccessKeyId(), + settings.getOTSAccessKeySecret(), settings.getOTSInstanceName()); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema("pk1", PrimaryKeyType.STRING)); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema("pk2", PrimaryKeyType.INTEGER)); + + int timeToLive = -1; + int maxVersions = 1; + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + + client.createTable(request); + } + + @Test + public void TestStartCommitTxn() { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("chengdu")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + StartLocalTransactionRequest request = new StartLocalTransactionRequest(tableName, primaryKey); + + String txnId = client.startLocalTransaction(request).getTransactionID(); + + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + commitTxn(txnId); + } + + @Test + public void TestStartTxnTwice() { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("chengdu")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + StartLocalTransactionRequest request = new StartLocalTransactionRequest(tableName, primaryKey); + + String txnId = client.startLocalTransaction(request).getTransactionID(); + + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + try { + client.startLocalTransaction(request); + } catch (TableStoreException ex) { + assertEquals("OTSRowOperationConflict", ex.getErrorCode()); + assertEquals("Data is being modified by the other request.", ex.getMessage()); + } + + commitTxn(txnId); + + try { + commitTxn(txnId); + } catch (TableStoreException ex) { + assertEquals("OTSSessionNotExist", ex.getErrorCode()); + assertEquals("Session not exist or may be timeout.", ex.getMessage()); + } + } + + @Test + public void TestStartCommitTxnWithTwoPK() { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("chengdu")); + primaryKeyBuilder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(100)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + StartLocalTransactionRequest request = new StartLocalTransactionRequest(tableName, primaryKey); + + try { + client.startLocalTransaction(request); + } catch (TableStoreException ex) { + assertEquals("OTSParameterInvalid", ex.getErrorCode()); + assertEquals("StartLocalTransaction support only one primary key.", ex.getMessage()); + } + } + + @Test + public void TestStartCommitTxnWithoutTableName() { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("chengdu")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + StartLocalTransactionRequest request = new StartLocalTransactionRequest("", primaryKey); + + try { + client.startLocalTransaction(request).getTransactionID(); + } catch (TableStoreException ex) { + assertEquals("OTSParameterInvalid", ex.getErrorCode()); + assertEquals("Invalid table name: ''.", ex.getMessage()); + } + } + + @Test + public void TestCommitFailed() { + try { + CommitTransactionRequest commitRequest = new CommitTransactionRequest(""); + client.commitTransaction(commitRequest); + } catch (TableStoreException ex) { + assertEquals("OTSParameterInvalid", ex.getErrorCode()); + assertEquals("TransactionID is invalid.", ex.getMessage()); + } + } + + @Test + public void TestAbortFailed() { + try { + abortTxn(""); + } catch (TableStoreException ex) { + assertEquals("OTSParameterInvalid", ex.getErrorCode()); + assertEquals("TransactionID is invalid.", ex.getMessage()); + } + } + + @Test + public void TestStartAbortTxn() { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("chengdu")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + StartLocalTransactionRequest request = new StartLocalTransactionRequest(tableName, primaryKey); + + String txnId = client.startLocalTransaction(request).getTransactionID(); + + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + abortTxn(txnId); + + try { + abortTxn(txnId); + } catch (TableStoreException ex) { + assertEquals("OTSSessionNotExist", ex.getErrorCode()); + assertEquals("Session not exist or may be timeout.", ex.getMessage()); + } + } + + private void abortTxn(String txnId) { + AbortTransactionRequest abortRequest = new AbortTransactionRequest(txnId); + client.abortTransaction(abortRequest); + } + + @Test + public void TestStartPutCommitTxnGetRow() { + String txnId = startLocalTxn(); + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + putRow(txnId, "chengdu", 101L, 1099L); + + commitTxn(txnId); + + Row row = getRow("", "chengdu", 101L); + PrimaryKeyColumn[] pks = row.getPrimaryKey().getPrimaryKeyColumns(); + assertEquals(2, pks.length); + assertEquals("pk1", pks[ 0 ].getName()); + assertEquals("chengdu", pks[ 0 ].getValue().asString()); + assertEquals("pk2", pks[ 1 ].getName()); + assertEquals(101L, pks[ 1 ].getValue().asLong()); + + Column[] columns = row.getColumns(); + assertEquals(1, columns.length); + assertEquals("Col", columns[ 0 ].getName()); + assertEquals(1099, columns[ 0 ].getValue().asLong()); + } + + @Test + public void TestStartBatchModifyCommitTxnGetRange() { + String txnId = startLocalTxn(); + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + BatchModify(txnId, "chengdu", 102L, 1099L, 10); + + commitTxn(txnId); + + List rows = getRange("", "chengdu", 102L, 10005L); + for (int i = 0; i < rows.size(); i++) { + Row row = rows.get(i); + PrimaryKeyColumn[] pks = row.getPrimaryKey().getPrimaryKeyColumns(); + assertEquals(2, pks.length); + assertEquals("pk1", pks[ 0 ].getName()); + assertEquals("chengdu", pks[ 0 ].getValue().asString()); + assertEquals("pk2", pks[ 1 ].getName()); + assertEquals(102L + i, pks[ 1 ].getValue().asLong()); + + Column[] columns = row.getColumns(); + assertEquals(1, columns.length); + assertEquals("Col", columns[ 0 ].getName()); + assertEquals(1099 + i, columns[ 0 ].getValue().asLong()); + } + } + + @Test + public void TestStartPutTwiceCommitTxnGetRow() { + String txnId = startLocalTxn(); + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + putRow(txnId, "chengdu", 103L, 1099L); + + putRow(txnId, "chengdu", 104L, 2099L); + + commitTxn(txnId); + + Row row = getRow("", "chengdu", 103L); + PrimaryKeyColumn[] pks = row.getPrimaryKey().getPrimaryKeyColumns(); + assertEquals(2, pks.length); + assertEquals("pk1", pks[ 0 ].getName()); + assertEquals("chengdu", pks[ 0 ].getValue().asString()); + assertEquals("pk2", pks[ 1 ].getName()); + assertEquals(103L, pks[ 1 ].getValue().asLong()); + + Column[] columns = row.getColumns(); + assertEquals(1, columns.length); + assertEquals("Col", columns[ 0 ].getName()); + assertEquals(1099, columns[ 0 ].getValue().asLong()); + + row = getRow("", "chengdu", 104L); + pks = row.getPrimaryKey().getPrimaryKeyColumns(); + assertEquals(2, pks.length); + assertEquals("pk1", pks[ 0 ].getName()); + assertEquals("chengdu", pks[ 0 ].getValue().asString()); + assertEquals("pk2", pks[ 1 ].getName()); + assertEquals(104L, pks[ 1 ].getValue().asLong()); + + columns = row.getColumns(); + assertEquals(1, columns.length); + assertEquals("Col", columns[ 0 ].getName()); + assertEquals(2099, columns[ 0 ].getValue().asLong()); + } + + @Test + public void TestStartPutTwiceAbortTxnGetRow() { + String txnId = startLocalTxn(); + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + putRow(txnId, "chengdu", 105L, 1099L); + + putRow(txnId, "chengdu", 106L, 2099L); + + abortTxn(txnId); + + Row row = getRow("", "chengdu", 105L); + assertTrue(!row.isEmpty()); + + row = getRow("", "chengdu", 106L); + assertTrue(!row.isEmpty()); + } + + @Test + public void TestGetStartPutCommitTxn() { + putRow("", "chengdu", 107L, 100L); + + String txnId = startLocalTxn(); + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + Row row = getRow(txnId, "chengdu", 107L); + PrimaryKeyColumn[] pks = row.getPrimaryKey().getPrimaryKeyColumns(); + assertEquals(2, pks.length); + assertEquals("pk1", pks[ 0 ].getName()); + assertEquals("chengdu", pks[ 0 ].getValue().asString()); + assertEquals("pk2", pks[ 1 ].getName()); + assertEquals(107L, pks[ 1 ].getValue().asLong()); + + Column[] columns = row.getColumns(); + assertEquals(1, columns.length); + assertEquals("Col", columns[ 0 ].getName()); + assertEquals(100L, columns[ 0 ].getValue().asLong()); + + putRow(txnId, "chengdu", 108L, 1099L); + + commitTxn(txnId); + } + + @Test + public void TestStartPutGetCommitTxnGet() { + String txnId = startLocalTxn(); + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + putRow(txnId, "chengdu", 109L, 1099L); + + Row row = getRow(txnId, "chengdu", 109L); + PrimaryKeyColumn[] pks = row.getPrimaryKey().getPrimaryKeyColumns(); + assertEquals(2, pks.length); + assertEquals("pk1", pks[ 0 ].getName()); + assertEquals("chengdu", pks[ 0 ].getValue().asString()); + assertEquals("pk2", pks[ 1 ].getName()); + assertEquals(109L, pks[ 1 ].getValue().asLong()); + + Column[] columns = row.getColumns(); + assertEquals(1, columns.length); + assertEquals("Col", columns[ 0 ].getName()); + assertEquals(1099L, columns[ 0 ].getValue().asLong()); + assertTrue(!columns[ 0 ].hasSetTimestamp()); + + commitTxn(txnId); + } + + @Test + public void TestPutConfictTxn() { + String txnId = startLocalTxn(); + assertNotNull(txnId); + assertTrue(!txnId.isEmpty()); + + putRow(txnId, "chengdu", 110L, 1099L); + + try { + putRow("", "chengdu", 111L, 1099L); + } catch (TableStoreException ex) { + assertEquals("OTSRowOperationConflict", ex.getErrorCode()); + assertEquals("Data is being modified by the other request.", ex.getMessage()); + } + + commitTxn(txnId); + + Row row = getRow("", "chengdu", 110L); + PrimaryKeyColumn[] pks = row.getPrimaryKey().getPrimaryKeyColumns(); + assertEquals(2, pks.length); + assertEquals("pk1", pks[ 0 ].getName()); + assertEquals("chengdu", pks[ 0 ].getValue().asString()); + assertEquals("pk2", pks[ 1 ].getName()); + assertEquals(110L, pks[ 1 ].getValue().asLong()); + } + + private String startLocalTxn() { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("chengdu")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + StartLocalTransactionRequest request = new StartLocalTransactionRequest(tableName, primaryKey); + + return client.startLocalTransaction(request).getTransactionID(); + } + + + private void putRow(String txnId, String pk1, Long pk2, Long columnValue) { + { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(pk1)); + primaryKeyBuilder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(pk2)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + RowPutChange rowPutChange = new RowPutChange(tableName, primaryKey); + + //加入一些属性列 + rowPutChange.addColumn(new Column("Col", ColumnValue.fromLong(columnValue))); + + PutRowRequest request = new PutRowRequest(rowPutChange); + if (!txnId.isEmpty()) { + request.setTransactionId(txnId); + } + client.putRow(request); + } + } + + private void putRow(String txnId, String pk1, Long pk2, Long columnValue, long timestamp) { + { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(pk1)); + primaryKeyBuilder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(pk2)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + RowPutChange rowPutChange = new RowPutChange(tableName, primaryKey); + + //加入一些属性列 + rowPutChange.addColumn(new Column("Col", ColumnValue.fromLong(columnValue), timestamp)); + + PutRowRequest request = new PutRowRequest(rowPutChange); + if (!txnId.isEmpty()) { + request.setTransactionId(txnId); + } + client.putRow(request); + } + } + + private Row getRow(String txnId, String pk1, Long pk2) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder; + primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(pk1)); + primaryKeyBuilder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(pk2)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(criteria); + if (!txnId.isEmpty()) { + request.setTransactionId(txnId); + } + GetRowResponse getRowResponse = client.getRow(request); + return getRowResponse.getRow(); + } + + private List getRange(String txnId, String pk1, Long startPk2, Long endPk2) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + + // 设置起始主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(pk1)); + primaryKeyBuilder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(startPk2)); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKeyBuilder.build()); + + // 设置结束主键 + primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(pk1)); + primaryKeyBuilder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(endPk2)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + return getRangeResponse.getRows(); + } + + private void BatchModify(String txnId, String pk1, Long pk2, Long columnValue, int count) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + // 构造rowPutChange + for (int i = 0; i < count; i++) { + PrimaryKeyBuilder pk1Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk1Builder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(pk1)); + pk1Builder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(pk2 + i)); + RowPutChange rowPutChange1 = new RowPutChange(tableName, pk1Builder.build()); + // 添加一些列 + rowPutChange1.addColumn(new Column("Col", ColumnValue.fromLong(columnValue + i))); + + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowPutChange1); + } + + // 构造rowUpdateChange + for (int i = count; i < count + 3; i++) { + PrimaryKeyBuilder pk1Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk1Builder.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString(pk1)); + pk1Builder.addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(pk2 + i)); + RowUpdateChange rowUpdateChange1 = new RowUpdateChange(tableName, pk1Builder.build()); + // 添加一些列 + rowUpdateChange1.put(new Column("Col", ColumnValue.fromLong(columnValue + i))); + + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowUpdateChange1); + } + + if (!txnId.isEmpty()) { + batchWriteRowRequest.setTransactionId(txnId); + } + + BatchWriteRowResponse response = client.batchWriteRow(batchWriteRowRequest); + assertTrue(response.isAllSucceed()); + } + + private void commitTxn(String txnId) { + CommitTransactionRequest commitRequest = new CommitTransactionRequest(txnId); + client.commitTransaction(commitRequest); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSAPIBehaviorTest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSAPIBehaviorTest.java new file mode 100644 index 0000000..84cb476 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSAPIBehaviorTest.java @@ -0,0 +1,884 @@ +package com.alicloud.openservices.tablestore.functiontest; + + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.core.utils.Pair; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.google.gson.JsonSyntaxException; + +import org.junit.*; + +import java.io.IOException; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +public class OTSAPIBehaviorTest { + + private static String tableName = "SystemStatusTestTable"; + + private static SyncClientInterface ots; + + // 用于数字补位,比如: 2 -> 002, 12 -> 012. + private static NumberFormat formatter = NumberFormat.getNumberInstance(); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + formatter.setMinimumIntegerDigits(3); + formatter.setGroupingUsed(false); + } + + @AfterClass + public static void classAfter() { + ots.shutdown(); + } + + @Before + public void setup() throws Exception { + // 清理环境 + OTSHelper.deleteAllTable(ots); + } + + @After + public void teardown() { + + } + + + /** + * 创建测试表, 指定maxVersions + * + * @param maxVersions + */ + private void createTable(int maxVersions) { + createTable(maxVersions, -1); + } + + private PrimaryKey getPrimaryKey() { + return getPrimaryKey("pk"); + } + + private PrimaryKey getPrimaryKey(String pkValue) { + List primaryKey = new ArrayList(); + primaryKey.add(new PrimaryKeyColumn("pk", PrimaryKeyValue + .fromString(pkValue))); + PrimaryKey pk = new PrimaryKey(primaryKey); + return pk; + } + + /** + * 创建测试表, 指定maxVersions 和 TTL + * + * @param maxVersions + * @param timeToLive + */ + private void createTable(int maxVersions, int timeToLive) { + List pks = new ArrayList(); + pks.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(pks); + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(maxVersions); + tableOptions.setTimeToLive(timeToLive); + tableOptions.setMaxTimeDeviation(Long.MAX_VALUE / 1000000); + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), + tableOptions); + Utils.waitForPartitionLoad(tableName); + } + + /** + * MaxVersion=100,BatchWriteRow的put包含10行,这10行的PK相同, + * 每行包含16个列,列名长度为255,每列包含8个cell, BatchGetRow读取校验期望得到最后一行的数据。 + */ + @Test + public void testBatchWriteRowToPutIdenticalRowPk() { + // createTable + createTable(100); + + int rowNum = 10; + int columnNum = 16; + int versionNum = 8; + StringBuilder columnNamePreBuilder = new StringBuilder(); + for (int i = 0; i < 252; i++) { + columnNamePreBuilder.append("A"); + } + String columnNamePre = columnNamePreBuilder.toString(); + + List puts = new ArrayList(); + for (int row = 0; row < rowNum; row++) { + + List columns = new ArrayList(); + for (int col = 0; col < columnNum; col++) { + for (int ver = 0; ver < versionNum; ver++) { + columns.add(new Column(columnNamePre + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", row" + formatter.format(row) + + ", version" + formatter.format(ver)), ver)); + } + } + + RowPutChange rowPutChange = new RowPutChange(tableName, getPrimaryKey()); + rowPutChange.addColumns(columns); + puts.add(rowPutChange); + } + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // 校验 + List criterias = new ArrayList(); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + criteria.addRow(getPrimaryKey()); + criteria.setMaxVersions(Integer.MAX_VALUE); + criterias.add(criteria); + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + + List expect = new ArrayList(); + for (int col = 0; col < columnNum; col++) { + for (int ver = versionNum - 1; ver >= 0; ver--) { + expect.add(new Column(columnNamePre + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", row" + formatter.format(rowNum - 1) + + ", version" + formatter.format(ver)), ver)); + } + } + Utils.checkColumns(result.getSucceedRows().get(0).getRow().getColumns(), expect); + } + + /** + * MaxVersion=100,BatchWriteRow的update包含10行,这 + * 10行的PK相同,每行包含1个列,列名长度为255,每列包含8个cell,每行的列名不同, + * BatchGetRow读取校验期望得到80个cell的数据。 + */ + @Test + public void testBatchWriteRowToUpdateIdenticalRowPk() { + // createTable + createTable(100); + + int rowNum = 10; + int versionNum = 8; + StringBuilder columnNamePreBuilder = new StringBuilder(); + for (int i = 0; i < 252; i++) { + columnNamePreBuilder.append("A"); + } + String columnNamePre = columnNamePreBuilder.toString(); + + List rowUpdateChanges = new ArrayList(); + List columns = new ArrayList(); + for (int row = 0; row < rowNum; row++) { + for (int ver = 0; ver < versionNum; ver++) { + columns.add(new Column(columnNamePre + formatter.format(row), + ColumnValue.fromString("col_value" + formatter.format(row) + + ", row" + formatter.format(row) + + ", version" + formatter.format(ver)), ver)); + } + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, getPrimaryKey()); + rowUpdateChange.put(columns); + rowUpdateChanges.add(rowUpdateChange); + } + OTSHelper.batchWriteRowNoLimit(ots, null, rowUpdateChanges, null); + + // 校验 + List criterias = new ArrayList(); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + criteria.addRow(getPrimaryKey()); + criteria.setMaxVersions(Integer.MAX_VALUE); + criterias.add(criteria); + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + + List expect = new ArrayList(); + for (int row = 0; row < rowNum; row++) { + for (int ver = versionNum - 1; ver >= 0; ver--) { + expect.add(new Column(columnNamePre + formatter.format(row), + ColumnValue.fromString("col_value" + formatter.format(row) + + ", row" + formatter.format(row) + + ", version" + formatter.format(ver)), ver)); + } + } + Utils.checkColumns(result.getSucceedRows().get(0).getRow().getColumns(), expect); + } + + /** + * MaxVersion=100,BatchWriteRow的update包含10行,这10行的PK相同,每行包含1个列,列名长度为255, + * 每列包含8个cell,每行的列名相同, BatchGetRow读取校验期望得到8个cell的数据,并且跟最后一行相符。 + */ + @Test + public void testBatchWriteRowToUpdateIdenticalRowPkAndColumnName() { + // createTable + createTable(100); + + int rowNum = 10; + int versionNum = 8; + StringBuilder columnNamePreBuilder = new StringBuilder(); + for (int i = 0; i < 252; i++) { + columnNamePreBuilder.append("A"); + } + String columnNamePre = columnNamePreBuilder.toString(); + + List rowUpdateChanges = new ArrayList(); + List columns = new ArrayList(); + for (int row = 0; row < rowNum; row++) { + for (int ver = 0; ver < versionNum; ver++) { + columns.add(new Column( + columnNamePre + formatter.format(ver), + ColumnValue.fromString("col_value" + formatter.format(row) + ", row" + formatter.format(row) + ", version" + formatter.format(ver)), + ver)); + } + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, getPrimaryKey()); + rowUpdateChange.put(columns); + rowUpdateChanges.add(rowUpdateChange); + } + OTSHelper.batchWriteRowNoLimit(ots, null, rowUpdateChanges, null); + + // 校验 + List criterias = new ArrayList(); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + criteria.addRow(getPrimaryKey()); + criteria.setMaxVersions(100); + criterias.add(criteria); + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + + List expect = new ArrayList(); + for (int ver = versionNum - 1; ver >= 0; ver--) { + expect.add(new Column(columnNamePre + formatter.format(versionNum - 1 - ver), + ColumnValue.fromString("col_value" + formatter.format(rowNum - 1) + + ", row" + formatter.format(rowNum - 1) + + ", version" + formatter.format(versionNum - 1 - ver)), versionNum - 1 - ver)); + } + Utils.checkColumns(result.getSucceedRows().get(0).getRow().getColumns(), expect); + } + + /** + * 写入2行(PK0, PK1),每行包含2个列(C0, C1),每列包含2个cell(T0, T1)。 + * 分别测试: + * 1) 删除cell (PK0, C0, T0),GetRow单独读取每个cell,每个列,以及每行。 + * 2) 删除Cell (PK1, C1, T1),GetRow单独读取每个cell,每个列,以及每行。 + * 3) 删除列(PK0, C0),GetRow单独读取每个cell,每个列,以及每行。 + * 4) 删除行PK0,GetRow单独读取每个cell,每个列,以及每行。 + */ + @Test + public void testDeleteCell() { + // createTable + createTable(3); + + // prepare data + int rowNum = 2; + int columnNum = 2; + int versionNum = 2; + + for (int row = 0; row < rowNum; row++) { + List columns = new ArrayList(); + for (int col = 0; col < columnNum; col++) { + for (int ver = 0; ver < versionNum; ver++) { + columns.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + } + } + OTSHelper.putRow(ots, tableName, getPrimaryKey(formatter.format(row)), columns); + } + + // 1) 删除cell (PK0, C0, T0) + List> deleteCells = new ArrayList>(); + deleteCells.add(new Pair("col_name" + formatter.format(0), 0L)); + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(0)), null, null, deleteCells); + + // GetRow单独读取每个cell,每个列,以及每行。 + for (int row = 0; row < rowNum; row++) { + for (int col = 0; col < columnNum; col++) { + for (int ver = 0; ver < versionNum; ver++) { + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, + getPrimaryKey(formatter.format(row))); + criteria.addColumnsToGet("col_name" + formatter.format(col)); + criteria.setTimestamp(ver); + GetRowResponse result = OTSHelper.getRow(ots, criteria); + if (row == 0 && col == 0 && ver == 0) { + assertEquals(null, result.getRow()); + } else { + List expect = new ArrayList(); + expect.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + Utils.checkColumns(result.getRow().getColumns(), expect); + } + } + } + } + + // 2) 删除Cell (PK1, C1, T1) + deleteCells = new ArrayList>(); + deleteCells.add(new Pair("col_name" + formatter.format(1), 1L)); + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(1)), null, null, deleteCells); + + // GetRow单独读取每个cell,每个列,以及每行。 + for (int row = 0; row < rowNum; row++) { + for (int col = 0; col < columnNum; col++) { + for (int ver = 0; ver < versionNum; ver++) { + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, + getPrimaryKey(formatter.format(row))); + criteria.addColumnsToGet("col_name" + formatter.format(col)); + criteria.setTimestamp(ver); + GetRowResponse result = OTSHelper.getRow(ots, criteria); + if (row == 0 && col == 0 && ver == 0) { + assertEquals(null, result.getRow()); + } else if (row == 1 && col == 1 && ver == 1) { + assertEquals(null, result.getRow()); + } else { + List expect = new ArrayList(); + expect.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + Utils.checkColumns(result.getRow().getColumns(), expect); + } + } + } + } + + // 3) 删除列(PK0, C0) + List deletes = new ArrayList(); + deletes.add("col_name" + formatter.format(0)); + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(0)), null, deletes, null); + + // GetRow单独读取每个cell,每个列,以及每行。 + for (int row = 0; row < rowNum; row++) { + for (int col = 0; col < columnNum; col++) { + for (int ver = 0; ver < versionNum; ver++) { + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, + getPrimaryKey(formatter.format(row))); + criteria.addColumnsToGet("col_name" + formatter.format(col)); + criteria.setTimestamp(ver); + GetRowResponse result = OTSHelper.getRow(ots, criteria); + if (row == 0 && col == 0) { + assertEquals(null, result.getRow()); + } else if (row == 1 && col == 1 && ver == 1) { + assertEquals(null, result.getRow()); + } else { + List expect = new ArrayList(); + expect.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + Utils.checkColumns(result.getRow().getColumns(), expect); + } + } + } + } + + // 4) 删除行PK0 + OTSHelper.deleteRow(ots, tableName, getPrimaryKey(formatter.format(0))); + + // GetRow单独读取每个cell,每个列,以及每行。 + for (int row = 0; row < rowNum; row++) { + for (int col = 0; col < columnNum; col++) { + for (int ver = 0; ver < versionNum; ver++) { + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, + getPrimaryKey(formatter.format(row))); + criteria.addColumnsToGet("col_name" + formatter.format(col)); + criteria.setTimestamp(ver); + GetRowResponse result = OTSHelper.getRow(ots, criteria); + if (row == 0) { + assertEquals(null, result.getRow()); + } else if (row == 1 && col == 1 && ver == 1) { + assertEquals(null, result.getRow()); + } else { + List expect = new ArrayList(); + expect.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + Utils.checkColumns(result.getRow().getColumns(), expect); + } + } + } + } + } + + /** + * 写入2行,每行包含128个列,每列包含2个CELL。顺序地删除一个cell,一个列,一整行, + * 每次都GetRange读取所有CELL校验。然后再写入同样的一个cell,一个列,一整行,每次都GetRange所有cell校验。 + */ + @Test + public void testDeleteCellThenWriteBack1() { + // createTable + createTable(3); + + int rowNum = 2; + int columnNum = 128; + int versionNum = 2; + + // prepare data + for (int row = 0; row < rowNum; row++) { + for (int ver = 0; ver < versionNum; ver++) { + List columns = new ArrayList(); + for (int col = 0; col < columnNum; col++) { + columns.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + } + OTSHelper.updateRow(ots, tableName, + getPrimaryKey(formatter.format(row)), columns, null, null); + } + } + + // delete cell (删除Row1, Col10, Ver0) + List> deleteCells = new ArrayList>(); + deleteCells.add(new Pair("col_name" + formatter.format(10), 0L)); + OTSHelper.updateRow(ots, tableName, + getPrimaryKey(formatter.format(1)), null, null, deleteCells); + + // getRange 校验 + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(2, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (primaryKey.equals(getPrimaryKey(formatter.format(1))) && col == 10) { + assertEquals(1, columns.size()); + assertEquals("col_name" + formatter.format(col), columns.get(0).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(1), columns.get(0).getValue().asString()); + assertEquals(1, columns.get(0).getTimestamp()); + } else { + assertEquals(2, columns.size()); + for (int ver = 0; ver < 2; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(1 - ver).getValue().asString()); + assertEquals(ver, columns.get(1 - ver).getTimestamp()); + } + } + } + } + + // delete Column (删除 Row1, Col100) + List deletes = new ArrayList(); + deletes.add("col_name" + formatter.format(100)); + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(1)), null, deletes, null); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(2, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (primaryKey.equals(getPrimaryKey(formatter.format(1))) && col == 100) { + assertEquals(0, columns.size()); + } else if (primaryKey.equals(getPrimaryKey(formatter.format(1))) && col == 10) { + assertEquals(1, columns.size()); + assertEquals("col_name" + formatter.format(col), columns.get(0).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(1), columns.get(0).getValue().asString()); + assertEquals(1, columns.get(0).getTimestamp()); + } else { + assertEquals(2, columns.size()); + for (int ver = 0; ver < 2; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(1 - ver).getValue().asString()); + assertEquals(ver, columns.get(1 - ver).getTimestamp()); + } + } + } + } + + // delete row (删除Row0) + OTSHelper.deleteRow(ots, tableName, getPrimaryKey(formatter.format(0))); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(1, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + assertEquals(getPrimaryKey(formatter.format(1)), primaryKey); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (col == 100) { + assertEquals(0, columns.size()); + } else if (col == 10) { + assertEquals(1, columns.size()); + assertEquals("col_name" + formatter.format(col), columns.get(0).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(1), columns.get(0).getValue().asString()); + assertEquals(1, columns.get(0).getTimestamp()); + } else { + assertEquals(2, columns.size()); + for (int ver = 0; ver < 2; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(1 - ver).getValue().asString()); + assertEquals(ver, columns.get(1 - ver).getTimestamp()); + } + } + } + } + + // 写入 Row1 Col10 Ver0 + List puts = new ArrayList(); + puts.add(new Column("col_name" + formatter.format(10), + ColumnValue.fromString("col_value" + formatter.format(10) + + ", version" + formatter.format(0)), 0)); + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(1)), + puts, null, null); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(1, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + assertEquals(getPrimaryKey(formatter.format(1)), primaryKey); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (col == 100) { + assertEquals(0, columns.size()); + } else { + assertEquals(2, columns.size()); + for (int ver = 0; ver < 2; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(1 - ver).getValue().asString()); + assertEquals(ver, columns.get(1 - ver).getTimestamp()); + } + } + } + } + + // 写入 Row1 Col100 + puts = new ArrayList(); + for (int ver = 0; ver < versionNum; ver++) { + puts.add(new Column("col_name" + formatter.format(100), + ColumnValue.fromString("col_value" + formatter.format(100) + + ", version" + formatter.format(ver)), ver)); + } + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(1)), + puts, null, null); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(1, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + assertEquals(getPrimaryKey(formatter.format(1)), primaryKey); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + assertEquals(2, columns.size()); + for (int ver = 0; ver < 2; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(1 - ver).getValue().asString()); + assertEquals(ver, columns.get(1 - ver).getTimestamp()); + } + } + } + + // 写入 Row0 + for (int ver = 0; ver < versionNum; ver++) { + List columns = new ArrayList(); + for (int col = 0; col < columnNum; col++) { + columns.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + } + OTSHelper.updateRow(ots, tableName, + getPrimaryKey(formatter.format(0)), columns, null, null); + } + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(2, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + assertEquals(2, columns.size()); + for (int ver = 0; ver < 2; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(1 - ver).getValue().asString()); + assertEquals(ver, columns.get(1 - ver).getTimestamp()); + } + } + } + } + + /** + * 写入2行,每行包含2个列,每列包含128个CELL。顺序地删除一整行,一个列,一个cell, + * 每次都GetRange读取所有CELL校验。然后再写入同样的一整行,一个列,一个cell,每次都GetRange所有cell校验。 + */ + @Test + public void testDeleteCellThenWriteBack2() { + // createTable + createTable(200); + + int rowNum = 2; + int columnNum = 2; + int versionNum = 128; + + // prepare data + for (int row = 0; row < rowNum; row++) { + for (int ver = 0; ver < versionNum; ver++) { + List columns = new ArrayList(); + for (int col = 0; col < columnNum; col++) { + columns.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + } + OTSHelper.updateRow(ots, tableName, + getPrimaryKey(formatter.format(row)), columns, null, null); + } + } + + // delete row (删除Row0) + OTSHelper.deleteRow(ots, tableName, getPrimaryKey(formatter.format(0))); + + // getRange 校验 + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(1, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + assertEquals(getPrimaryKey(formatter.format(1)), primaryKey); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + assertEquals(versionNum, columns.size()); + for (int ver = 0; ver < versionNum; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(versionNum - 1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), + columns.get(versionNum - 1 - ver).getValue().asString()); + assertEquals(ver, columns.get(versionNum - 1 - ver).getTimestamp()); + } + } + } + + // delete Column (删除 Row1, Col0) + List deletes = new ArrayList(); + deletes.add("col_name" + formatter.format(0)); + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(1)), null, deletes, null); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(1, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + assertEquals(getPrimaryKey(formatter.format(1)), primaryKey); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (col == 0) { + assertEquals(0, columns.size()); + } else { + assertEquals(versionNum, columns.size()); + for (int ver = 0; ver < versionNum; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(versionNum - 1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(versionNum - 1 - ver).getValue().asString()); + assertEquals(ver, columns.get(versionNum - 1 - ver).getTimestamp()); + } + } + } + } + + // delete cell (删除Row1, Col1, Ver0) + List> deleteCells = new ArrayList>(); + deleteCells.add(new Pair("col_name" + formatter.format(1), 0L)); + OTSHelper.updateRow(ots, tableName, + getPrimaryKey(formatter.format(1)), null, null, deleteCells); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(1, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + assertEquals(getPrimaryKey(formatter.format(1)), primaryKey); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (col == 0) { + assertEquals(0, columns.size()); + } else if (col == 1) { + assertEquals(127, columns.size()); + for (int ver = 127; ver > 0; ver--) { + assertEquals("col_name" + formatter.format(col), columns.get(127 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(127 - ver).getValue().asString()); + assertEquals(ver, columns.get(127 - ver).getTimestamp()); + } + } else { + assertEquals(versionNum, columns.size()); + for (int ver = 0; ver < versionNum; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(versionNum - 1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(versionNum - 1 - ver).getValue().asString()); + assertEquals(ver, columns.get(versionNum - 1 - ver).getTimestamp()); + } + } + } + } + + // 写入 Row0 + for (int ver = 0; ver < versionNum; ver++) { + List columns = new ArrayList(); + for (int col = 0; col < columnNum; col++) { + columns.add(new Column("col_name" + formatter.format(col), + ColumnValue.fromString("col_value" + formatter.format(col) + + ", version" + formatter.format(ver)), ver)); + } + OTSHelper.updateRow(ots, tableName, + getPrimaryKey(formatter.format(0)), columns, null, null); + } + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(2, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (primaryKey.equals(getPrimaryKey(formatter.format(1))) && col == 0) { + assertEquals(0, columns.size()); + } else if (primaryKey.equals(getPrimaryKey(formatter.format(1))) && col == 1) { + assertEquals(127, columns.size()); + for (int ver = 127; ver > 0; ver--) { + assertEquals("col_name" + formatter.format(col), columns.get(127 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(127 - ver).getValue().asString()); + assertEquals(ver, columns.get(127 - ver).getTimestamp()); + } + } else { + assertEquals(versionNum, columns.size()); + for (int ver = 0; ver < versionNum; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(versionNum - 1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), + columns.get(versionNum - 1 - ver).getValue().asString()); + assertEquals(ver, columns.get(versionNum - 1 - ver).getTimestamp()); + } + } + } + } + + // 写入 Row1 Col0 + ArrayList puts = new ArrayList(); + for (int ver = 0; ver < versionNum; ver++) { + puts.add(new Column("col_name" + formatter.format(0), + ColumnValue.fromString("col_value" + formatter.format(0) + + ", version" + formatter.format(ver)), ver)); + } + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(1)), + puts, null, null); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(2, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + if (primaryKey.equals(getPrimaryKey(formatter.format(1))) && col == 1) { + assertEquals(127, columns.size()); + for (int ver = 127; ver > 0; ver--) { + assertEquals("col_name" + formatter.format(col), columns.get(127 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), columns.get(127 - ver).getValue().asString()); + assertEquals(ver, columns.get(127 - ver).getTimestamp()); + } + } else { + assertEquals(versionNum, columns.size()); + for (int ver = 0; ver < versionNum; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(versionNum - 1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), + columns.get(versionNum - 1 - ver).getValue().asString()); + assertEquals(ver, columns.get(versionNum - 1 - ver).getTimestamp()); + } + } + } + } + + // 写入 Row1 Col1 Ver0 + puts = new ArrayList(); + puts.add(new Column("col_name" + formatter.format(1), + ColumnValue.fromString("col_value" + formatter.format(1) + + ", version" + formatter.format(0)), 0)); + OTSHelper.updateRow(ots, tableName, getPrimaryKey(formatter.format(1)), + puts, null, null); + + // getRange 校验 + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + assertEquals(2, result.getRows().size()); + for (Row row : result.getRows()) { + PrimaryKey primaryKey = row.getPrimaryKey(); + for (int col = 0; col < columnNum; col++) { + List columns = row.getColumn("col_name" + formatter.format(col)); + assertEquals(versionNum, columns.size()); + for (int ver = 0; ver < versionNum; ver++) { + assertEquals("col_name" + formatter.format(col), columns.get(versionNum - 1 - ver).getName()); + assertEquals("col_value" + formatter.format(col) + + ", version" + formatter.format(ver), + columns.get(versionNum - 1 - ver).getValue().asString()); + assertEquals(ver, columns.get(versionNum - 1 - ver).getTimestamp()); + } + } + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSBasicCompaFourTest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSBasicCompaFourTest.java new file mode 100644 index 0000000..017b69e --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/OTSBasicCompaFourTest.java @@ -0,0 +1,778 @@ +package com.alicloud.openservices.tablestore.functiontest; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.common.BaseFT; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.OTSRestrictedItemConst; +import com.alicloud.openservices.tablestore.common.Utils; +import com.google.gson.JsonSyntaxException; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +/** + * Created by jingwen.hjw on 2015/1/31. + */ +public class OTSBasicCompaFourTest extends BaseFT { + + private static String tableName = "OTSBasicCompaTest"; + private static SyncClientInterface ots; + private static final Logger LOG = LoggerFactory.getLogger(OTSBasicCompaFourTest.class); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + ots.shutdown(); + } + + @Before + public void setup() throws Exception { + // 清理环境 + OTSHelper.deleteAllTable(ots); + } + + @After + public void teardown() throws Exception { + } + + private void createTableWithOnePrimaryKey(String tableName) throws Exception { + + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + + Utils.waitForPartitionLoad(tableName); + DescribeTableResponse describeTableResult = ots.describeTable(new DescribeTableRequest(tableName)); + assertEquals(capacityUnit, describeTableResult.getReservedThroughputDetails().getCapacityUnit()); + + assertEquals(tableMeta.getTableName(), describeTableResult.getTableMeta().getTableName()); + assertEquals(tableMeta.getPrimaryKeyList().size(), describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals(1, describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals("PK1", describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getName()); + assertEquals(PrimaryKeyType.STRING, describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getType()); + + assertEquals(1, describeTableResult.getTableOptions().getMaxVersions()); + assertEquals(Integer.MAX_VALUE, describeTableResult.getTableOptions().getTimeToLive()); + } + + private void createTableWithTwoPrimaryKeys(String tableName) throws Exception { + + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.INTEGER)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + DescribeTableResponse describeTableResult = ots.describeTable(new DescribeTableRequest(tableName)); + assertEquals(capacityUnit, describeTableResult.getReservedThroughputDetails().getCapacityUnit()); + + assertEquals(tableMeta.getTableName(), describeTableResult.getTableMeta().getTableName()); + assertEquals(tableMeta.getPrimaryKeyList().size(), describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals(2, describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals("PK1", describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getName()); + assertEquals(PrimaryKeyType.STRING, describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getType()); + assertEquals("PK2", describeTableResult.getTableMeta().getPrimaryKeyList().get(1).getName()); + assertEquals(PrimaryKeyType.INTEGER, describeTableResult.getTableMeta().getPrimaryKeyList().get(1).getType()); + + assertEquals(1, describeTableResult.getTableOptions().getMaxVersions()); + assertEquals(Integer.MAX_VALUE, describeTableResult.getTableOptions().getTimeToLive()); + } + + private void createTableWithThreePrimaryKeys(String tableName) throws Exception { + + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.INTEGER)); + pk.add(new PrimaryKeySchema("PK3", PrimaryKeyType.INTEGER)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + + DescribeTableResponse describeTableResult = ots.describeTable(new DescribeTableRequest(tableName)); + assertEquals(capacityUnit, describeTableResult.getReservedThroughputDetails().getCapacityUnit()); + + assertEquals(tableMeta.getTableName(), describeTableResult.getTableMeta().getTableName()); + assertEquals(tableMeta.getPrimaryKeyList().size(), describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals(3, describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals("PK1", describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getName()); + assertEquals(PrimaryKeyType.STRING, describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getType()); + assertEquals("PK2", describeTableResult.getTableMeta().getPrimaryKeyList().get(1).getName()); + assertEquals(PrimaryKeyType.INTEGER, describeTableResult.getTableMeta().getPrimaryKeyList().get(1).getType()); + assertEquals("PK3", describeTableResult.getTableMeta().getPrimaryKeyList().get(2).getName()); + assertEquals(PrimaryKeyType.INTEGER, describeTableResult.getTableMeta().getPrimaryKeyList().get(2).getType()); + + assertEquals(1, describeTableResult.getTableOptions().getMaxVersions()); + assertEquals(Integer.MAX_VALUE, describeTableResult.getTableOptions().getTimeToLive()); + } + + private void createTableWithFourPrimaryKeys(String tableName) throws Exception { + + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.INTEGER)); + pk.add(new PrimaryKeySchema("PK3", PrimaryKeyType.INTEGER)); + pk.add(new PrimaryKeySchema("PK4", PrimaryKeyType.INTEGER)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + + DescribeTableResponse describeTableResult = ots.describeTable(new DescribeTableRequest(tableName)); + assertEquals(capacityUnit, describeTableResult.getReservedThroughputDetails().getCapacityUnit()); + + assertEquals(tableMeta.getTableName(), describeTableResult.getTableMeta().getTableName()); + assertEquals(tableMeta.getPrimaryKeyList().size(), describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals(4, describeTableResult.getTableMeta().getPrimaryKeyList().size()); + assertEquals("PK1", describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getName()); + assertEquals(PrimaryKeyType.STRING, describeTableResult.getTableMeta().getPrimaryKeyList().get(0).getType()); + assertEquals("PK2", describeTableResult.getTableMeta().getPrimaryKeyList().get(1).getName()); + assertEquals(PrimaryKeyType.INTEGER, describeTableResult.getTableMeta().getPrimaryKeyList().get(1).getType()); + assertEquals("PK3", describeTableResult.getTableMeta().getPrimaryKeyList().get(2).getName()); + assertEquals(PrimaryKeyType.INTEGER, describeTableResult.getTableMeta().getPrimaryKeyList().get(2).getType()); + assertEquals("PK4", describeTableResult.getTableMeta().getPrimaryKeyList().get(3).getName()); + assertEquals(PrimaryKeyType.INTEGER, describeTableResult.getTableMeta().getPrimaryKeyList().get(3).getType()); + + assertEquals(1, describeTableResult.getTableOptions().getMaxVersions()); + assertEquals(Integer.MAX_VALUE, describeTableResult.getTableOptions().getTimeToLive()); + } + + private void createTableWithOnePrimaryKeyString(String tableName) throws Exception { + + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + } + + private void createTableWithOnePrimaryKeyInteger(String tableName) throws Exception { + + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + } + + private void getRangeForMultiRangeGet(String tableName, + PrimaryKeyValue startFirst, + PrimaryKeyValue startSecond, + PrimaryKeyValue endFirst, + PrimaryKeyValue endSecond) throws Exception { + // PrimaryKey + List primaryKeyList; + + // GetRange + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", startFirst)); + primaryKeyList.add(new PrimaryKeyColumn("PK2", startSecond)); + PrimaryKey inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", endFirst)); + primaryKeyList.add(new PrimaryKeyColumn("PK2", endSecond)); + PrimaryKey exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setDirection(Direction.FORWARD); + rangeRowQueryCriteria.addColumnsToGet("C1"); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeRequest getRangeRequest = new GetRangeRequest(rangeRowQueryCriteria); + getRangeRequest.setRangeRowQueryCriteria(rangeRowQueryCriteria); + + GetRangeResponse getRangeResult = ots.getRange(getRangeRequest); + //assertEquals(new CapacityUnit(0, 0), getRangeResult.getConsumedCapacity().getCapacityUnit()); + assertEquals(0, getRangeResult.getRows().size()); + } + + private void createTableWithPrimaryKeyStringString(String tableName) { + // create Table + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.STRING)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + + Utils.waitForPartitionLoad(tableName); + } + + private void createTableWithPrimaryKeyStringInteger(String tableName) { + // create Table + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.INTEGER)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + } + + private void createTableWithPrimaryKeyIntegerInteger(String tableName) { + // create Table + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.INTEGER)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + } + + private void createTableWithPrimaryKeyIntegerString(String tableName) { + // create Table + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.STRING)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + } + + private void validateGetRangeWithoutParition(String tableName, + PrimaryKey start, PrimaryKey end, int expectation) { + byte[] binaryValue = new byte[1]; + binaryValue[0] = (byte) 0xff; + + // GetRange + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setDirection(Direction.FORWARD); + rangeRowQueryCriteria.addColumnsToGet("C1"); + rangeRowQueryCriteria.addColumnsToGet("C2"); + rangeRowQueryCriteria.addColumnsToGet("C3"); + rangeRowQueryCriteria.addColumnsToGet("C4"); + rangeRowQueryCriteria.addColumnsToGet("C5"); + rangeRowQueryCriteria.addColumnsToGet("C6"); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(start); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeRequest getRangeRequest = new GetRangeRequest(rangeRowQueryCriteria); + getRangeRequest.setRangeRowQueryCriteria(rangeRowQueryCriteria); + + GetRangeResponse getRangeResult = ots.getRange(getRangeRequest); + assertEquals(expectation, getRangeResult.getRows().size()); + + for (Row row : getRangeResult.getRows()) { + assertEquals(1, row.getColumn("C1").size()); + assertEquals(1, row.getColumn("C2").size()); + assertEquals(1, row.getColumn("C3").size()); + assertEquals(1, row.getColumn("C4").size()); + assertEquals(1, row.getColumn("C5").size()); + assertEquals(1, row.getColumn("C6").size()); + + assertEquals(ColumnValue.fromString("blah"), row.getColumn("C1").get(0).getValue()); + assertEquals(ColumnValue.fromLong(123L), row.getColumn("C2").get(0).getValue()); + assertEquals(ColumnValue.fromBoolean(true), row.getColumn("C3").get(0).getValue()); + assertEquals(ColumnValue.fromBoolean(false), row.getColumn("C4").get(0).getValue()); + assertEquals(ColumnValue.fromDouble(3.14), row.getColumn("C5").get(0).getValue()); + assertEquals(ColumnValue.fromBinary(binaryValue), row.getColumn("C6").get(0).getValue()); + } + } + + private void createAndInitTableForGetRangeTest(String tableName) { + byte[] binaryValue = new byte[1]; + binaryValue[0] = (byte) 0xff; + + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + pk.add(new PrimaryKeySchema("PK2", PrimaryKeyType.STRING)); + pk.add(new PrimaryKeySchema("PK3", PrimaryKeyType.INTEGER)); + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumns(pk); + + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + ReservedThroughput reservedThroughput = new ReservedThroughput(capacityUnit); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(Integer.MAX_VALUE); + + CreateTableRequest createTableRequest = new CreateTableRequest(tableMeta, tableOptions); + createTableRequest.setReservedThroughput(reservedThroughput); + + ots.createTable(createTableRequest); + Utils.waitForPartitionLoad(tableName); + + // PrimaryKey + List primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(10L))); + PrimaryKey primaryKey = new PrimaryKey(primaryKeyList); + + // Columns + List columnList = new ArrayList(); + columnList.add(new Column("C1", ColumnValue.fromString("blah"))); + columnList.add(new Column("C2", ColumnValue.fromLong(123L))); + columnList.add(new Column("C3", ColumnValue.fromBoolean(true))); + columnList.add(new Column("C4", ColumnValue.fromBoolean(false))); + columnList.add(new Column("C5", ColumnValue.fromDouble(3.14))); + columnList.add(new Column("C6", ColumnValue.fromBinary(binaryValue))); + + // PutRow + RowPutChange rowPutChange = new RowPutChange(tableName, primaryKey); + rowPutChange.addColumns(columnList); + + PutRowRequest putRowRequest = new PutRowRequest(rowPutChange); + + ots.putRow(putRowRequest); + + } + + /* + * 分别测试PK个数为1,2,3,4的4个表,GetRange中包含的row个数为0的情况, + * 期望返回为空,CU消耗为(1, 0) + */ + @Test + public void testCaseGetRangeFromEmptyTable() throws Exception { + List primaryKeyList; + + // One PK: String + tableName = "TableNameOnePK"; + createTableWithOnePrimaryKey(tableName); + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("1"))); + PrimaryKey inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("2"))); + PrimaryKey exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setDirection(Direction.FORWARD); + rangeRowQueryCriteria.addColumnsToGet("C1"); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeRequest getRangeRequest = new GetRangeRequest(rangeRowQueryCriteria); + getRangeRequest.setRangeRowQueryCriteria(rangeRowQueryCriteria); + + GetRangeResponse getRangeResult = ots.getRange(getRangeRequest); + //assertEquals(new CapacityUnit(0, 0), getRangeResult.getConsumedCapacity().getCapacityUnit()); + assertEquals(0, getRangeResult.getRows().size()); + + // Two PK: String Integer + tableName = "TableNameTwoPK"; + createTableWithTwoPrimaryKeys(tableName); + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("1"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MIN)); + inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("2"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MAX)); + exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setDirection(Direction.FORWARD); + rangeRowQueryCriteria.addColumnsToGet("C1"); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + getRangeRequest = new GetRangeRequest(rangeRowQueryCriteria); + getRangeRequest.setRangeRowQueryCriteria(rangeRowQueryCriteria); + + getRangeResult = ots.getRange(getRangeRequest); + //assertEquals(new CapacityUnit(0, 0), getRangeResult.getConsumedCapacity().getCapacityUnit()); + assertEquals(0, getRangeResult.getRows().size()); + + // Three PK: String Integer Integer + tableName = "TableNameThreePK"; + createTableWithThreePrimaryKeys(tableName); + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("1"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MIN)); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.INF_MIN)); + inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("2"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MAX)); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.INF_MAX)); + exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setDirection(Direction.FORWARD); + rangeRowQueryCriteria.addColumnsToGet("C1"); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + getRangeRequest = new GetRangeRequest(rangeRowQueryCriteria); + getRangeRequest.setRangeRowQueryCriteria(rangeRowQueryCriteria); + + getRangeResult = ots.getRange(getRangeRequest); + //assertEquals(new CapacityUnit(0, 0), getRangeResult.getConsumedCapacity().getCapacityUnit()); + assertEquals(0, getRangeResult.getRows().size()); + + // Four PK: String Integer Integer Integer + tableName = "TableNameFourPK"; + createTableWithFourPrimaryKeys(tableName); + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("1"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MIN)); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.INF_MIN)); + primaryKeyList.add(new PrimaryKeyColumn("PK4", PrimaryKeyValue.INF_MIN)); + inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("2"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MAX)); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.INF_MAX)); + primaryKeyList.add(new PrimaryKeyColumn("PK4", PrimaryKeyValue.INF_MAX)); + exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setDirection(Direction.FORWARD); + rangeRowQueryCriteria.addColumnsToGet("C1"); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + getRangeRequest = new GetRangeRequest(rangeRowQueryCriteria); + getRangeRequest.setRangeRowQueryCriteria(rangeRowQueryCriteria); + + getRangeResult = ots.getRange(getRangeRequest); + //assertEquals(new CapacityUnit(0, 0), getRangeResult.getConsumedCapacity().getCapacityUnit()); + assertEquals(0, getRangeResult.getRows().size()); + } + + + /* + * 一个表有3个PK,类型分别是STRING, STRING, INTEGER, + * 测试range: + * ('A' 'A' 10, 'A' 'A' 10), + * ('A' 'A' 10, 'A' 'A' 11), + * ('A' 'A' 10, 'A' 'A' 9)(出错), + * ('A' 'A' MAX, 'A' 'B' MIN), + * ('A' MIN 10, 'B' MAX 2), + * 构造数据让每个区间都有值。 + */ + @Test + public void testCaseGetRangeWithoutPartition() throws Exception { + createAndInitTableForGetRangeTest(tableName); + + // ('A' 'A' 10, 'A' 'A' 10)(出错) + List primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(10L))); + PrimaryKey inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(10L))); + PrimaryKey exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + try { + validateGetRangeWithoutParition(tableName, inclusiveStartPrimaryKey, exclusiveEndPrimaryKey, 1); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "Begin key must less than end key in FORWARD", 400, e); + } + + // ('A' 'A' 10, 'A' 'A' 11) + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(10L))); + inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(11L))); + exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + validateGetRangeWithoutParition(tableName, inclusiveStartPrimaryKey, exclusiveEndPrimaryKey, 1); + + // ('A' 'A' 10, 'A' 'A' 9)(出错) + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(10L))); + inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(9L))); + exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + try { + validateGetRangeWithoutParition(tableName, inclusiveStartPrimaryKey, exclusiveEndPrimaryKey, 1); + assertTrue(false); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "Begin key must less than end key in FORWARD", 400, e); + } + + // ('A' 'A' MAX, 'A' 'B' MIN) + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.INF_MAX)); + inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("B"))); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.INF_MIN)); + exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + validateGetRangeWithoutParition(tableName, inclusiveStartPrimaryKey, exclusiveEndPrimaryKey, 0); + + // ('A' MIN 10, 'B' MAX 2) + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("A"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MIN)); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(10L))); + inclusiveStartPrimaryKey = new PrimaryKey(primaryKeyList); + + primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("B"))); + primaryKeyList.add(new PrimaryKeyColumn("PK2", PrimaryKeyValue.INF_MAX)); + primaryKeyList.add(new PrimaryKeyColumn("PK3", PrimaryKeyValue.fromLong(2L))); + exclusiveEndPrimaryKey = new PrimaryKey(primaryKeyList); + + validateGetRangeWithoutParition(tableName, inclusiveStartPrimaryKey, exclusiveEndPrimaryKey, 1); + } + + /* + * 多线程同时BatchWriteRow一行构造锁冲突错误,期望BatchWriteRow返回的单个item结果中出现RowOperationConflit + */ + @Test + public void testCaseBatchWriteRowSucceedWhenAllItemFailedBackend() throws Exception { + createTableWithOnePrimaryKeyString("TableForFailTest"); + int runnerNumber = 10; + boolean hasConflict = false; + + List runnerList = new ArrayList(); + for (int i = 1; i <= runnerNumber; i++) { + runnerList.add(new BatchWriteRowRunner(i)); + } + + ExecutorService pool = Executors.newFixedThreadPool(runnerNumber); + for (BatchWriteRowRunner runner : runnerList) { + pool.execute(runner); + } + + pool.shutdown(); + while (!pool.awaitTermination(1, TimeUnit.SECONDS)) {} + + for (BatchWriteRowRunner runner : runnerList) { + if (runner.getErrorMessage() != null) { + hasConflict = true; + assertEquals("Data is being modified by the other request.", runner.getErrorMessage()); + assertEquals(ErrorCode.ROW_OPERATION_CONFLICT, runner.getErrorCode()); + } + } + // TODO restore this assert when TxnMonitor is per-partition + // assertEquals(false, hasConflict); + } + + public class BatchWriteRowRunner implements Runnable { + final int value; + String errorMessage; + String errorCode; + + public BatchWriteRowRunner(int value) { + this.value = value; + } + + public String getErrorMessage() { + return this.errorMessage; + } + + public String getErrorCode() { + return this.errorCode; + } + + @Override + public void run() { + // BatchWriteRow + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + // PrimaryKey + List primaryKeyList = new ArrayList(); + primaryKeyList.add(new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("blah"))); + PrimaryKey primaryKey = new PrimaryKey(primaryKeyList); + + RowPutChange newRowPutChange = new RowPutChange("TableForFailTest", primaryKey); + newRowPutChange.addColumn(new Column("C1", ColumnValue.fromLong((long) value))); + batchWriteRowRequest.addRowChange(newRowPutChange); + + BatchWriteRowResponse batchWriteRowResult = ots.batchWriteRow(batchWriteRowRequest); + List rowResultList = batchWriteRowResult.getRowStatus("TableForFailTest"); + assertEquals(1, rowResultList.size()); + if (rowResultList.get(0).getError() != null) { + this.errorMessage = rowResultList.get(0).getError().getMessage(); + this.errorCode = rowResultList.get(0).getError().getCode(); + } else { + this.errorMessage = null; + this.errorCode = null; + } + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/ParameterLegalityTest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/ParameterLegalityTest.java new file mode 100644 index 0000000..e46ea3b --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/ParameterLegalityTest.java @@ -0,0 +1,1056 @@ +package com.alicloud.openservices.tablestore.functiontest; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.Error; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse.RowResult; +import com.alicloud.openservices.tablestore.core.utils.Pair; +import com.alicloud.openservices.tablestore.common.*; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import com.google.gson.JsonSyntaxException; +import org.junit.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +public class ParameterLegalityTest extends BaseFT { + + private static String tableName = "ParameterLegalityFunctiontest"; + + private static SyncClientInterface ots; + + private static final Logger LOG = LoggerFactory.getLogger(ParameterLegalityTest.class); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + ots.shutdown(); + } + + @Before + public void setup() throws Exception { + // 清理环境 + OTSHelper.deleteAllTable(ots); + } + + @After + public void teardown() { + + } + + /** + * 创建测试表, 指定maxVersions + * + * @param maxVersions + */ + private void createTable(int maxVersions) { + List pks = new ArrayList(); + pks.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(pks); + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(maxVersions); + tableOptions.setTimeToLive(-1); + tableOptions.setMaxTimeDeviation(Long.MAX_VALUE / 1000000); + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), + tableOptions); + Utils.waitForPartitionLoad(tableName); + } + + private PrimaryKey getPrimaryKey() { + return getPrimaryKey("pk"); + } + + private PrimaryKey getPrimaryKey(String pkValue) { + List primaryKey = new ArrayList(); + primaryKey.add(new PrimaryKeyColumn("pk", PrimaryKeyValue + .fromString(pkValue))); + PrimaryKey pk = new PrimaryKey(primaryKey); + return pk; + } + + private void checkException(Exception ex, Exception e) { + LOG.info(e.toString()); + if (ex instanceof TableStoreException) { + assertTableStoreException((TableStoreException) ex, (TableStoreException) e); + } + if (ex instanceof ClientException) { + assertClientException((ClientException) ex, (ClientException) e); + } + } + + private void checkCreateTable(SyncClientInterface ots, String tableName, Exception ex) { + List pks = new ArrayList(); + pks.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(pks); + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(Integer.MAX_VALUE); + tableOptions.setMaxTimeDeviation(Long.MAX_VALUE / 1000000); + tableOptions.setTimeToLive(-1); + if (ex == null) { + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), + tableOptions); + } else { + try { + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), + tableOptions); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + } + } + + private void checkUpdateTable(SyncClientInterface ots, String tableName, Exception ex) { + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(10); + if (ex == null) { + OTSHelper.updateTable(ots, tableName, null, tableOptions); + } else { + try { + OTSHelper.updateTable(ots, tableName, null, tableOptions); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + } + } + + private DescribeTableResponse checkDescribeTable(SyncClientInterface ots, String tableName, Exception ex) { + if (ex == null) { + return OTSHelper.describeTable(ots, tableName); + } else { + try { + OTSHelper.describeTable(ots, tableName); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + return null; + } + } + + private void checkDeleteTable(SyncClientInterface ots, String tableName, Exception ex) { + if (ex == null) { + OTSHelper.deleteTable(ots, tableName); + } else { + try { + OTSHelper.deleteTable(ots, tableName); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + } + } + + private GetRowResponse checkGetRow(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, Exception ex) { + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName, pk); + criteria.addColumnsToGet(columnName); + criteria.setMaxVersions(Integer.MAX_VALUE); + if (ex == null) { + return OTSHelper.getRow(ots, criteria); + } else { + try { + OTSHelper.getRow(ots, criteria); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + return null; + } + } + + private void checkUpdateRow(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, Exception ex) { + List puts = new ArrayList(); + Column column = new Column(columnName, ColumnValue.fromString("col_value"), 1L); + puts.add(column); + puts.add(new Column(columnName, ColumnValue.fromString("col_value"), 2L)); + List deletes = new ArrayList(); + deletes.add(columnName); + List> deleteCells = new ArrayList>(); + deleteCells.add(new Pair(columnName, 2L)); + if (ex == null) { + OTSHelper.updateRow(ots, tableName, pk, null, deletes, null); + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + OTSHelper.updateRow(ots, tableName, pk, null, null, deleteCells); + } else { + try { + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + try { + OTSHelper.updateRow(ots, tableName, pk, null, deletes, null); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + try { + OTSHelper.updateRow(ots, tableName, pk, null, null, deleteCells); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + } + } + + private void checkDeleteRow(SyncClientInterface ots, String tableName, PrimaryKey pk, Exception ex) { + if (ex == null) { + OTSHelper.deleteRow(ots, tableName, pk); + } else { + try { + OTSHelper.deleteRow(ots, tableName, pk); + fail(); + } catch (Exception e) { + System.out.println("deleteRow:" + e); + checkException(ex, e); + } + } + } + + private void checkPutRow(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, Exception ex) { + List columns = new ArrayList(); + ColumnValue cv = ColumnValue.fromString("col_value"); + columns.add(new Column(columnName, cv, 1L)); + if (ex == null) { + OTSHelper.putRow(ots, tableName, pk, columns); + } else { + try { + OTSHelper.putRow(ots, tableName, pk, columns); + fail(); + } catch (Exception e) { + System.out.println(e); + checkException(ex, e); + } + } + } + + private void checkBatchWriteRow(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, TableStoreException ex) { + List columns = new ArrayList(); + columns.add(new Column(columnName, ColumnValue.fromString("col_value"), 1L)); + List puts = new ArrayList(); + RowPutChange rowPutChange = new RowPutChange(tableName, pk); + rowPutChange.addColumns(columns); + puts.add(rowPutChange); + + List updates = new ArrayList(); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, pk); + rowUpdateChange.put(columns); + updates.add(rowUpdateChange); + + List deletes = new ArrayList(); + RowDeleteChange rowDeleteChange = new RowDeleteChange(tableName, pk); + deletes.add(rowDeleteChange); + + if (ex == null) { + + BatchWriteRowResponse result = OTSHelper.batchWriteRow(ots, puts, null, null); + assertEquals(0, result.getFailedRows().size()); + + result = OTSHelper.batchWriteRow(ots, null, updates, null); + assertEquals(0, result.getFailedRows().size()); + + result = OTSHelper.batchWriteRow(ots, null, null, deletes); + assertEquals(0, result.getFailedRows().size()); + + } else { + + BatchWriteRowResponse result = OTSHelper.batchWriteRow(ots, puts, null, null); + assertEquals(result.getFailedRows().get(0).getError().getCode(), ex.getErrorCode()); + assertEquals(result.getFailedRows().get(0).getError().getMessage(), ex.getMessage()); + + result = OTSHelper.batchWriteRow(ots, null, updates, null); + assertEquals(result.getFailedRows().get(0).getError().getCode(), ex.getErrorCode()); + assertEquals(result.getFailedRows().get(0).getError().getMessage(), ex.getMessage()); + + result = OTSHelper.batchWriteRow(ots, null, null, deletes); + assertEquals(result.getFailedRows().get(0).getError().getCode(), ex.getErrorCode()); + assertEquals(result.getFailedRows().get(0).getError().getMessage(), ex.getMessage()); + + } + + } + + private void checkBatchWriteRowForException(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, TableStoreException ex) { + List columns = new ArrayList(); + columns.add(new Column(columnName, ColumnValue.fromString("col_value"), 1L)); + List puts = new ArrayList(); + RowPutChange rowPutChange = new RowPutChange(tableName, pk); + rowPutChange.addColumns(columns); + puts.add(rowPutChange); + + List updates = new ArrayList(); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, pk); + rowUpdateChange.put(columns); + updates.add(rowUpdateChange); + + List deletes = new ArrayList(); + RowDeleteChange rowDeleteChange = new RowDeleteChange(tableName, pk); + deletes.add(rowDeleteChange); + + if (ex == null) { + + BatchWriteRowResponse result = OTSHelper.batchWriteRow(ots, puts, null, null); + assertEquals(0, result.getFailedRows().size()); + + result = OTSHelper.batchWriteRow(ots, null, updates, null); + assertEquals(0, result.getFailedRows().size()); + + result = OTSHelper.batchWriteRow(ots, null, null, deletes); + assertEquals(0, result.getFailedRows().size()); + + } else { + + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ex, e); + } + + try { + OTSHelper.batchWriteRow(ots, null, updates, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ex, e); + } + + try { + OTSHelper.batchWriteRow(ots, null, null, deletes); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ex, e); + } + } + + } + + private void checkBatchWriteRowNoDeleteForException(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, TableStoreException ex) { + List columns = new ArrayList(); + columns.add(new Column(columnName, ColumnValue.fromString("col_value"), 1L)); + List puts = new ArrayList(); + RowPutChange rowPutChange = new RowPutChange(tableName, pk); + rowPutChange.addColumns(columns); + puts.add(rowPutChange); + + List updates = new ArrayList(); + RowUpdateChange rowUpdateChange = new RowUpdateChange(tableName, pk); + rowUpdateChange.put(columns); + updates.add(rowUpdateChange); + + List deletes = new ArrayList(); + RowDeleteChange rowDeleteChange = new RowDeleteChange(tableName, pk); + deletes.add(rowDeleteChange); + + if (ex == null) { + + BatchWriteRowResponse result = OTSHelper.batchWriteRow(ots, puts, null, null); + assertEquals(0, result.getFailedRows().size()); + + result = OTSHelper.batchWriteRow(ots, null, updates, null); + assertEquals(0, result.getFailedRows().size()); + + result = OTSHelper.batchWriteRow(ots, null, null, deletes); + assertEquals(0, result.getFailedRows().size()); + + } else { + + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ex, e); + } + + try { + OTSHelper.batchWriteRow(ots, null, updates, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ex, e); + } + } + + } + + private BatchGetRowResponse checkBatchGetRow(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, Exception ex) { + List criterias = new ArrayList(); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + criteria.addColumnsToGet(columnName); + criteria.addRow(pk); + criteria.setMaxVersions(Integer.MAX_VALUE); + criterias.add(criteria); + + if (ex == null) { + return OTSHelper.batchGetRow(ots, criterias); + } else { + try { + List ss = OTSHelper.batchGetRow(ots, criterias).getFailedRows(); + System.out.println(ss.size()); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + return null; + } + } + + private BatchGetRowResponse checkBatchGetRowForException(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName, TableStoreException ex) { + List criterias = new ArrayList(); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + criteria.addColumnsToGet(columnName); + criteria.addRow(pk); + criteria.setMaxVersions(Integer.MAX_VALUE); + criterias.add(criteria); + + if (ex == null) { + return OTSHelper.batchGetRow(ots, criterias); + } else { + + List ss = OTSHelper.batchGetRow(ots, criterias).getFailedRows(); + Error err = ss.get(0).getError(); + assertEquals(ex.getErrorCode(), err.getCode()); + assertEquals(ex.getMessage(), err.getMessage()); + return null; + } + } + + private GetRangeResponse checkGetRange(SyncClientInterface ots, RangeRowQueryCriteria criteria, Exception ex) { + if (ex == null) { + return OTSHelper.getRange(ots, criteria); + } else { + try { + OTSHelper.getRange(ots, criteria); + fail(); + } catch (Exception e) { + checkException(ex, e); + } + return null; + } + } + + + /** + * 测试所有相关API中表名为空,'0', '#', '中文', 'T#', 'T中文', '3t', '-'的情况, + * 期望返回ErrorCode: OTSParameterInvalid + */ + @Test + public void testInvalidTableName() { + String tableNames[] = {"0", "#", "中文", "T#", "T中文", "3t", "-"}; + String columnName = "col_name"; + for (int i = 0; i < tableNames.length; i++) { + String tableName = tableNames[i]; + + String mesg = String.format("Invalid table name: '%s'.", tableNames[i]); + + TableStoreException expect = new TableStoreException(mesg, null, ErrorCode.INVALID_PARAMETER, null, 400); + + checkCreateTable(ots, tableName, expect); + + checkUpdateTable(ots, tableName, expect); + + checkDescribeTable(ots, tableName, expect); + + checkDeleteTable(ots, tableName, expect); + + checkPutRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkUpdateRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkDeleteRow(ots, tableName, getPrimaryKey(), expect); + + checkBatchGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkBatchWriteRowForException(ots, tableName, getPrimaryKey(), columnName, expect); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(getPrimaryKey("1")); + criteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + checkGetRange(ots, criteria, expect); + } + } + + /** + * 测试所有相关API中表名为'_0', '_T', 'A0'的情况,期望操作成功 + */ + @Test + public void testValidTableName() { + + String tableNames[] = {"_0", "_T", "A0"}; + String columnName = "col_name"; + List expectColumns = new ArrayList(); + expectColumns.add(new Column(columnName, ColumnValue.fromString("col_value"))); + + for (int i = 0; i < tableNames.length; i++) { + String tableName = tableNames[i]; + + TableStoreException expect = null; + + checkCreateTable(ots, tableName, expect); + + Utils.sleepSeconds(OTSTestConst.UPDATE_TABLE_SLEEP_IN_SECOND); + + checkUpdateTable(ots, tableName, expect); + + checkDescribeTable(ots, tableName, expect); + + checkDeleteTable(ots, tableName, expect); + + checkCreateTable(ots, tableName, expect); + + Utils.waitForPartitionLoad(tableName); + + checkPutRow(ots, tableName, getPrimaryKey(), columnName, expect); + + GetRowResponse getRowResult = checkGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + Utils.checkColumns(getRowResult.getRow().getColumns(), expectColumns, false); + + checkUpdateRow(ots, tableName, getPrimaryKey(), columnName, expect); + + BatchGetRowResponse batchGetRowResult = checkBatchGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + Utils.checkColumns(batchGetRowResult.getSucceedRows().get(0).getRow().getColumns(), expectColumns, false); + + checkDeleteRow(ots, tableName, getPrimaryKey(), expect); + + checkBatchWriteRow(ots, tableName, getPrimaryKey(), columnName, expect); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(getPrimaryKey("1")); + criteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + criteria.setMaxVersions(Integer.MAX_VALUE); + checkGetRange(ots, criteria, expect); + } + } + + /** + * 测试使用非法的列名时,期望得到OTSParameterInvalid + */ + @Test + public void testInvalidColumnName() { + + // createTable + createTable(3); + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 256; i++) { + sb.append('a'); + } + + String columnNames[] = {sb.toString(), "#", "#abc", "#阿里巴巴", "# "}; + for (int i = 0; i < columnNames.length; i++) { + String columnName = columnNames[i]; + + String msg = String.format("Invalid column name: '%s'.", columnName); + + TableStoreException expect = new TableStoreException(msg, null, ErrorCode.INVALID_PARAMETER, null, 400); + + checkPutRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkUpdateRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkBatchGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + + checkBatchWriteRowNoDeleteForException(ots, tableName, getPrimaryKey(), columnName, expect); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(getPrimaryKey("1")); + criteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + criteria.setMaxVersions(Integer.MAX_VALUE); + criteria.addColumnsToGet(columnName); + checkGetRange(ots, criteria, expect); + + { + // check filter + SingleRowQueryCriteria singleRowCriteria = new SingleRowQueryCriteria(tableName, getPrimaryKey()); + singleRowCriteria.setMaxVersions(100); + singleRowCriteria.addColumnsToGet("abc"); + SingleColumnValueFilter filter = new SingleColumnValueFilter(columnName, SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false)); + singleRowCriteria.setFilter(filter); + try { + OTSHelper.getRow(ots, singleRowCriteria); + fail(); + } catch (TableStoreException e) { + checkException(e, expect); + } + } + } + } + + /** + * 测试使用合法的列名操作,期望操作成功。 + */ + @Test + public void testValidColumnName() { + + // createTable + createTable(3); + + List columnNames = new ArrayList(); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 255; i++) { + sb.append('a'); + } + columnNames.add(sb.toString()); + columnNames.add("阿里巴巴"); + + char[] specialChar = {'.', ':', '\'', '"', '$', '&', '*', '(', ')', '/', '\\', '\n', '\r', ' '}; + for (int i = 0; i < specialChar.length; i++) { + char c = specialChar[i]; + columnNames.add("" + c + "abc"); // start with it and length > 1 + columnNames.add("abc" + c); // end with it and length > 1 + columnNames.add("" + c); // length = 1 + columnNames.add("a" + c + "b"); // contains it + } + + for (int i = 0; i < columnNames.size(); i++) { + String columnName = columnNames.get(i); + + List columnsExpect = new ArrayList(); + columnsExpect.add(new Column(columnName, ColumnValue.fromString("col_value"))); + + TableStoreException expect = null; + + checkPutRow(ots, tableName, getPrimaryKey(), columnName, expect); + + GetRowResponse getRowResult = checkGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + Utils.checkColumns(getRowResult.getRow().getColumns(), columnsExpect, false); + + checkUpdateRow(ots, tableName, getPrimaryKey(), columnName, expect); + + BatchGetRowResponse batchGetRowResult = checkBatchGetRow(ots, tableName, getPrimaryKey(), columnName, expect); + Utils.checkColumns(batchGetRowResult.getSucceedRows().get(0).getRow().getColumns(), columnsExpect, false); + + checkBatchWriteRow(ots, tableName, getPrimaryKey(), columnName, expect); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(getPrimaryKey("1")); + criteria.setExclusiveEndPrimaryKey(getPrimaryKey("2")); + criteria.setMaxVersions(Integer.MAX_VALUE); + criteria.addColumnsToGet(columnName); + GetRangeResponse getRangeResult = checkGetRange(ots, criteria, expect); + assertEquals(getRangeResult.getRows().size(), 0); + + checkReadWrite(ots, tableName, getPrimaryKey(), columnName); + } + } + + private void checkReadWrite(SyncClientInterface ots, String tableName, PrimaryKey pk, String columnName) { + List columns = new ArrayList(); + ColumnValue cv = ColumnValue.fromString("col_value"); + ColumnValue cv2 = ColumnValue.fromString("col_value_2"); + ColumnValue cv3 = ColumnValue.fromString("col_value_3"); + + columns.add(new Column(columnName, cv, 1L)); + + // put on row + OTSHelper.putRow(ots, tableName, pk, columns); + + // get and check + GetRowResponse result = OTSHelper.getRowForAll(ots, tableName, pk); + checkRowContainsColumn(result.getRow(), columnName, cv); + + // update and delete the column + RowUpdateChange rowUpdate = new RowUpdateChange(tableName, pk); + rowUpdate.deleteColumns(columnName); + OTSHelper.updateRow(ots, rowUpdate); + + // get and check + result = OTSHelper.getRowForAll(ots, tableName, pk); + + // update and put the same column + rowUpdate = new RowUpdateChange(tableName, pk); + rowUpdate.put(columnName, cv2); + OTSHelper.updateRow(ots, rowUpdate); + + // get and check + result = OTSHelper.getRowForAll(ots, tableName, pk); + checkRowContainsColumn(result.getRow(), columnName, cv2); + + // batch write rows with update (put + delete) + { + List rowUpdateChanges = new ArrayList(); + rowUpdate = new RowUpdateChange(tableName, pk); + rowUpdate.deleteColumns(columnName); + rowUpdateChanges.add(rowUpdate); + BatchWriteRowResponse bwr = OTSHelper.batchWriteRow(ots, null, rowUpdateChanges, null); + assertEquals(bwr.getFailedRows().size(), 0); + // get and check + result = OTSHelper.getRowForAll(ots, tableName, pk); + + rowUpdateChanges.clear(); + rowUpdate = new RowUpdateChange(tableName, pk); + rowUpdate.put(columnName, cv2); + rowUpdateChanges.add(rowUpdate); + bwr = OTSHelper.batchWriteRow(ots, null, rowUpdateChanges, null); + assertEquals(bwr.getFailedRows().size(), 0); + + // get and check + result = OTSHelper.getRowForAll(ots, tableName, pk); + checkRowContainsColumn(result.getRow(), columnName, cv2); + } + + // batch write rows with put + int start = 1111; + int end = 1121; + List pks = new ArrayList(); + for (int i = start; i < end; i++) { + pks.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn( + pk.getPrimaryKeyColumn(0).getName(), PrimaryKeyValue.fromString(Integer.toString(i))).build()); + } + + { + List rowPutChanges = new ArrayList(); + for (PrimaryKey tmp : pks) { + RowPutChange rowChange = new RowPutChange(tableName, tmp); + rowChange.addColumn(columnName, cv3); + rowPutChanges.add(rowChange); + } + BatchWriteRowResponse bwr = OTSHelper.batchWriteRow(ots, rowPutChanges, null, null); + assertEquals(bwr.getFailedRows().size(), 0); + } + + // batch get rows and check + { + MultiRowQueryCriteria mrc = new MultiRowQueryCriteria(tableName); + for (PrimaryKey tmp : pks) { + mrc.addRow(tmp); + } + mrc.addColumnsToGet(columnName); + mrc.setMaxVersions(1000); + + BatchGetRowRequest bgr = new BatchGetRowRequest(); + bgr.addMultiRowQueryCriteria(mrc); + BatchGetRowResponse bgrr = ots.batchGetRow(bgr); + assertEquals(bgrr.getFailedRows().size(), 0); + List rs = bgrr.getSucceedRows(); + for (int i = 0; i < rs.size(); i++) { + assertEquals(rs.get(i).getRow().getPrimaryKey(), pks.get(i)); + checkRowContainsColumn(rs.get(i).getRow(), columnName, cv3); + } + } + + // get range and check + { + RangeRowQueryCriteria rrc = new RangeRowQueryCriteria(tableName); + rrc.setInclusiveStartPrimaryKey(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn( + pk.getPrimaryKeyColumn(0).getName(), PrimaryKeyValue.fromString(Integer.toString(start))).build()); + rrc.setExclusiveEndPrimaryKey(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn( + pk.getPrimaryKeyColumn(0).getName(), PrimaryKeyValue.fromString(Integer.toString(end))).build()); + rrc.setMaxVersions(1000); + rrc.addColumnsToGet(columnName); + + GetRangeResponse grr = OTSHelper.getRange(ots, rrc); + assertEquals(grr.getRows().size(), end - start); + for (int i = 0; i < end - start; i++) { + assertEquals(grr.getRows().get(i).getPrimaryKey(), pks.get(i)); + checkRowContainsColumn(grr.getRows().get(i), columnName, cv3); + } + } + } + + private void checkRowContainsColumn(Row row, String columnName, ColumnValue cv) { + assertTrue(row != null); + List cs = row.getColumn(columnName); + assertTrue(!cs.isEmpty()); + assertEquals(cs.size(), 1); + assertEquals(cs.get(0).getValue(), cv); + } + + /** + * 测试使用VT_INF_MIN或VT_INF_MAX作为PK操作,期望得到OTSParameterInvalid. + */ + @Test + public void testInvalidPrimaryKey() { + // createTable + createTable(3); + + List pks = new ArrayList(); + List primaryKey = new ArrayList(); + primaryKey.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN)); + pks.add(new PrimaryKey(primaryKey)); + + primaryKey = new ArrayList(); + primaryKey.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX)); + pks.add(new PrimaryKey(primaryKey)); + + { + PrimaryKey pk = pks.get(0); + String columnName = "col_name"; + + TableStoreException expect = new TableStoreException("VT_INF_MIN is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkPutRow(ots, tableName, pk, columnName, expect); + + TableStoreException expect1 = new TableStoreException("VT_INF_MIN is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkGetRow(ots, tableName, pk, columnName, expect1); + + expect = new TableStoreException("VT_INF_MIN is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkUpdateRow(ots, tableName, pk, columnName, expect); + + expect = new TableStoreException("VT_INF_MIN is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkDeleteRow(ots, tableName, pk, expect); + + checkBatchGetRow(ots, tableName, pk, columnName, expect1); + + expect = new TableStoreException("VT_INF_MIN is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkBatchWriteRowForException(ots, tableName, pk, columnName, expect); + } + + { + PrimaryKey pk = pks.get(1); + String columnName = "col_name"; + + TableStoreException expect = new TableStoreException("VT_INF_MAX is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkPutRow(ots, tableName, pk, columnName, expect); + + TableStoreException expect1 = new TableStoreException("VT_INF_MAX is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkGetRow(ots, tableName, pk, columnName, expect1); + + expect = new TableStoreException("VT_INF_MAX is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkUpdateRow(ots, tableName, pk, columnName, expect); + + expect = new TableStoreException("VT_INF_MAX is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkDeleteRow(ots, tableName, pk, expect); + + checkBatchGetRow(ots, tableName, pk, columnName, expect1); + + expect = new TableStoreException("VT_INF_MAX is an invalid type for the primary key.", null, ErrorCode.INVALID_PARAMETER, "", 400); + checkBatchWriteRowForException(ots, tableName, pk, columnName, expect); + } + } + + /** + * 创建一个表,包含3个主键列,类型为INTEGER, STRING, BINARY。 + * GetRange操作,start pk 与 end pk相等,期望返回 OTSParameterInvalid + */ + @Test + public void testGetRangeWhenStartPkEqualsEndPk() { + // createTable + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("pk_0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk_1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk_2", PrimaryKeyType.BINARY); + OTSHelper.createTable(ots, tableMeta, new CapacityUnit(0, 0), null); + + Utils.waitForPartitionLoad(tableName); + + List primaryKeyColumns = new ArrayList(); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(10))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_1", PrimaryKeyValue.fromString("pk"))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_2", PrimaryKeyValue.fromBinary("pk".getBytes()))); + + PrimaryKey primaryKey = new PrimaryKey(primaryKeyColumns); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException ex) { + TableStoreException expect = new TableStoreException("Begin key must less than end key in FORWARD", null, ErrorCode.INVALID_PARAMETER, "", 400); + assertTableStoreException(expect, ex); + } + } + + /** + * 创建一个表,包含4个主键列,分别为 PK0 INTEGER, PK1 INTEGER, PK2 STRING, PK3 BINARY。 + * 测试所有数据操作API,分别用以下的PK顺序和类型: + * a) PK1 INTEGER, PK0 INTEGER, PK2 STRING, PK3 BINARY + * b) PK0 INTEGER, PK2 INTEGER, PK1 STRING, PK3 BINARY + * c) PK0 INTEGER, PK2 STRING, PK1 INTEGER, PK3 BINARY + * d) PK0 BINARY, PK1 INTEGER, PK2 STRING, PK3 BINARY + * e) PK3 BINARY, PK1 INTEGER, PK2 STRING, PK0 INTEGER。期望返回 OTSParameterInvalid + */ + @Test + public void testInvalidPkOrder() { + + // createTable + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("pk_0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk_1", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk_2", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk_3", PrimaryKeyType.BINARY); + OTSHelper.createTable(ots, tableMeta, new CapacityUnit(0, 0), null); + + Utils.waitForPartitionLoad(tableName); + + List primaryKeyColumns = new ArrayList(); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(100))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_1", PrimaryKeyValue.fromLong(0))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_2", PrimaryKeyValue.fromString("pk"))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_3", PrimaryKeyValue.fromBinary("pk".getBytes()))); + PrimaryKey primaryKeyEnd = new PrimaryKey(primaryKeyColumns); + + List primaryKeys = new ArrayList(); + List errorMsgs = new ArrayList(); + + // a) PK1 INTEGER, PK0 INTEGER, PK2 STRING, PK3 BINARY + primaryKeyColumns = new ArrayList(); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_1", PrimaryKeyValue.fromLong(1))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_2", PrimaryKeyValue.fromString(""))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_3", PrimaryKeyValue.fromBinary("pk".getBytes()))); + + primaryKeys.add(new PrimaryKey(primaryKeyColumns)); + errorMsgs.add("Validate PK name fail. Input: pk_1, Meta: pk_0."); + + // b) PK0 INTEGER, PK2 INTEGER, PK1 STRING, PK3 BINARY + primaryKeyColumns = new ArrayList(); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(1))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_2", PrimaryKeyValue.fromLong(2))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_1", PrimaryKeyValue.fromString(""))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_3", PrimaryKeyValue.fromBinary("".getBytes()))); + + primaryKeys.add(new PrimaryKey(primaryKeyColumns)); + errorMsgs.add("Validate PK name fail. Input: pk_2, Meta: pk_1."); + + // c) PK0 INTEGER, PK2 STRING, PK1 INTEGER, PK3 BINARY + primaryKeyColumns = new ArrayList(); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_2", PrimaryKeyValue.fromString(""))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_1", PrimaryKeyValue.fromLong(1))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_3", PrimaryKeyValue.fromBinary("".getBytes()))); + + primaryKeys.add(new PrimaryKey(primaryKeyColumns)); + errorMsgs.add("Validate PK name fail. Input: pk_2, Meta: pk_1."); + + // d) PK0 BINARY, PK1 INTEGER, PK2 STRING, PK3 BINARY + primaryKeyColumns = new ArrayList(); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromBinary("".getBytes()))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_1", PrimaryKeyValue.fromLong(1))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_2", PrimaryKeyValue.fromString(""))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_3", PrimaryKeyValue.fromBinary("".getBytes()))); + + primaryKeys.add(new PrimaryKey(primaryKeyColumns)); + errorMsgs.add("Validate PK type fail. Input: VT_BLOB, Meta: VT_INTEGER."); + + // e) PK3 BINARY, PK1 INTEGER, PK2 STRING, PK0 INTEGER。 + primaryKeyColumns = new ArrayList(); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_3", PrimaryKeyValue.fromBinary("".getBytes()))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_1", PrimaryKeyValue.fromLong(1))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_2", PrimaryKeyValue.fromString(""))); + primaryKeyColumns.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(1))); + + primaryKeys.add(new PrimaryKey(primaryKeyColumns)); + errorMsgs.add("Validate PK name fail. Input: pk_3, Meta: pk_0."); + + int index = 0; + for (PrimaryKey primaryKey : primaryKeys) { + TableStoreException expect = new TableStoreException(errorMsgs.get(index++), null, ErrorCode.INVALID_PK, "", 400); + checkPutRow(ots, tableName, primaryKey, "col_name", expect); + + checkGetRow(ots, tableName, primaryKey, "col_name", expect); + + checkUpdateRow(ots, tableName, primaryKey, "col_name", expect); + + checkDeleteRow(ots, tableName, primaryKey, expect); + + checkBatchGetRowForException(ots, tableName, primaryKey, "col_name", expect); + + checkBatchWriteRow(ots, tableName, primaryKey, "col_name", expect); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKeyEnd); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + checkGetRange(ots, rangeRowQueryCriteria, expect); + } + } + + /** + * 创建一张表,不指定table options中的TLL时期望SDK抛错或者返回OTSParameterInvalid + * 创建一张表,不指定table options的MaxVersion时期望SDK抛错或者返回OTSParameterInvalid + */ + @Test + public void testNotSetTTLOrNotSetMaxVersions() { + List pks = new ArrayList(); + pks.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(pks); + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(3); + try { + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), + tableOptions); + fail(); + } catch (IllegalArgumentException ex) { + assertEquals("The maxVersions and timeToLive must be set while creating table.", ex.getMessage()); + } + + pks = new ArrayList(); + pks.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(pks); + tableOptions = new TableOptions(); + tableOptions.setTimeToLive(-1); + try { + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), + tableOptions); + fail(); + } catch (IllegalArgumentException ex) { + assertEquals("The maxVersions and timeToLive must be set while creating table.", ex.getMessage()); + } + } + + /** + * GetRow/GetRange/BatchGetRow中,不指定version相关参数时,返回错误。 + */ + @Test + public void testNotSetVersionOptionsInGetOperations() { + // createTable + createTable(3); + + TableStoreException expect = new TableStoreException("No version condition is specified.", null, ErrorCode.INVALID_PARAMETER, "", 400); + + // getRow + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName, getPrimaryKey()); + try { + OTSHelper.getRow(ots, rowQueryCriteria); + fail(); + } catch (TableStoreException ex) { + assertTableStoreException(expect, ex); + } + + // getRange + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getPrimaryKey("")); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(getPrimaryKey("A")); + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException ex) { + assertTableStoreException(expect, ex); + } + + // batchGetRow + List multiRowQueryCriterias = new ArrayList(); + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + multiRowQueryCriteria.addRow(getPrimaryKey()); + multiRowQueryCriterias.add(multiRowQueryCriteria); + try { + OTSHelper.batchGetRow(ots, multiRowQueryCriterias); + fail(); + } catch (TableStoreException ex) { + expect = new TableStoreException("No version condition is specified while querying row.", null, ErrorCode.INVALID_PARAMETER, "", 400); + assertTableStoreException(expect, ex); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/RestrictedItemTest.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/RestrictedItemTest.java new file mode 100644 index 0000000..b61a830 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/RestrictedItemTest.java @@ -0,0 +1,4761 @@ +package com.alicloud.openservices.tablestore.functiontest; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.BatchGetRowResponse.RowResult; +import com.alicloud.openservices.tablestore.common.*; +import com.google.gson.JsonSyntaxException; + +public class RestrictedItemTest extends BaseFT { + + private static String tableName = "RestrictedItemFunctiontest"; + private static SyncClientInterface ots; + private static final Logger LOG = LoggerFactory.getLogger(RestrictedItemTest.class); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + ots.shutdown(); + } + + @Before + public void setup() throws Exception { + // 清理环境 + OTSHelper.deleteAllTable(ots); + } + + @After + public void teardown() {} + + public static DescribeTableResponse buildDescribeTableResult(Table t) { + DescribeTableResponse r = new DescribeTableResponse(new Response()); + r.setTableMeta(t.getMeta()); + r.setReservedThroughputDetails( + new ReservedThroughputDetails( + t.getReservedThroughput().getCapacityUnit(), + 1, + 1 + )); + r.setTableOptions(t.getTableOptions()); + return r; + } + + /** + * 设定MaxVersion=3, 对于不同类型的属性列(INTEGER/BINARY/STRING/BOOLEAN/DOUBLE), + * PutRow/UpdateRow/BatchWriteRow的put或者update操作,同一个属性列并且带有3个version, + * GetRow读出,并校验; + * @throws UnsupportedEncodingException + */ + @Test + public void testCase3() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme, -1, 3); + + Utils.waitForPartitionLoad(tableName); + + long ts = (new Date()).getTime(); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(0)) + .build(); + + {// put row + List columns = new ArrayList(); + for (int i = 0; i < 3; i++) { + columns.add(new Column("attr_0", ColumnValue.fromLong(i), ts + i)); + columns.add(new Column("attr_1", ColumnValue.fromString(String.valueOf(i)), ts + i)); + columns.add(new Column("attr_2", ColumnValue.fromDouble(i), ts + i)); + columns.add(new Column("attr_3", ColumnValue.fromBoolean(true), ts + i)); + columns.add(new Column("attr_4", ColumnValue.fromBinary((String.valueOf(i)).getBytes("UTF-8")), ts + i)); + } + OTSHelper.putRow(ots, tableName, pk, columns); + + // + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(15, cols.length); // 5(column) * 3(version) + + // attr 0 + assertEquals("attr_0", cols[0].getName()); + assertEquals(2, cols[0].getValue().asLong()); + assertEquals(ts + 2, cols[0].getTimestamp()); + + assertEquals("attr_0", cols[1].getName()); + assertEquals(1, cols[1].getValue().asLong()); + assertEquals(ts + 1, cols[1].getTimestamp()); + + assertEquals("attr_0", cols[2].getName()); + assertEquals(0, cols[2].getValue().asLong()); + assertEquals(ts + 0, cols[2].getTimestamp()); + + // attr 1 + assertEquals("attr_1", cols[3].getName()); + assertEquals("2", cols[3].getValue().asString()); + assertEquals(ts + 2, cols[3].getTimestamp()); + + assertEquals("attr_1", cols[4].getName()); + assertEquals("1", cols[4].getValue().asString()); + assertEquals(ts + 1, cols[4].getTimestamp()); + + assertEquals("attr_1", cols[5].getName()); + assertEquals("0", cols[5].getValue().asString()); + assertEquals(ts + 0, cols[5].getTimestamp()); + + // attr 2 + assertEquals("attr_2", cols[6].getName()); + assertEquals(true, 2 == cols[6].getValue().asDouble()); + assertEquals(ts + 2, cols[6].getTimestamp()); + + assertEquals("attr_2", cols[7].getName()); + assertEquals(true, 1 == cols[7].getValue().asDouble()); + assertEquals(ts + 1, cols[7].getTimestamp()); + + assertEquals("attr_2", cols[8].getName()); + assertEquals(true, 0 == cols[8].getValue().asDouble()); + assertEquals(ts + 0, cols[8].getTimestamp()); + + // attr 3 + assertEquals("attr_3", cols[9].getName()); + assertEquals(true, cols[9].getValue().asBoolean()); + assertEquals(ts + 2, cols[9].getTimestamp()); + + assertEquals("attr_3", cols[10].getName()); + assertEquals(true, cols[10].getValue().asBoolean()); + assertEquals(ts + 1, cols[10].getTimestamp()); + + assertEquals("attr_3", cols[11].getName()); + assertEquals(true, cols[11].getValue().asBoolean()); + assertEquals(ts + 0, cols[11].getTimestamp()); + + // attr 4 + assertEquals("attr_4", cols[12].getName()); + assertEquals("2", new String(cols[12].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 2, cols[12].getTimestamp()); + + assertEquals("attr_4", cols[13].getName()); + assertEquals("1", new String(cols[13].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 1, cols[13].getTimestamp()); + + assertEquals("attr_4", cols[14].getName()); + assertEquals("0", new String(cols[14].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 0, cols[14].getTimestamp()); + } + + {// Update row + + List columns = new ArrayList(); + for (int i = 0; i < 3; i++) { + columns.add(new Column("attr_0", ColumnValue.fromLong(i + 1), ts + i)); + columns.add(new Column("attr_1", ColumnValue.fromString(String.valueOf(i + 1)), ts + i)); + columns.add(new Column("attr_2", ColumnValue.fromDouble(i + 1), ts + i)); + columns.add(new Column("attr_3", ColumnValue.fromBoolean(false), ts + i)); + columns.add(new Column("attr_4", ColumnValue.fromBinary((String.valueOf(i + 1)).getBytes("UTF-8")), ts + i)); + } + + OTSHelper.updateRow(ots, tableName, pk, columns, null, null); + // + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(15, cols.length); // 5(column) * 3(version) + + // attr 0 + assertEquals("attr_0", cols[0].getName()); + assertEquals(3, cols[0].getValue().asLong()); + assertEquals(ts + 2, cols[0].getTimestamp()); + + assertEquals("attr_0", cols[1].getName()); + assertEquals(2, cols[1].getValue().asLong()); + assertEquals(ts + 1, cols[1].getTimestamp()); + + assertEquals("attr_0", cols[2].getName()); + assertEquals(1, cols[2].getValue().asLong()); + assertEquals(ts + 0, cols[2].getTimestamp()); + + // attr 1 + assertEquals("attr_1", cols[3].getName()); + assertEquals("3", cols[3].getValue().asString()); + assertEquals(ts + 2, cols[3].getTimestamp()); + + assertEquals("attr_1", cols[4].getName()); + assertEquals("2", cols[4].getValue().asString()); + assertEquals(ts + 1, cols[4].getTimestamp()); + + assertEquals("attr_1", cols[5].getName()); + assertEquals("1", cols[5].getValue().asString()); + assertEquals(ts + 0, cols[5].getTimestamp()); + + // attr 2 + assertEquals("attr_2", cols[6].getName()); + assertEquals(true, 3 == cols[6].getValue().asDouble()); + assertEquals(ts + 2, cols[6].getTimestamp()); + + assertEquals("attr_2", cols[7].getName()); + assertEquals(true, 2 == cols[7].getValue().asDouble()); + assertEquals(ts + 1, cols[7].getTimestamp()); + + assertEquals("attr_2", cols[8].getName()); + assertEquals(true, 1 == cols[8].getValue().asDouble()); + assertEquals(ts + 0, cols[8].getTimestamp()); + + // attr 3 + assertEquals("attr_3", cols[9].getName()); + assertEquals(false, cols[9].getValue().asBoolean()); + assertEquals(ts + 2, cols[9].getTimestamp()); + + assertEquals("attr_3", cols[10].getName()); + assertEquals(false, cols[10].getValue().asBoolean()); + assertEquals(ts + 1, cols[10].getTimestamp()); + + assertEquals("attr_3", cols[11].getName()); + assertEquals(false, cols[11].getValue().asBoolean()); + assertEquals(ts + 0, cols[11].getTimestamp()); + + // attr 4 + assertEquals("attr_4", cols[12].getName()); + assertEquals("3", new String(cols[12].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 2, cols[12].getTimestamp()); + + assertEquals("attr_4", cols[13].getName()); + assertEquals("2", new String(cols[13].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 1, cols[13].getTimestamp()); + + assertEquals("attr_4", cols[14].getName()); + assertEquals("1", new String(cols[14].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 0, cols[14].getTimestamp()); + } + + {// Batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + for (int i = 0; i < 3; i++) { + put.addColumn(new Column("attr_0", ColumnValue.fromLong(i), ts + i)); + put.addColumn(new Column("attr_1", ColumnValue.fromString(String.valueOf(i)), ts + i)); + put.addColumn(new Column("attr_2", ColumnValue.fromDouble(i), ts + i)); + put.addColumn(new Column("attr_3", ColumnValue.fromBoolean(true), ts + i)); + put.addColumn(new Column("attr_4", ColumnValue.fromBinary(String.valueOf(i).getBytes("UTF-8")), ts + i)); + } + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(15, cols.length); // 5(column) * 3(version) + + // attr 0 + assertEquals("attr_0", cols[0].getName()); + assertEquals(2, cols[0].getValue().asLong()); + assertEquals(ts + 2, cols[0].getTimestamp()); + + assertEquals("attr_0", cols[1].getName()); + assertEquals(1, cols[1].getValue().asLong()); + assertEquals(ts + 1, cols[1].getTimestamp()); + + assertEquals("attr_0", cols[2].getName()); + assertEquals(0, cols[2].getValue().asLong()); + assertEquals(ts + 0, cols[2].getTimestamp()); + + // attr 1 + assertEquals("attr_1", cols[3].getName()); + assertEquals("2", cols[3].getValue().asString()); + assertEquals(ts + 2, cols[3].getTimestamp()); + + assertEquals("attr_1", cols[4].getName()); + assertEquals("1", cols[4].getValue().asString()); + assertEquals(ts + 1, cols[4].getTimestamp()); + + assertEquals("attr_1", cols[5].getName()); + assertEquals("0", cols[5].getValue().asString()); + assertEquals(ts + 0, cols[5].getTimestamp()); + + // attr 2 + assertEquals("attr_2", cols[6].getName()); + assertEquals(true, 2 == cols[6].getValue().asDouble()); + assertEquals(ts + 2, cols[6].getTimestamp()); + + assertEquals("attr_2", cols[7].getName()); + assertEquals(true, 1 == cols[7].getValue().asDouble()); + assertEquals(ts + 1, cols[7].getTimestamp()); + + assertEquals("attr_2", cols[8].getName()); + assertEquals(true, 0 == cols[8].getValue().asDouble()); + assertEquals(ts + 0, cols[8].getTimestamp()); + + // attr 3 + assertEquals("attr_3", cols[9].getName()); + assertEquals(true, cols[9].getValue().asBoolean()); + assertEquals(ts + 2, cols[9].getTimestamp()); + + assertEquals("attr_3", cols[10].getName()); + assertEquals(true, cols[10].getValue().asBoolean()); + assertEquals(ts + 1, cols[10].getTimestamp()); + + assertEquals("attr_3", cols[11].getName()); + assertEquals(true, cols[11].getValue().asBoolean()); + assertEquals(ts + 0, cols[11].getTimestamp()); + + // attr 4 + assertEquals("attr_4", cols[12].getName()); + assertEquals("2", new String(cols[12].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 2, cols[12].getTimestamp()); + + assertEquals("attr_4", cols[13].getName()); + assertEquals("1", new String(cols[13].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 1, cols[13].getTimestamp()); + + assertEquals("attr_4", cols[14].getName()); + assertEquals("0", new String(cols[14].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 0, cols[14].getTimestamp()); + } + { + List updates = new ArrayList(); + RowUpdateChange update = new RowUpdateChange(tableName, pk); + for (int i = 0; i < 3; i++) { + update.put(new Column("attr_0", ColumnValue.fromLong(i + 1), ts + i)); + update.put(new Column("attr_1", ColumnValue.fromString(String.valueOf(i + 1)), ts + i)); + update.put(new Column("attr_2", ColumnValue.fromDouble(i + 1), ts + i)); + update.put(new Column("attr_3", ColumnValue.fromBoolean(false), ts + i)); + update.put(new Column("attr_4", ColumnValue.fromBinary((String.valueOf(i + 1)).getBytes("UTF-8")), ts + i)); + } + updates.add(update); + OTSHelper.batchWriteRowNoLimit(ots, null, updates, null); + + // + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(15, cols.length); // 5(column) * 3(version) + + // attr 0 + assertEquals("attr_0", cols[0].getName()); + assertEquals(3, cols[0].getValue().asLong()); + assertEquals(ts + 2, cols[0].getTimestamp()); + + assertEquals("attr_0", cols[1].getName()); + assertEquals(2, cols[1].getValue().asLong()); + assertEquals(ts + 1, cols[1].getTimestamp()); + + assertEquals("attr_0", cols[2].getName()); + assertEquals(1, cols[2].getValue().asLong()); + assertEquals(ts + 0, cols[2].getTimestamp()); + + // attr 1 + assertEquals("attr_1", cols[3].getName()); + assertEquals("3", cols[3].getValue().asString()); + assertEquals(ts + 2, cols[3].getTimestamp()); + + assertEquals("attr_1", cols[4].getName()); + assertEquals("2", cols[4].getValue().asString()); + assertEquals(ts + 1, cols[4].getTimestamp()); + + assertEquals("attr_1", cols[5].getName()); + assertEquals("1", cols[5].getValue().asString()); + assertEquals(ts + 0, cols[5].getTimestamp()); + + // attr 2 + assertEquals("attr_2", cols[6].getName()); + assertEquals(true, 3 == cols[6].getValue().asDouble()); + assertEquals(ts + 2, cols[6].getTimestamp()); + + assertEquals("attr_2", cols[7].getName()); + assertEquals(true, 2 == cols[7].getValue().asDouble()); + assertEquals(ts + 1, cols[7].getTimestamp()); + + assertEquals("attr_2", cols[8].getName()); + assertEquals(true, 1 == cols[8].getValue().asDouble()); + assertEquals(ts + 0, cols[8].getTimestamp()); + + // attr 3 + assertEquals("attr_3", cols[9].getName()); + assertEquals(false, cols[9].getValue().asBoolean()); + assertEquals(ts + 2, cols[9].getTimestamp()); + + assertEquals("attr_3", cols[10].getName()); + assertEquals(false, cols[10].getValue().asBoolean()); + assertEquals(ts + 1, cols[10].getTimestamp()); + + assertEquals("attr_3", cols[11].getName()); + assertEquals(false, cols[11].getValue().asBoolean()); + assertEquals(ts + 0, cols[11].getTimestamp()); + + // attr 4 + assertEquals("attr_4", cols[12].getName()); + assertEquals("3", new String(cols[12].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 2, cols[12].getTimestamp()); + + assertEquals("attr_4", cols[13].getName()); + assertEquals("2", new String(cols[13].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 1, cols[13].getTimestamp()); + + assertEquals("attr_4", cols[14].getName()); + assertEquals("1", new String(cols[14].getValue().asBinary(), "UTF-8")); + assertEquals(ts + 0, cols[14].getTimestamp()); + } + } + + /** + * 设定MaxVersion=3, 对于不同类型的属性列(INTEGER/BINARY/STRING/BOOLEAN/DOUBLE), + * UpdateRow或者BatchWriteRow的update操作 同一个属性列重复3次,每次写入同一个属性列并不指定 + * timestamp。GetRow读出,并校验; + * @throws UnsupportedEncodingException + */ + @Test + public void testCase4() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme, -1, 3); + + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(0)) + .build(); + + {// UpdateRow + + long ts = System.currentTimeMillis(); + for (int i = 0; i < 3; i++) { + List columns = new ArrayList(); + columns.add(new Column("attr_0", ColumnValue.fromLong(i + 1))); + columns.add(new Column("attr_1", ColumnValue.fromString(String.valueOf(i + 1)))); + columns.add(new Column("attr_2", ColumnValue.fromDouble(i + 1))); + columns.add(new Column("attr_3", ColumnValue.fromBoolean(false))); + columns.add(new Column("attr_4", ColumnValue.fromBinary((String.valueOf(i + 1)).getBytes("UTF-8")))); + OTSHelper.updateRow(ots, tableName, pk, columns, null, null); + } + + // + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(15, cols.length); // 5(column) * 3(version) + + // attr 0 + assertEquals("attr_0", cols[0].getName()); + assertEquals(3, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + + assertEquals("attr_0", cols[1].getName()); + assertEquals(2, cols[1].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[1].getTimestamp()); + + assertEquals("attr_0", cols[2].getName()); + assertEquals(1, cols[2].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[2].getTimestamp()); + + // attr 1 + assertEquals("attr_1", cols[3].getName()); + assertEquals("3", cols[3].getValue().asString()); + checkTimestampWithDeviation(ts, cols[3].getTimestamp()); + + assertEquals("attr_1", cols[4].getName()); + assertEquals("2", cols[4].getValue().asString()); + checkTimestampWithDeviation(ts, cols[4].getTimestamp()); + + assertEquals("attr_1", cols[5].getName()); + assertEquals("1", cols[5].getValue().asString()); + checkTimestampWithDeviation(ts, cols[5].getTimestamp()); + + // attr 2 + assertEquals("attr_2", cols[6].getName()); + assertEquals(true, 3 == cols[6].getValue().asDouble()); + checkTimestampWithDeviation(ts, cols[6].getTimestamp()); + + assertEquals("attr_2", cols[7].getName()); + assertEquals(true, 2 == cols[7].getValue().asDouble()); + checkTimestampWithDeviation(ts, cols[7].getTimestamp()); + + assertEquals("attr_2", cols[8].getName()); + assertEquals(true, 1 == cols[8].getValue().asDouble()); + checkTimestampWithDeviation(ts, cols[8].getTimestamp()); + + // attr 3 + assertEquals("attr_3", cols[9].getName()); + assertEquals(false, cols[9].getValue().asBoolean()); + checkTimestampWithDeviation(ts, cols[9].getTimestamp()); + + assertEquals("attr_3", cols[10].getName()); + assertEquals(false, cols[10].getValue().asBoolean()); + checkTimestampWithDeviation(ts, cols[10].getTimestamp()); + + assertEquals("attr_3", cols[11].getName()); + assertEquals(false, cols[11].getValue().asBoolean()); + checkTimestampWithDeviation(ts, cols[11].getTimestamp()); + + // attr 4 + assertEquals("attr_4", cols[12].getName()); + assertEquals("3", new String(cols[12].getValue().asBinary(), "UTF-8")); + checkTimestampWithDeviation(ts, cols[12].getTimestamp()); + + assertEquals("attr_4", cols[13].getName()); + assertEquals("2", new String(cols[13].getValue().asBinary(), "UTF-8")); + checkTimestampWithDeviation(ts, cols[13].getTimestamp()); + + assertEquals("attr_4", cols[14].getName()); + assertEquals("1", new String(cols[14].getValue().asBinary(), "UTF-8")); + checkTimestampWithDeviation(ts, cols[14].getTimestamp()); + } + + OTSHelper.deleteRow(ots, tableName, pk); + { + long ts = System.currentTimeMillis(); + + for (int i = 0; i < 3; i++) { + List updates = new ArrayList(); + RowUpdateChange update = new RowUpdateChange(tableName, pk); + update.put(new Column("attr_0", ColumnValue.fromLong(i + 1))); + update.put(new Column("attr_1", ColumnValue.fromString(String.valueOf(i + 1)))); + update.put(new Column("attr_2", ColumnValue.fromDouble(i + 1))); + update.put(new Column("attr_3", ColumnValue.fromBoolean(false))); + update.put(new Column("attr_4", ColumnValue.fromBinary((String.valueOf(i + 1)).getBytes("UTF-8")))); + updates.add(update); + OTSHelper.batchWriteRowNoLimit(ots, null, updates, null); + } + + // + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(15, cols.length); // 5(column) * 3(version) + + // attr 0 + assertEquals("attr_0", cols[0].getName()); + assertEquals(3, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + + assertEquals("attr_0", cols[1].getName()); + assertEquals(2, cols[1].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[1].getTimestamp()); + + assertEquals("attr_0", cols[2].getName()); + assertEquals(1, cols[2].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[2].getTimestamp()); + + // attr 1 + assertEquals("attr_1", cols[3].getName()); + assertEquals("3", cols[3].getValue().asString()); + checkTimestampWithDeviation(ts, cols[3].getTimestamp()); + + assertEquals("attr_1", cols[4].getName()); + assertEquals("2", cols[4].getValue().asString()); + checkTimestampWithDeviation(ts, cols[4].getTimestamp()); + + assertEquals("attr_1", cols[5].getName()); + assertEquals("1", cols[5].getValue().asString()); + checkTimestampWithDeviation(ts, cols[5].getTimestamp()); + + // attr 2 + assertEquals("attr_2", cols[6].getName()); + assertEquals(true, 3 == cols[6].getValue().asDouble()); + checkTimestampWithDeviation(ts, cols[6].getTimestamp()); + + assertEquals("attr_2", cols[7].getName()); + assertEquals(true, 2 == cols[7].getValue().asDouble()); + checkTimestampWithDeviation(ts, cols[7].getTimestamp()); + + assertEquals("attr_2", cols[8].getName()); + assertEquals(true, 1 == cols[8].getValue().asDouble()); + checkTimestampWithDeviation(ts, cols[8].getTimestamp()); + + // attr 3 + assertEquals("attr_3", cols[9].getName()); + assertEquals(false, cols[9].getValue().asBoolean()); + checkTimestampWithDeviation(ts, cols[9].getTimestamp()); + + assertEquals("attr_3", cols[10].getName()); + assertEquals(false, cols[10].getValue().asBoolean()); + checkTimestampWithDeviation(ts, cols[10].getTimestamp()); + + assertEquals("attr_3", cols[11].getName()); + assertEquals(false, cols[11].getValue().asBoolean()); + checkTimestampWithDeviation(ts, cols[11].getTimestamp()); + + // attr 4 + assertEquals("attr_4", cols[12].getName()); + assertEquals("3", new String(cols[12].getValue().asBinary(), "UTF-8")); + checkTimestampWithDeviation(ts, cols[12].getTimestamp()); + + assertEquals("attr_4", cols[13].getName()); + assertEquals("2", new String(cols[13].getValue().asBinary(), "UTF-8")); + checkTimestampWithDeviation(ts, cols[13].getTimestamp()); + + assertEquals("attr_4", cols[14].getName()); + assertEquals("1", new String(cols[14].getValue().asBinary(), "UTF-8")); + checkTimestampWithDeviation(ts, cols[14].getTimestamp()); + } + } + + /** + * 测试MaxVersions的最大值为INT32_MAX和最小值为1,调用所有读写接口,期望可以正常读写,验证数据正确性。 + */ + @Test + public void testCase5() { + + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(scheme); + + // max version = 1 + { + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(-1); + + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), tableOptions); + Utils.waitForPartitionLoad(tableName); + + long ts = System.currentTimeMillis(); + // put row + { + // data + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromLong(0))) ; + + OTSHelper.putRow(ots, tableName, pk, columns); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(0, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + List puts = new ArrayList(); + puts.add(new Column("attr", ColumnValue.fromString("0"))) ; + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("0", cols[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + } + + OTSHelper.deleteTable(ots, tableName); + + // max version = INT32_MAX + { + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(Integer.MAX_VALUE); + tableOptions.setTimeToLive(-1); + + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), tableOptions); + Utils.waitForPartitionLoad(tableName); + long ts = System.currentTimeMillis(); + // put row + { + // data + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromLong(0))) ; + + OTSHelper.putRow(ots, tableName, pk, columns); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(0, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + List puts = new ArrayList(); + puts.add(new Column("attr", ColumnValue.fromString("0"))) ; + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(2, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("attr", cols[1].getName()); + assertEquals("0", cols[0].getValue().asString()); + assertEquals(0, cols[1].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + checkTimestampWithDeviation(ts, cols[1].getTimestamp()); + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + } + } + + /** + * 测试TTL的最大值为INT64_MAX和最小值为1,调用所有读写接口,期望可以正常读写,验证数据正确性。 + */ + @Test + public void testCase6() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(scheme); + + // TTL = INT64_MAX + { + TableOptions tableOptions = new TableOptions(); + tableOptions.setTimeToLive(-1); + tableOptions.setMaxVersions(Integer.MAX_VALUE); + + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), tableOptions); + Utils.waitForPartitionLoad(tableName); + // put row + { + // data + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromLong(0))) ; + + OTSHelper.putRow(ots, tableName, pk, columns); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + + assertEquals("attr", cols[0].getName()); + assertEquals(0, cols[0].getValue().asLong()); + checkTimestampWithDeviation(System.currentTimeMillis(), cols[0].getTimestamp()); + } + Utils.sleepSeconds(2); + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + List puts = new ArrayList(); + puts.add(new Column("attr", ColumnValue.fromString("0"))) ; + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(2, cols.length); + + assertEquals("attr", cols[0].getName()); + assertEquals("attr", cols[1].getName()); + assertEquals("0", cols[0].getValue().asString()); + assertEquals(0, cols[1].getValue().asLong()); + checkTimestampWithDeviation(System.currentTimeMillis(), cols[0].getTimestamp()); + checkTimestampWithDeviation(System.currentTimeMillis(), cols[1].getTimestamp()); + } + Utils.sleepSeconds(2); + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + + assertEquals("attr", cols[0].getName()); + assertEquals(1, cols[0].getValue().asLong()); + checkTimestampWithDeviation(System.currentTimeMillis(), cols[0].getTimestamp()); + } + } + } + + /** + * 测试版本的最大值为INT64_MAX和最小值为0,调用所有读写接口,期望可以正常读写,验证数据正确性。 + */ + @Test + public void testCase7() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumns(scheme); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(Integer.MAX_VALUE); + tableOptions.setTimeToLive(-1); + tableOptions.setMaxTimeDeviation(Long.MAX_VALUE / 1000000); + + // TS = 0 + { + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), tableOptions); + Utils.waitForPartitionLoad(tableName); + + // put row + { + // data + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromLong(0), 0)) ; + + OTSHelper.putRow(ots, tableName, pk, columns); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(0, cols[0].getValue().asLong()); + assertEquals(0, cols[0].getTimestamp()); + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + List puts = new ArrayList(); + puts.add(new Column("attr", ColumnValue.fromString("0"), 0)) ; + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("0", cols[0].getValue().asString()); + assertEquals(0, cols[0].getTimestamp()); + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromLong(1), 0); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, cols[0].getValue().asLong()); + assertEquals(0, cols[0].getTimestamp()); + } + } + + OTSHelper.deleteTable(ots, tableName); + OTSHelper.createTable(ots, meta, new CapacityUnit(0, 0), tableOptions); + Utils.waitForPartitionLoad(tableName); + // TS = INT64_MAX + { + // put row + { + // data + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromLong(0), Long.MAX_VALUE/1000 - 1)) ; + + OTSHelper.putRow(ots, tableName, pk, columns); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(0, cols[0].getValue().asLong()); + assertEquals(Long.MAX_VALUE/1000 - 1, cols[0].getTimestamp()); + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + List puts = new ArrayList(); + puts.add(new Column("attr", ColumnValue.fromString("0"), Long.MAX_VALUE/1000 - 1)) ; + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("0", cols[0].getValue().asString()); + assertEquals(Long.MAX_VALUE/1000 - 1, cols[0].getTimestamp()); + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromLong(1), Long.MAX_VALUE/1000 - 1); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, cols[0].getValue().asLong()); + assertEquals(Long.MAX_VALUE/1000 - 1, cols[0].getTimestamp()); + } + } + } + + /** + * 对于每个参数包含TableName的API,TableName长度为 MaxLength + 1,期望返回ErrorCode: + * @throws Exception + */ + @Test + public void testCase10() throws Exception { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.TABLE_NAME_LENGTH_MAX + 1; i++) { + sb.append("a"); + } + String tableName = sb.toString(); + + // create table + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + try { + OTSHelper.createTable(ots, tableName, pk); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // UpdateTable + { + ReservedThroughput reservedThroughputForUpdate = new ReservedThroughput(); + TableOptions tableOptionsForUpdate = new TableOptions(); + try { + OTSHelper.updateTable(ots, tableName, reservedThroughputForUpdate, tableOptionsForUpdate); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // DescribeTable + { + try { + OTSHelper.describeTable(ots, tableName); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // delete table + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + try { + OTSHelper.deleteTable(ots, tableName); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // put row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + try { + OTSHelper.putRow(ots, tableName, pk, Collections. emptyList()); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + try { + OTSHelper.getRowForAll(ots, tableName, pk); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + List puts = new ArrayList(); + puts.add(new Column("attr", ColumnValue.fromLong(1))); + try { + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // delete row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + try { + OTSHelper.deleteRow(ots, tableName, pk); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // batch get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + List primaryKeys = new ArrayList(); + primaryKeys.add(pk); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + criterias.add(c); + try { + OTSHelper.batchGetRow(ots, criterias); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + puts.add(put); + + try { + OTSHelper.batchWriteRow(ots, puts, Collections. emptyList(), Collections. emptyList()); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + // get range + { + { + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid table name: '%s'.", tableName), + 400, + e); + } + } + } + } + + /** + * 对于每个参数包含TableName的API,TableName长度为 MaxLength ,期望正常 + * @throws Exception + */ + @Test + public void testCase11() throws Exception { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.TABLE_NAME_LENGTH_MAX; i++) { + sb.append("a"); + } + String tableName = sb.toString(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + List pkMeta = new ArrayList(); + pkMeta.add(new PrimaryKeySchema("pk", PrimaryKeyType.INTEGER)); + + // create table + { + OTSHelper.createTable(ots, tableName, pkMeta); + Utils.waitForPartitionLoad(tableName); + } + + // DescribeTable + { + DescribeTableResponse result = OTSHelper.describeTable(ots, tableName); + + Table t = OTSTableBuilder.newInstance() + .setTableMeta(OTSHelper.getTableMeta(tableName, pkMeta)) + .setTableOptions(OTSHelper.getDefaultTableOptions()) + .toTable(); + t.getTableOptions().setTimeToLive(10); + checkDescribeTableResult(buildDescribeTableResult(t), result); + } + long ts = System.currentTimeMillis(); + // put row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + OTSHelper.putRow(ots, tableName, pk, columns); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("hello", cols[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("hello", cols[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + List puts = new ArrayList(); + puts.add(new Column("attr", ColumnValue.fromLong(1))); + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(2, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("attr", cols[1].getName()); + assertEquals(1, cols[0].getValue().asLong()); + assertEquals("hello", cols[1].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + checkTimestampWithDeviation(ts, cols[1].getTimestamp()); + + } + // delete row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + OTSHelper.deleteRow(ots, tableName, pk); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null == row); + + } + // batch get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + List primaryKeys = new ArrayList(); + primaryKeys.add(pk); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + List results = r.getBatchGetRowResult(tableName); + + assertEquals(1, results.size()); + + assertTrue(null == results.get(0).getRow()); + + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromString("world")); + puts.add(put); + + OTSHelper.batchWriteRowNoLimit(ots, puts, Collections. emptyList(), Collections. emptyList()); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("world", cols[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // get range + { + + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(100)) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + + assertEquals(1, rows.size()); + + Row row = rows.get(0); + assertEquals(begin, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("world", cols[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + + // delete table + { + List pk = new ArrayList(); + pk.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + + OTSHelper.deleteTable(ots, tableName); + } + } + + /** + * 对于每个参数包含column name的API,column name长度为 MaxLength + 1 + * 期望返回ErrorCode: OTSParameterInvalid + * @throws Exception + */ + @Test + public void testCase12() throws Exception { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_NAME_LENGTH_MAX + 1; i++) { + sb.append("a"); + } + + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + String columnName = sb.toString(); + + // put row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + List cols = new ArrayList(); + cols.add(new Column(columnName, ColumnValue.fromLong(100))); + try { + OTSHelper.putRow(ots, tableName, pk, cols); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid column name: '%s'.", columnName), + 400, + e); + } + } + // get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria( + tableName, pk); + rowQueryCriteria.addColumnsToGet(columnName); + try { + OTSHelper.getRow(ots, rowQueryCriteria); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid column name: '%s'.", columnName), + 400, + e); + } + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + List puts = new ArrayList(); + puts.add(new Column(columnName, ColumnValue.fromLong(1))); + try { + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid column name: '%s'.", columnName), + 400, + e); + } + } + // batch get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + List primaryKeys = new ArrayList(); + primaryKeys.add(pk); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.addColumnsToGet(columnName); + c.setRowKeys(primaryKeys); + criterias.add(c); + try { + + OTSHelper.batchGetRow(ots, criterias); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid column name: '%s'.", columnName), + 400, + e); + } + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columnName, ColumnValue.fromLong(1000)); + puts.add(put); + + try { + OTSHelper.batchWriteRow(ots, puts, Collections. emptyList(), Collections. emptyList()); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid column name: '%s'.", columnName), + 400, + e); + } + } + // get range + { + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + rangeRowQueryCriteria.addColumnsToGet(columnName); + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException e) { + assertTableStoreException( + ErrorCode.INVALID_PARAMETER, + String.format("Invalid column name: '%s'.", columnName), + 400, + e); + } + } + } + + /** + * 对于每个参数包含column name的API,column name长度为 MaxLength + 1, + * 期望返回ErrorCode: OTSParameterInvalid + * @throws Exception + */ + @Test + public void testCase13() throws Exception { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_NAME_LENGTH_MAX; i++) { + sb.append("a"); + } + + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.INTEGER)); + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + String columnName = sb.toString(); + + List columns = new ArrayList(); + columns.add(new Column(columnName, ColumnValue.fromLong(100))); + + long ts = System.currentTimeMillis(); + + // put row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + + OTSHelper.putRow(ots, tableName, pk, columns); + + // get data + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals(columnName, cols[0].getName()); + assertEquals(100, cols[0].getValue().asLong()); + + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + + } + // get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria( + tableName, pk); + rowQueryCriteria.addColumnsToGet(columnName); + rowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + Row row = OTSHelper.getRow(ots, rowQueryCriteria).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + + assertEquals(1, cols.length); + + assertEquals(columnName, cols[0].getName()); + assertEquals(100, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // update row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + List puts = new ArrayList(); + puts.add(new Column(columnName, ColumnValue.fromLong(1))); + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(2, cols.length); + assertEquals(columnName, cols[0].getName()); + assertEquals(columnName, cols[1].getName()); + assertEquals(1, cols[0].getValue().asLong()); + assertEquals(100, cols[1].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // batch get row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + List primaryKeys = new ArrayList(); + primaryKeys.add(pk); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.addColumnsToGet(columnName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + List results = r.getBatchGetRowResult(tableName); + assertEquals(1, results.size()); + + Row row = results.get(0).getRow(); + + assertTrue(null != row); + + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(2, cols.length); + assertEquals(columnName, cols[0].getName()); + assertEquals(columnName, cols[1].getName()); + assertEquals(1, cols[0].getValue().asLong()); + assertEquals(100, cols[1].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + + } + // batch write row + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columnName, ColumnValue.fromLong(1000)); + puts.add(put); + + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null != row); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals(columnName, cols[0].getName()); + assertEquals(1000, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + // get range + { + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)) + .build(); + + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(100)) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + rangeRowQueryCriteria.addColumnsToGet(columnName); + + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + + assertEquals(1, rows.size()); + + Row row = rows.get(0); + assertEquals(begin, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals(columnName, cols[0].getName()); + assertEquals(1000, cols[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + } + + /** + * 一个instance有max个table,创建一个表期望失败,删除一个表后,再创建一个表期望成功 + * @throws Exception + */ + @Test + public void testCase15() throws Exception { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + + for (int i = 0; i < OTSRestrictedItemConst.TABLE_NUMBER_MAX; i++) { + OTSHelper.createTable(ots, tableName + i, scheme); + } + + try { + OTSHelper.createTable(ots, tableName + OTSRestrictedItemConst.TABLE_NUMBER_MAX, scheme); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.QUOTA_EXHAUSTED, "Number of tables exceeds the quota:" + OTSRestrictedItemConst.TABLE_NUMBER_MAX + ".", 403, e); + } + + OTSHelper.deleteTable(ots, tableName + 0); + + OTSHelper.createTable(ots, tableName + OTSRestrictedItemConst.TABLE_NUMBER_MAX, scheme); + + assertTrue(Utils.checkNameExiste(OTSHelper.listTable(ots), tableName + OTSRestrictedItemConst.TABLE_NUMBER_MAX)); + } + + /** + * 对于每个参数包含PrimaryKeys的API,PrimaryKeys的个数为max + 1,期望返回ErrorCode: OTSParameterInvalid + * @throws Exception + */ + @Test + public void testCaes16() throws Exception { + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + for (int i = 0; i < OTSRestrictedItemConst.PRIMARY_KEY_COLUMN_NUMBER_MAX + 1; i++) { + scheme.add(new PrimaryKeySchema("pk_" + i, PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_" + i, PrimaryKeyValue.fromString("" + i))); + begin.add(new PrimaryKeyColumn("pk_" + i, PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_" + i, PrimaryKeyValue.INF_MIN)); + } + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + { // create table + try { + OTSHelper.createTable(ots, tableName, scheme); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + { // put row + try { + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + { // get row + try { + OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + { // delete row + try { + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(primaryKeyColumn)); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + { // update row + try { + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + { // batch get row + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(primaryKeyColumn)); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + try { + OTSHelper.batchGetRow(ots, criterias); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + { // get range + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(new PrimaryKey(begin)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(new PrimaryKey(end)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of primary key columns must be in range: [1, 4].", 400, e); + } + } + } + + /** + * 对于每个参数包含PrimaryKeys的API,PrimaryKeys的个数为max,期望正常 + * @throws Exception + */ + @Test + public void testCase17() throws Exception { + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + for (int i = 0; i < OTSRestrictedItemConst.PRIMARY_KEY_COLUMN_NUMBER_MAX; i++) { + scheme.add(new PrimaryKeySchema("pk_" + i, PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_" + i, PrimaryKeyValue.fromString("" + i))); + begin.add(new PrimaryKeyColumn("pk_" + i, PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_" + i, PrimaryKeyValue.INF_MAX)); + } + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + { // create table + OTSHelper.createTable(ots, tableName, scheme); + + assertTrue(Utils.checkNameExiste(OTSHelper.listTable(ots), tableName)); + + Table t = OTSTableBuilder.newInstance() + .setTableMeta(OTSHelper.getTableMeta(tableName, scheme)) + .setTableOptions(OTSHelper.getDefaultTableOptions()) + .toTable(); + + checkDescribeTableResult(buildDescribeTableResult(t), OTSHelper.describeTable(ots, tableName)); + } + Utils.waitForPartitionLoad(tableName); + long ts = System.currentTimeMillis(); + + { // put row + + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // get row + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + { // delete row + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(primaryKeyColumn)); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null == row); + } + { // update row + + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + { // batch get row + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(primaryKeyColumn)); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + List results = r.getBatchGetRowResult(tableName); + assertEquals(1, results.size()); + + Row row = results.get(0).getRow(); + + assertTrue(null != row); + + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + { // get range + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(new PrimaryKey(begin)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(new PrimaryKey(end)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + + assertEquals(1, rows.size()); + + Row row = rows.get(0); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + } + + /** + * 对于每个参数包含PrimaryKeys的API,PrimaryKeys的个数为0,期望返回IllegalArgumentException + * @throws Exception + */ + @Test + public void testCase18() throws Exception { + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + { // create table + try { + OTSHelper.createTable(ots, tableName, scheme); + fail(); + } catch (IllegalArgumentException e) { + assertEquals("The primary key schema should not be null or empty.", e.getMessage()); + } + } + } + + /** + * 对于每个参数包含PrimaryKeys的API,PK的string value长度为max + 1,期望返回ErrorCode: OTSParameterInvalid + */ + @Test + public void testCase19() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.PRIMARY_KEY_VALUE_STRING_LENGTH_MAX + 1; i++) { + sb.append("a"); + } + String value = sb.toString(); + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString(value))); + + begin = primaryKeyColumn; + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + { // put row + try { + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // get row + try { + OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // delete row + try { + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(primaryKeyColumn)); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // update row + try { + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // batch get row + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(primaryKeyColumn)); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + try { + OTSHelper.batchGetRow(ots, criterias); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // get range + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(new PrimaryKey(begin)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(new PrimaryKey(end)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + } + + /** + * 对于每个参数包含PrimaryKeys的API,PK的string value长度为max,期望正常 + */ + @Test + public void testCase20() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.PRIMARY_KEY_VALUE_STRING_LENGTH_MAX; i++) { + sb.append("a"); + } + String value = sb.toString(); + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString(value))); + begin = primaryKeyColumn; + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + long ts = System.currentTimeMillis(); + + { // put row + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // get row + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // delete row + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(primaryKeyColumn)); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null == row); + } + { // update row + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // batch get row + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(primaryKeyColumn)); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + List results = r.getBatchGetRowResult(tableName); + assertEquals(1, results.size()); + + Row row = results.get(0).getRow(); + + assertTrue(null != row); + + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + { // get range + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(new PrimaryKey(begin)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(new PrimaryKey(end)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + + assertEquals(1, rows.size()); + + Row row = rows.get(0); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + } + + /** + * 对于每个参数包含PrimaryKeys的API,PK的binary value长度为max + 1,期望返回ErrorCode: OTSParameterInvalid + * @throws UnsupportedEncodingException + */ + @Test + public void testCase21() throws UnsupportedEncodingException { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.PRIMARY_KEY_VALUE_BINARY_LENGTH_MAX + 1; i++) { + sb.append("a"); + } + String value = sb.toString(); + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.BINARY)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromBinary(value.getBytes("UTF-8")))); + begin = primaryKeyColumn; + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + { // put row + try { + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // get row + try { + OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // delete row + try { + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(primaryKeyColumn)); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // update row + try { + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // batch get row + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(primaryKeyColumn)); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + try { + OTSHelper.batchGetRow(ots, criterias); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + { // get range + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(new PrimaryKey(begin)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(new PrimaryKey(end)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException e) { + System.out.println(e.toString()); + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of primary key column: 'pk_0' exceeds the MaxLength:1024 with CurrentLength:1025.", 400, e); + } + } + } + + /** + * 对于每个参数包含PrimaryKeys的API,PK的binary value长度为max,期望正常 + * @throws UnsupportedEncodingException + */ + @Test + public void testCase22() throws UnsupportedEncodingException { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.PRIMARY_KEY_VALUE_BINARY_LENGTH_MAX; i++) { + sb.append("a"); + } + String value = sb.toString(); + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.BINARY)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromBinary(value.getBytes("UTF-8")))); + begin = primaryKeyColumn; + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello"))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + long ts = System.currentTimeMillis(); + + { // put row + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // get row + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // delete row + OTSHelper.deleteRow(ots, tableName, new PrimaryKey(primaryKeyColumn)); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null == row); + } + { // update row + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // batch get row + List primaryKeys = new ArrayList(); + primaryKeys.add(new PrimaryKey(primaryKeyColumn)); + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setRowKeys(primaryKeys); + c.setMaxVersions(Integer.MAX_VALUE); + criterias.add(c); + + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + List results = r.getBatchGetRowResult(tableName); + assertEquals(1, results.size()); + + Row row = results.get(0).getRow(); + + assertTrue(null != row); + + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals("hello", row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // get range + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(new PrimaryKey(begin)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(new PrimaryKey(end)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + + assertEquals(1, rows.size()); + + Row row = rows.get(0); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + } + + /** + * 对于每个参数包含column value的API,string value长度为max + 1,期望返回ErrorCode: OTSParameterInvalid + */ + @Test + public void testCase23() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_VALUE_STRING_LENGTH_MAX + 1; i++) { + sb.append("a"); + } + String value = sb.toString(); + + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello"))); + begin.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString(value))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + { // put row + try { + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of attribute column: 'attr' exceeds the MaxLength:2097152 with CurrentLength:2097153.", 400, e); + } + } + { // update row + try { + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of attribute column: 'attr' exceeds the MaxLength:2097152 with CurrentLength:2097153.", 400, e); + } + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumns(columns); + puts.add(put); + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of attribute column: 'attr' exceeds the MaxLength:2097152 with CurrentLength:2097153.", 400, e); + } + } + } + + /** + * 对于每个参数包含column value的API,string value长度为max,期望正常 + */ + @Test + public void testCase24() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_VALUE_STRING_LENGTH_MAX; i++) { + sb.append("a"); + } + String value = sb.toString(); + + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello"))); + begin.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString(value))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + long ts = System.currentTimeMillis(); + + { // put row + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals(value, row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // update row + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(2, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("attr", row.getColumns()[1].getName()); + assertEquals(value, row.getColumns()[0].getValue().asString()); + assertEquals(value, row.getColumns()[1].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + checkTimestampWithDeviation(ts, row.getColumns()[1].getTimestamp()); + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + } + + /** + * 对于每个参数包含column value的API,string value长度为0,期望正常 + */ + @Test + public void testCase25() { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 0; i++) { + sb.append("a"); + } + String value = sb.toString(); + + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello"))); + begin.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString(value))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + long ts = System.currentTimeMillis(); + + { // put row + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals(value, row.getColumns()[0].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + } + { // update row + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + assertEquals(2, row.getColumns().length); + assertEquals(value, row.getColumns()[0].getValue().asString()); + assertEquals(value, row.getColumns()[1].getValue().asString()); + checkTimestampWithDeviation(ts, row.getColumns()[0].getTimestamp()); + checkTimestampWithDeviation(ts, row.getColumns()[1].getTimestamp()); + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1)); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + assertTrue(null != row); + assertEquals(new PrimaryKey(primaryKeyColumn), row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", cols[0].getName()); + assertEquals(1, row.getColumns()[0].getValue().asLong()); + checkTimestampWithDeviation(ts, cols[0].getTimestamp()); + } + } + + /** + * 对于每个参数包含column value的API,binary value长度为max + 1,期望返回ErrorCode: OTSParameterInvalid + * @throws UnsupportedEncodingException + */ + @Test + public void testCase26() throws UnsupportedEncodingException { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_VALUE_BINARY_LENGTH_MAX + 1; i++) { + sb.append("a"); + } + String value = sb.toString(); + + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello"))); + begin.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")))); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + { // put row + try { + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of attribute column: 'attr' exceeds the MaxLength:2097152 with CurrentLength:2097153.", 400, e); + } + } + { // update row + try { + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of attribute column: 'attr' exceeds the MaxLength:2097152 with CurrentLength:2097153.", 400, e); + } + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumns(columns); + puts.add(put); + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The length of attribute column: 'attr' exceeds the MaxLength:2097152 with CurrentLength:2097153.", 400, e); + } + } + } + + /** + * 对于每个参数包含column value的API,binary value长度为max,期望正常 + * @throws UnsupportedEncodingException + */ + @Test + public void testCase27() throws UnsupportedEncodingException { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_VALUE_BINARY_LENGTH_MAX; i++) { + sb.append("a"); + } + String value = sb.toString(); + + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello"))); + begin.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + long ts = System.currentTimeMillis(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts)); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + { // put row + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, row); + } + { // update row + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + assertTrue(null != row); + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, row); + } + + // batchGetRow + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.addRow(new PrimaryKey(primaryKeyColumn)); + c.setMaxVersions(Integer.MAX_VALUE); + + List criterias = new ArrayList(); + criterias.add(c); + + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List suc = result.getSucceedRows(); + List fail = result.getFailedRows(); + + assertEquals(0, fail.size()); + assertEquals(1, suc.size()); + + Row row = suc.get(0).getRow(); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, row); + } + // getRange + { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(Utils.getMinPK(scheme)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(Utils.getMaxPK(scheme)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + assertEquals(null, result.getNextStartPrimaryKey()); + assertEquals(1, result.getRows().size()); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, result.getRows().get(0)); + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts + 1); + puts.add(put); + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts + 1) + .toRow(); + + checkRow(expect, row); + } + } + + /** + * 对于每个参数包含column value的API,binary value长度为0,期望正常 + * @throws UnsupportedEncodingException + */ + @Test + public void testCase28() throws UnsupportedEncodingException { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 0; i++) { + sb.append("a"); + } + String value = sb.toString(); + + List scheme = new ArrayList(); + List primaryKeyColumn = new ArrayList(); + List begin = new ArrayList(); + List end = new ArrayList(); + + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + primaryKeyColumn.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello"))); + begin.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN)); + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + long ts = System.currentTimeMillis(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts)); + + OTSHelper.createTable(ots, tableName, scheme); + + Utils.waitForPartitionLoad(tableName); + + { // put row + OTSHelper.putRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns); + // get row + { + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, row); + } + // batchGetRow + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.addRow(new PrimaryKey(primaryKeyColumn)); + c.setMaxVersions(Integer.MAX_VALUE); + + List criterias = new ArrayList(); + criterias.add(c); + + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List suc = result.getSucceedRows(); + List fail = result.getFailedRows(); + + assertEquals(0, fail.size()); + assertEquals(1, suc.size()); + + Row row = suc.get(0).getRow(); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, row); + } + // getRange + { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(Utils.getMinPK(scheme)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(Utils.getMaxPK(scheme)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + assertEquals(null, result.getNextStartPrimaryKey()); + assertEquals(1, result.getRows().size()); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, result.getRows().get(0)); + } + } + { // update row + OTSHelper.updateRow(ots, tableName, new PrimaryKey(primaryKeyColumn), columns, null, null); + // get row + { + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, row); + } + // batchGetRow + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.addRow(new PrimaryKey(primaryKeyColumn)); + c.setMaxVersions(Integer.MAX_VALUE); + + List criterias = new ArrayList(); + criterias.add(c); + + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List suc = result.getSucceedRows(); + List fail = result.getFailedRows(); + + assertEquals(0, fail.size()); + assertEquals(1, suc.size()); + + Row row = suc.get(0).getRow(); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, row); + } + // getRange + { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(Utils.getMinPK(scheme)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(Utils.getMaxPK(scheme)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + assertEquals(null, result.getNextStartPrimaryKey()); + assertEquals(1, result.getRows().size()); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromBinary(value.getBytes("UTF-8")), ts) + .toRow(); + + checkRow(expect, result.getRows().get(0)); + } + } + { // batch write row + List puts = new ArrayList(); + RowPutChange put = new RowPutChange(tableName, new PrimaryKey(primaryKeyColumn)); + put.addColumn("attr", ColumnValue.fromLong(1), ts); + puts.add(put); + + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + // get row + { + Row row = OTSHelper.getRowForAll(ots, tableName, new PrimaryKey(primaryKeyColumn)).getRow(); + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromLong(1), ts) + .toRow(); + + checkRow(expect, row); + } + // batchGetRow + { + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.addRow(new PrimaryKey(primaryKeyColumn)); + c.setMaxVersions(Integer.MAX_VALUE); + + List criterias = new ArrayList(); + criterias.add(c); + + BatchGetRowResponse result = OTSHelper.batchGetRow(ots, criterias); + List suc = result.getSucceedRows(); + List fail = result.getFailedRows(); + + assertEquals(0, fail.size()); + assertEquals(1, suc.size()); + + Row row = suc.get(0).getRow(); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromLong(1), ts) + .toRow(); + + checkRow(expect, row); + } + // getRange + { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(Utils.getMinPK(scheme)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(Utils.getMaxPK(scheme)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse result = OTSHelper.getRange(ots, rangeRowQueryCriteria); + assertEquals(null, result.getNextStartPrimaryKey()); + assertEquals(1, result.getRows().size()); + + Row expect = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn(primaryKeyColumn) + .addAttrColumn("attr", ColumnValue.fromLong(1), ts) + .toRow(); + + checkRow(expect, result.getRows().get(0)); + } + } + } + + /** + * MultiGetRow中包含的row个数为max + 1,期望返回ErrorCode: OTSParameterInvalid + */ + @Test + public void testCase29() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + List criterias = new ArrayList(); + + MultiRowQueryCriteria query = new MultiRowQueryCriteria(tableName); + for (int i = 0; i < OTSRestrictedItemConst.BATCH_GET_ROW_COUNT_MAX + 1; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello" + i)) + .build(); + query.addRow(pk); + } + query.setMaxVersions(Integer.MAX_VALUE); + criterias.add(query); + try { + OTSHelper.batchGetRow(ots, criterias); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "Rows count exceeds the upper limit: 100.", 400, e); + } + } + + /** + * MultiGetRow中包含的row个数为max,期望正常 + */ + @Test + public void testCase30() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + List criterias = new ArrayList(); + + MultiRowQueryCriteria query = new MultiRowQueryCriteria(tableName); + for (int i = 0; i < OTSRestrictedItemConst.BATCH_GET_ROW_COUNT_MAX; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello" + i)) + .build(); + query.addRow(pk); + } + query.setMaxVersions(Integer.MAX_VALUE); + criterias.add(query); + + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + List results = r.getBatchGetRowResult(tableName); + assertEquals(OTSRestrictedItemConst.BATCH_GET_ROW_COUNT_MAX, results.size()); + + for (int i = 0; i < results.size(); i++) { + assertTrue(null == results.get(i).getRow()); + assertEquals(tableName, results.get(i).getTableName()); + } + } + + /** + * MultiWriteRow中包含的row个数为max + 1,期望返回ErrorCode: OTSParameterInvalid + */ + @Test + public void testCase31() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + List puts = new ArrayList(); + + for (int i = 0; i < OTSRestrictedItemConst.BATCH_WRITE_ROW_COUNT_MAX+1; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString("hello" + i)) + .build(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromString("animal")); + puts.add(put); + } + + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "Rows count exceeds the upper limit: 200.", 400, e); + } + } + + /** + * MultiWriteRow中包含的row个数为max,期望正常 + */ + @Test + public void testCase32() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + List puts = new ArrayList(); + + for (int i = 0; i < OTSRestrictedItemConst.BATCH_WRITE_ROW_COUNT_MAX ; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString(String.format("hello%06d", i))) + .build(); + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn("attr", ColumnValue.fromString("animal")); + puts.add(put); + } + + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + List begin = new ArrayList(); + begin.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN)); + + List end = new ArrayList(); + end.add(new PrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX)); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(new PrimaryKey(begin)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(new PrimaryKey(end)); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + + assertEquals(OTSRestrictedItemConst.BATCH_WRITE_ROW_COUNT_MAX, rows.size()); + + for (int i = 0; i < OTSRestrictedItemConst.BATCH_WRITE_ROW_COUNT_MAX; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromString(String.format("hello%06d", i))) + .build(); + Row row = rows.get(i); + + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(1, cols.length); + assertEquals("attr", row.getColumns()[0].getName()); + assertEquals("animal", row.getColumns()[0].getValue().asString()); + } + } + + /** + * 一个表中包含max + 1行,total size < max,GetRange读取期望2次完成 + */ + @Test + public void testCase33() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + + // prapare + for (int i = 0; i < OTSRestrictedItemConst.GET_RANGE_COUNT_MAX + 1; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(i)) + .build(); + OTSHelper.putRow(ots, tableName, pk, columns); + } + + // + PrimaryKey inclusiveStartPrimaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey exclusiveEndPrimaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + assertEquals(OTSRestrictedItemConst.GET_RANGE_COUNT_MAX, rows.size()); + + for (int i = 0; i < OTSRestrictedItemConst.GET_RANGE_COUNT_MAX; i++) { + + Row row = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(i)) + .addAttrColumn("attr", ColumnValue.fromString("hello world")) + .toRow(); + checkRowNoTimestamp(row, rows.get(i)); + } + + PrimaryKey nextPK = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(OTSRestrictedItemConst.GET_RANGE_COUNT_MAX)) + .build(); + + assertEquals(nextPK, r.getNextStartPrimaryKey()); + + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(nextPK); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + rows = r.getRows(); + assertEquals(1, rows.size()); + + for (int i = 0; i < rows.size(); i++) { + + Row row = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(5000 + i)) + .addAttrColumn("attr", ColumnValue.fromString("hello world")) + .toRow(); + checkRowNoTimestamp(row, rows.get(i)); + } + + assertEquals(null, r.getNextStartPrimaryKey()); + } + + /** + * 一个表中包含max行,total size < max,GetRange读取期望1次完成 + */ + @Test + public void testCase34() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + + // prapare + for (int i = 0; i < OTSRestrictedItemConst.GET_RANGE_COUNT_MAX; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(i)) + .build(); + OTSHelper.putRow(ots, tableName, pk, columns); + } + + // + PrimaryKey inclusiveStartPrimaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey exclusiveEndPrimaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + List rows = r.getRows(); + assertEquals(OTSRestrictedItemConst.GET_RANGE_COUNT_MAX, rows.size()); + + for (int i = 0; i < OTSRestrictedItemConst.GET_RANGE_COUNT_MAX; i++) { + + Row row = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(i)) + .addAttrColumn("attr", ColumnValue.fromString("hello world")) + .toRow(); + checkRowNoTimestamp(row, rows.get(i)); + } + + assertEquals(null, r.getNextStartPrimaryKey()); + } + + /** + * 一个表中包含max + 1 byte数据,行个数 < max,GetRange读取期望2次完成 + */ + @Test + public void testCase35() { + + // 210 = (1024 * 1024) / 5000 + + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 2000; i++) { + sb.append("a"); + } + + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString(sb.toString()))); + + int expectCount = 0; + int size = 0; + while (true) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(expectCount++)) + .build(); + RowPutChange rowChange = new RowPutChange(tableName, pk); + rowChange.addColumns(columns); + + size += rowChange.getDataSize(); + + OTSHelper.putRow(ots, rowChange); + + if (size > OTSRestrictedItemConst.GET_RANGE_SIZE_MAX) { + break; + } + } + + // 不应该大于最大限制数 + if (expectCount > OTSRestrictedItemConst.GET_RANGE_COUNT_MAX) { + fail(); + } + + PrimaryKey inclusiveStartPrimaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey exclusiveEndPrimaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + List rows = new ArrayList(); + rows.addAll(r.getRows()); + + PrimaryKey nextPK = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(rows.size())) + .build(); + + assertEquals(nextPK, r.getNextStartPrimaryKey()); + + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(nextPK); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + + rows.addAll(r.getRows()); + + assertEquals(expectCount, rows.size()); + + for (int i = 0; i < rows.size(); i++) { + Row row = OTSRowBuilder.newInstance() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(i)) + .addAttrColumn("attr", ColumnValue.fromString(sb.toString())) + .toRow(); + checkRowNoTimestamp(row, rows.get(i)); + } + + assertEquals(null, r.getNextStartPrimaryKey()); + } + + /** + * 对于所有的写操作 + * PutRow/UpdateRow(update和delete两种情况)/BatchWriteRow(put/delete/update), + * 测试包含1024个列,期望返回正常,并且数据读出校验符合预期。 + */ + @Test + public void testCase39() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + List deletes = new ArrayList(); + + List putChanges = new ArrayList(); + List updateChanges = new ArrayList(); + List updateChangesForDelete = new ArrayList(); + + RowPutChange putChange = new RowPutChange(tableName, pk); + RowUpdateChange updateChange = new RowUpdateChange(tableName, pk); + RowUpdateChange updateForDeleteChange = new RowUpdateChange(tableName, pk); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW; i++) { + String columnName = String.format("attr_%06d", i); + puts.add(new Column(columnName, ColumnValue.fromLong(i))); + + putChange.addColumn(new Column(columnName, ColumnValue.fromLong(i))); + updateChange.put(new Column(columnName, ColumnValue.fromLong(i))); + updateForDeleteChange.deleteColumns(columnName); + + deletes.add(columnName); + } + + putChanges.add(putChange); + updateChanges.add(updateChange); + updateChangesForDelete.add(updateForDeleteChange); + + // + { + Utils.deleteTableIfExist(ots, tableName); + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + OTSHelper.putRow(ots, tableName, pk, puts); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + + OTSHelper.deleteTable(ots, tableName); + } + + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + System.out.println(cols[i].toString()); + LOG.info(cols[i].toString()); + } + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + } + + OTSHelper.deleteTable(ots, tableName); + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + OTSHelper.batchWriteRowNoLimit(ots, putChanges, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + + OTSHelper.deleteTable(ots, tableName); + } + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + OTSHelper.batchWriteRowNoLimit(ots, null, updateChanges, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertEquals(pk, row.getPrimaryKey()); + + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + OTSHelper.deleteTable(ots, tableName); + } + + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + OTSHelper.batchWriteRowNoLimit(ots, null, updateChangesForDelete, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null == row); + } + } + + /** + * 对于所有的写操作 + * PutRow/UpdateRow(update和delete两种情况)/BatchWriteRow(updateChange/delete/update), + * 测试包含1025个列,期望返回OTSParameterInvalid。 + */ + @Test + public void testCase41() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + List deletes = new ArrayList(); + List putChanges = new ArrayList(); + List updateChanges = new ArrayList(); + List updateChangesForDelete = new ArrayList(); + + RowPutChange put = new RowPutChange(tableName, pk); + RowUpdateChange update = new RowUpdateChange(tableName, pk); + RowUpdateChange updateForDelete = new RowUpdateChange(tableName, pk); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW + 1; i++) { + String columnName = "attr_" + i; + puts.add(new Column(columnName, ColumnValue.fromLong(i))); + deletes.add(columnName); + put.addColumn(new Column(columnName, ColumnValue.fromLong(i))); + update.put(new Column(columnName, ColumnValue.fromLong(i))); + updateForDelete.deleteColumns(columnName); + } + putChanges.add(put); + updateChanges.add(update); + updateChangesForDelete.add(updateForDelete); + + // + { + Utils.deleteTableIfExist(ots, tableName); + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + try { + OTSHelper.putRow(ots, tableName, pk, puts); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of attribute columns exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + OTSHelper.deleteTable(ots, tableName); + } + + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + try { + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of attribute columns exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + } + + { + + try { + OTSHelper.updateRow(ots, tableName, pk, null, deletes, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of attribute columns exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + + OTSHelper.deleteTable(ots, tableName); + } + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + try { + OTSHelper.batchWriteRow(ots, putChanges, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of attribute columns exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + + OTSHelper.deleteTable(ots, tableName); + } + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + try { + OTSHelper.batchWriteRow(ots, null, updateChanges, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of attribute columns exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + OTSHelper.deleteTable(ots, tableName); + } + + { + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + try { + OTSHelper.batchWriteRow(ots, null, updateChangesForDelete, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of attribute columns exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + OTSHelper.deleteTable(ots, tableName); + } + } + + /** + * 对于所有的读操作 GetRow/GetRange/BatchGet,测试ColumnsToGet包含1024个列,期望返回正常。 + */ + @Test + public void testCase42() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + List columnsToGet = new ArrayList(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW; i++) { + columnsToGet.add(String.format("attr_%06d", i)); + puts.add(new Column(String.format("attr_%06d", i), ColumnValue.fromLong(i))); + } + + // prepare data + OTSHelper.putRow(ots, tableName, pk, puts); + + // get row + { + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName, pk); + rowQueryCriteria.addColumnsToGet(columnsToGet); + rowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + Row row = OTSHelper.getRow(ots, rowQueryCriteria).getRow(); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + } + // batch get row + { + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + multiRowQueryCriteria.addRow(pk); + multiRowQueryCriteria.addColumnsToGet(columnsToGet); + multiRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + List criterias = new ArrayList(); + criterias.add(multiRowQueryCriteria); + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + + List rr = r.getBatchGetRowResult(tableName); + assertEquals(1, rr.size()); + + Row row = rr.get(0).getRow(); + + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + } + // Get Range + { + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.addColumnsToGet(columnsToGet); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + List rows = r.getRows(); + assertEquals(1, rows.size()); + + Row row = rows.get(0); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + } + } + + /** + * 对于所有的读操作 GetRow/GetRange/BatchGet,测试ColumnsToGet包含1025个列,期望返回错误 + */ + @Test + public void testCase43() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + List columnsToGet = new ArrayList(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW; i++) { + columnsToGet.add(String.format("attr_%06d", i)); + puts.add(new Column(String.format("attr_%06d", i), ColumnValue.fromLong(i))); + } + columnsToGet.add(String.format("attr_%06d", OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW)); + + // prepare data + OTSHelper.putRow(ots, tableName, pk, puts); + + // get row + { + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName, pk); + rowQueryCriteria.addColumnsToGet(columnsToGet); + rowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + try { + OTSHelper.getRow(ots, rowQueryCriteria); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of columns from the request exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + + } + // batch get row + { + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + multiRowQueryCriteria.addRow(pk); + multiRowQueryCriteria.addColumnsToGet(columnsToGet); + multiRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + List criterias = new ArrayList(); + criterias.add(multiRowQueryCriteria); + try { + OTSHelper.batchGetRow(ots, criterias); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of columns from the request exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + } + // Get Range + { + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.addColumnsToGet(columnsToGet); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + try { + OTSHelper.getRange(ots, rangeRowQueryCriteria); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The number of columns from the request exceeds the limit, limit count: 1024, column count: 1025.", 400, e); + } + } + } + + /** + * 分别对UpdateRow和BatchWriteRow中的UpdateRow操作:一个row已经包含1024个 + * column,update添加一个column成功 + */ + @Test + public void testCase44() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + List columnsToGet = new ArrayList(); + for (int i = 0; i < OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW; i++) { + columnsToGet.add(String.format("attr_%06d", i)); + puts.add(new Column(String.format("attr_%06d", i), ColumnValue.fromLong(i))); + } + + // prepare data + OTSHelper.putRow(ots, tableName, pk, puts); + + // get row + { + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName, pk); + rowQueryCriteria.addColumnsToGet(columnsToGet); + rowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + + Row row = OTSHelper.getRow(ots, rowQueryCriteria).getRow(); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + } + // batch get row + { + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); + multiRowQueryCriteria.addRow(pk); + multiRowQueryCriteria.addColumnsToGet(columnsToGet); + multiRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + List criterias = new ArrayList(); + criterias.add(multiRowQueryCriteria); + BatchGetRowResponse r = OTSHelper.batchGetRow(ots, criterias); + + List rr = r.getBatchGetRowResult(tableName); + assertEquals(1, rr.size()); + + Row row = rr.get(0).getRow(); + + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + } + // Get Range + { + PrimaryKey begin = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.INF_MAX) + .build(); + + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(begin); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(end); + rangeRowQueryCriteria.addColumnsToGet(columnsToGet); + rangeRowQueryCriteria.setMaxVersions(Integer.MAX_VALUE); + GetRangeResponse r = OTSHelper.getRange(ots, rangeRowQueryCriteria); + List rows = r.getRows(); + assertEquals(1, rows.size()); + + Row row = rows.get(0); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(OTSRestrictedItemConst.COLUMN_COUNT_MAX_IN_SINGLE_ROW, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + } + } + } + + /** + * 测试所有的API指定timestamp为 long.max/1000 - 1的情况,期望返回正常 + */ + @Test + public void testCase45() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk_0", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk_0", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + List columnsToGet = new ArrayList(); + for (int i = 0; i < 10; i++) { + columnsToGet.add(String.format("attr_%06d", i)); + puts.add(new Column(String.format("attr_%06d", i), ColumnValue.fromLong(i), Long.MAX_VALUE/1000 - 1)); + } + + { + OTSHelper.putRow(ots, tableName, pk, puts); + } + { + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(10, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + assertEquals(Long.MAX_VALUE/1000 - 1, cols[i].getTimestamp()); + } + } + { + OTSHelper.deleteRow(ots, tableName, pk); + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null == row); + } + { + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + + Row row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(10, cols.length); + + for (int i = 0; i < cols.length; i++) { + assertEquals(String.format("attr_%06d", i), cols[i].getName()); + assertEquals(i, cols[i].getValue().asLong()); + assertEquals(Long.MAX_VALUE/1000 - 1, cols[i].getTimestamp()); + } + OTSHelper.deleteRow(ots, tableName, pk); + row = OTSHelper.getRowForAll(ots, tableName, pk).getRow(); + assertTrue(null == row); + } + { + List putsChange = new ArrayList(); + RowPutChange p = new RowPutChange(tableName, pk); + for (int i = 0; i < 10; i++) { + p.addColumn(new Column("attr_" + i, ColumnValue.fromLong(i), Long.MAX_VALUE/1000 - 1)); + } + putsChange.add(p); + + List updatesChange = new ArrayList(); + + OTSHelper.batchWriteRowNoLimit(ots, putsChange, updatesChange, null); + + List criterias = new ArrayList(); + MultiRowQueryCriteria mrc = new MultiRowQueryCriteria(tableName); + mrc.addRow(pk); + mrc.setMaxVersions(Integer.MAX_VALUE); + criterias.add(mrc); + List r = OTSHelper.batchGetRow(ots, criterias).getBatchGetRowResult(tableName); + + assertEquals(1, r.size()); + + Row row = r.get(0).getRow(); + assertEquals(pk, row.getPrimaryKey()); + Column[] cols = row.getColumns(); + assertEquals(10, cols.length); + + for (int i = 0; i < 10; i++) { + assertEquals(i, cols[i].getValue().asLong()); + assertEquals(Long.MAX_VALUE/1000 - 1, cols[i].getTimestamp()); + } + } + } + + /** + * 测试所有的API指定timestamp为 long.max/1000的情况,期望返回OTSParameterInvalid + */ + @Test + public void testCase46() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.INTEGER)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(0)) + .build(); + + List puts = new ArrayList(); + List columnsToGet = new ArrayList(); + for (int i = 0; i < 10; i++) { + columnsToGet.add(String.format("attr_%06d", i)); + puts.add(new Column(String.format("attr_%06d", i), ColumnValue.fromLong(i), Long.MAX_VALUE/1000)); + } + + { + try { + OTSHelper.putRow(ots, tableName, pk, puts); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "Timestamp must be in range [0, INT64_MAX/1000).", 400, e); + } + + } + { + try { + OTSHelper.updateRow(ots, tableName, pk, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "Timestamp must be in range [0, INT64_MAX/1000).", 400, e); + } + } + { + List putsChange = new ArrayList(); + RowPutChange p = new RowPutChange(tableName, pk); + for (int i = 0; i < 10; i++) { + p.addColumn(new Column(String.format("attr_%06d", i), ColumnValue.fromLong(i), Long.MAX_VALUE/1000)); + } + putsChange.add(p); + + List updatesChange = new ArrayList(); + try { + BatchWriteRowResponse r = OTSHelper.batchWriteRow(ots, putsChange, updatesChange, null); + fail(); + } catch (TableStoreException ex) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "Timestamp must be in range [0, INT64_MAX/1000).", 400, ex); + } + + } + } + + private String getString(char c, int size) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < size; i++) { + sb.append(c); + } + return sb.toString(); + } + + /** + * 构造BatchWriteRow的put和update操作,数据量正好为1M的情况,类型分别为STRING/BINARY, + * 期望返回正常,并且BatchGetRow读出校验通过。 + */ + @Test + public void testCase47_string_put() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 2 + 98 + 50 + 64 * 1024 + 8 = 65694 + // pk_name + pk_value + col_name + col_value + ts + + // 1024 * 1024 - 15 * 65694 = 63166 + // 2 + 98 + 50 + 63008 + 8 = 63166 + + List puts = new ArrayList(); + + String columName = getString('k', 50); + + for (int i = 0; i < 15; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromString(getString('a', 64 * 1024)), (new Date()).getTime()); + puts.add(put); + } + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), 15))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromString(getString('a', 63008)), (new Date()).getTime()); + puts.add(put); + + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setMaxVersions(Integer.MAX_VALUE); + for (int i = 0 ; i < 16; i++) { + PrimaryKey tmpPk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + c.addRow(tmpPk); + } + criterias.add(c); + + List rr = OTSHelper.batchGetRowNoLimit(ots, criterias); + + assertEquals(16, rr.size()); + + for (int i = 0; i < 16; i++) { + Row row = rr.get(i).getRow(); + + PrimaryKey expect = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + assertEquals(expect, row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals(columName, row.getColumns()[0].getName()); + if (i < 15) { + assertEquals(getString('a', 64 * 1024), row.getColumns()[0].getValue().asString()); + } else { + assertEquals(getString('a', 63008), row.getColumns()[0].getValue().asString()); + } + } + } + + @Test + public void testCase47_string_update() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 2 + 98 + 50 + 64 * 1024 + 8 = 65694 + // pk_name + pk_value + col_name + col_value + ts + + // 1024 * 1024 - 15 * 65694 = 63166 + // 2 + 98 + 50 + 63008 + 8 = 63166 + + List updates = new ArrayList(); + + String columName = getString('k', 50); + + for (int i = 0; i < 15; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromString(getString('a', 64 * 1024)), (new Date()).getTime()); + updates.add(up); + } + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), 15))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromString(getString('a', 63008)), (new Date()).getTime()); + updates.add(up); + + OTSHelper.batchWriteRowNoLimit(ots, null, updates, null); + + // + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setMaxVersions(Integer.MAX_VALUE); + for (int i = 0 ; i < 16; i++) { + PrimaryKey tmpPk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + c.addRow(tmpPk); + } + criterias.add(c); + + List rr = OTSHelper.batchGetRowNoLimit(ots, criterias); + + assertEquals(16, rr.size()); + + for (int i = 0; i < 16; i++) { + Row row = rr.get(i).getRow(); + + PrimaryKey expect = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + assertEquals(expect, row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + assertEquals(columName, row.getColumns()[0].getName()); + if (i < 15) { + assertEquals(getString('a', 64 * 1024), row.getColumns()[0].getValue().asString()); + } else { + assertEquals(getString('a', 63008), row.getColumns()[0].getValue().asString()); + } + } + } + + @Test + public void testCase47_binary_put() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 2 + 98 + 50 + 64 * 1024 + 8 = 65694 + // pk_name + pk_value + col_name + col_value + ts + + // 1024 * 1024 - 15 * 65694 = 63166 + // 2 + 98 + 50 + 63008 + 8 = 63166 + + List puts = new ArrayList(); + + String columName = getString('k', 50); + + for (int i = 0; i < 15; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromBinary(getString('a', 64 * 1024).getBytes("UTF-8")), (new Date()).getTime()); + puts.add(put); + } + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), 15))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromBinary(getString('a', 63008).getBytes("UTF-8")), (new Date()).getTime()); + puts.add(put); + + OTSHelper.batchWriteRowNoLimit(ots, puts, null, null); + + // + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setMaxVersions(Integer.MAX_VALUE); + for (int i = 0 ; i < 16; i++) { + PrimaryKey tmpPk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + c.addRow(tmpPk); + } + criterias.add(c); + + List rr = OTSHelper.batchGetRowNoLimit(ots, criterias); + + assertEquals(16, rr.size()); + + for (int i = 0; i < 16; i++) { + Row row = rr.get(i).getRow(); + + PrimaryKey expect = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + assertEquals(expect, row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + if (i < 15) { + assertEquals(getString('a', 64 * 1024), new String(row.getColumns()[0].getValue().asBinary(), "UTF-8")); + } else { + assertEquals(getString('a', 63008), new String(row.getColumns()[0].getValue().asBinary(), "UTF-8")); + } + } + } + + @Test + public void testCase47_binary_update() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 2 + 98 + 50 + 64 * 1024 + 8 = 65694 + // pk_name + pk_value + col_name + col_value + ts + + // 1024 * 1024 - 15 * 65694 = 63166 + // 2 + 98 + 50 + 63008 + 8 = 63166 + + List updates = new ArrayList(); + + String columName = getString('k', 50); + + for (int i = 0; i < 15; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromBinary(getString('a', 64 * 1024).getBytes("UTF-8")), (new Date()).getTime()); + updates.add(up); + } + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), 15))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromBinary(getString('a', 63008).getBytes("UTF-8")), (new Date()).getTime()); + updates.add(up); + + OTSHelper.batchWriteRowNoLimit(ots, null, updates, null); + + // + List criterias = new ArrayList(); + MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); + c.setMaxVersions(Integer.MAX_VALUE); + for (int i = 0 ; i < 16; i++) { + PrimaryKey tmpPk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + c.addRow(tmpPk); + } + criterias.add(c); + List rr = OTSHelper.batchGetRowNoLimit(ots, criterias); + + assertEquals(16, rr.size()); + + for (int i = 0; i < 16; i++) { + Row row = rr.get(i).getRow(); + + PrimaryKey expect = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 48), i))) + .build(); + + assertEquals(expect, row.getPrimaryKey()); + assertEquals(1, row.getColumns().length); + if (i < 15) { + assertEquals(getString('a', 64 * 1024), new String(row.getColumns()[0].getValue().asBinary(), "UTF-8")); + } else { + assertEquals(getString('a', 63008), new String(row.getColumns()[0].getValue().asBinary(), "UTF-8")); + } + + } + } + + /** + * 构造BatchWriteRow的put和update操作,数据量正好为4M + 1的情况,类型分别为STRING/BINARY, + * 期望返回OTSParameterInvalid + */ + @Test + public void testCase48_string_put() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 4,194,305 + // 1,398,103 + // 1,398,101 + // 1,398,101 + + // 2 + 98 + 50 + 1397945 + 8 = 1,398,103 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + + List puts = new ArrayList(); + + String columName = getString('k', 50); + + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 0))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromString(getString('a', 1397945)), (new Date()).getTime()); + puts.add(put); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 1))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromString(getString('a', 1397943)), (new Date()).getTime()); + puts.add(put); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 2))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromString(getString('a', 1397943)), (new Date()).getTime()); + puts.add(put); + } + + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The total data size of BatchWriteRow request exceeds the limit, limit size: 4194304, data size: 4194305.", 400, e); + } + } + + @Test + public void testCase48_string_update() { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 4,194,305 + // 1,398,103 + // 1,398,101 + // 1,398,101 + + // 2 + 98 + 50 + 1397945 + 8 = 1,398,103 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + List updates = new ArrayList(); + + String columName = getString('k', 50); + + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 0))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromString(getString('a', 1397945)), (new Date()).getTime()); + updates.add(up); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 1))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromString(getString('a', 1397943)), (new Date()).getTime()); + updates.add(up); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 2))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromString(getString('a', 1397943)), (new Date()).getTime()); + updates.add(up); + } + + try { + OTSHelper.batchWriteRow(ots, null, updates, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The total data size of BatchWriteRow request exceeds the limit, limit size: 4194304, data size: 4194305.", 400, e); + } + } + + @Test + public void testCase48_binary_put() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 4,194,305 + // 1,398,103 + // 1,398,101 + // 1,398,101 + + // 2 + 98 + 50 + 1397945 + 8 = 1,398,103 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + List puts = new ArrayList(); + + String columName = getString('k', 50); + + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 0))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromBinary(getString('a', 1397945).getBytes("UTF-8")), (new Date()).getTime()); + puts.add(put); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 1))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromBinary(getString('a', 1397943).getBytes("UTF-8")), (new Date()).getTime()); + puts.add(put); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 2))) + .build(); + + RowPutChange put = new RowPutChange(tableName, pk); + put.addColumn(columName, ColumnValue.fromBinary(getString('a', 1397943).getBytes("UTF-8")), (new Date()).getTime()); + puts.add(put); + } + + try { + OTSHelper.batchWriteRow(ots, puts, null, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The total data size of BatchWriteRow request exceeds the limit, limit size: 4194304, data size: 4194305.", 400, e); + } + } + + @Test + public void testCase48_binary_update() throws UnsupportedEncodingException { + List scheme = new ArrayList(); + scheme.add(new PrimaryKeySchema("pk", PrimaryKeyType.STRING)); + + OTSHelper.createTable(ots, tableName, scheme); + Utils.waitForPartitionLoad(tableName); + + // 4,194,305 + // 1,398,103 + // 1,398,101 + // 1,398,101 + + // 2 + 98 + 50 + 1397945 + 8 = 1,398,103 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + // 2 + 98 + 50 + 1397943 + 8 = 1,398,101 + // pk_name + pk_value + col_name + col_value + ts + + List updates = new ArrayList(); + + String columName = getString('k', 50); + + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 0))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromBinary(getString('a', 1397945).getBytes("UTF-8")), (new Date()).getTime()); + updates.add(up); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 1))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromBinary(getString('a', 1397943).getBytes("UTF-8")), (new Date()).getTime()); + updates.add(up); + } + { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(String.format("%s%02d", getString('v', 96), 2))) + .build(); + + RowUpdateChange up = new RowUpdateChange(tableName, pk); + up.put(columName, ColumnValue.fromBinary(getString('a', 1397943).getBytes("UTF-8")), (new Date()).getTime()); + updates.add(up); + } + + try { + OTSHelper.batchWriteRow(ots, null, updates, null); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The total data size of BatchWriteRow request exceeds the limit, limit size: 4194304, data size: 4194305.", 400, e); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/functiontest/TestComputeSplitsBySize.java b/src/test/java/com/alicloud/openservices/tablestore/functiontest/TestComputeSplitsBySize.java new file mode 100644 index 0000000..9ffef9e --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/functiontest/TestComputeSplitsBySize.java @@ -0,0 +1,302 @@ +package com.alicloud.openservices.tablestore.functiontest; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.common.ServiceSettings; +import com.alicloud.openservices.tablestore.writer.WriterConfig; +import org.junit.Test; + +import com.alicloud.openservices.tablestore.model.BatchWriteRowRequest; +import com.alicloud.openservices.tablestore.model.CapacityUnit; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.ComputeSplitsBySizeRequest; +import com.alicloud.openservices.tablestore.model.ComputeSplitsBySizeResponse; +import com.alicloud.openservices.tablestore.model.CreateTableRequest; +import com.alicloud.openservices.tablestore.model.DeleteTableRequest; +import com.alicloud.openservices.tablestore.model.Direction; +import com.alicloud.openservices.tablestore.model.GetRangeRequest; +import com.alicloud.openservices.tablestore.model.GetRangeResponse; +import com.alicloud.openservices.tablestore.model.ListTableResponse; +import com.alicloud.openservices.tablestore.model.PrimaryKey; +import com.alicloud.openservices.tablestore.model.PrimaryKeyColumn; +import com.alicloud.openservices.tablestore.model.PrimaryKeyType; +import com.alicloud.openservices.tablestore.model.PrimaryKeyValue; +import com.alicloud.openservices.tablestore.model.RangeRowQueryCriteria; +import com.alicloud.openservices.tablestore.model.ReservedThroughput; +import com.alicloud.openservices.tablestore.model.RowPutChange; +import com.alicloud.openservices.tablestore.model.Split; +import com.alicloud.openservices.tablestore.model.TableMeta; +import com.alicloud.openservices.tablestore.model.TableOptions; + +public class TestComputeSplitsBySize { + + private long sleepTime = 5l * 1000l; + + private SyncClient getClient() { + ServiceSettings settings = ServiceSettings.load(); + return new SyncClient(settings.getOTSEndpoint(), settings.getOTSAccessKeyId(), settings.getOTSAccessKeySecret(), settings.getOTSInstanceName()); + } + + /** + * 测试目的:验证ComputeSplitsBySize功能可以正常地将表格中的数据划分为多个数据块。 + * 测试内容:调用ComputeSplitsBySize接口获得该表格的数据分块,并检查所返回的数据中分块数目大于1。 + * @throws InterruptedException + */ + @Test + public void testComputeSplitsBySize() throws InterruptedException { + + // Testing configuration + String tableName = "testtargettable"; + String primaryKeyPrefix = "primarykey_"; + String columnNamePrefix = "columnName_"; + int maxNumberPrimaryKeysEachRow = 4; + int maxNumberColumnsEachRow = 128; + int defaultCuRead = 0; + int defaultCuWrite = 0; + + SyncClient client = getClient(); + WriterConfig config = new WriterConfig(); + + // Creating testing data + boolean ifCreateTable = true; + ListTableResponse ltr = client.listTable(); + for (String tn : ltr.getTableNames()) { + if (tn.equals(tableName)) { + ifCreateTable = false; + } + } + if (ifCreateTable) { + TableMeta tm = new TableMeta(tableName); + for (int j = 0; j < maxNumberPrimaryKeysEachRow; ++j) { + tm.addPrimaryKeyColumn(primaryKeyPrefix + j, PrimaryKeyType.STRING); + } + TableOptions to = new TableOptions(86400, 5, 86400); + ReservedThroughput rtp = new ReservedThroughput(new CapacityUnit(defaultCuRead, defaultCuWrite)); + CreateTableRequest ctr = new CreateTableRequest(tm, to, rtp); + client.createTable(ctr); + Thread.sleep(sleepTime); + } + + TableStoreWriter writer = new DefaultTableStoreWriter(client.asAsyncClient(), tableName, config, null, Executors.newFixedThreadPool(3)); + long startTime = System.currentTimeMillis(); + int bn = 0; + for (int i = 0; i < 100000; i++) { + RowPutChange brpc = new RowPutChange(tableName); + List pkcl = new ArrayList(); + for (int j = 0; j < maxNumberPrimaryKeysEachRow; ++j) { + String ss = primaryKeyPrefix + j; + pkcl.add(new PrimaryKeyColumn(ss, PrimaryKeyValue.fromString(ss + "_" + i + "_" + bn))); + } + PrimaryKey bwpk = new PrimaryKey(pkcl); + brpc.setPrimaryKey(bwpk); + for (int k = 0; k < maxNumberColumnsEachRow; ++k) { + String ss = columnNamePrefix + k; + brpc.addColumn(ss, ColumnValue.fromString(ss)); + } + writer.addRowChange(brpc); + } + + writer.flush(); + + // ComputeSplitsBySize operation + long splitSize = 1l; + ComputeSplitsBySizeRequest csbsr = new ComputeSplitsBySizeRequest(); + csbsr.setTableName(tableName); + csbsr.setSplitSizeIn100MB(splitSize); + ComputeSplitsBySizeResponse csbsrr = null; + try { + csbsrr = client.computeSplitsBySize(csbsr); + } catch( ClientException ce ) { + ce.printStackTrace(); + fail(); + } + + // To check and print the response. + assertTrue(csbsrr.getSplits().size() > 0); + for (Split split : csbsrr.getSplits()) { + assertNotNull(split.getLocation()); + assertTrue(!split.getLocation().equals("")); + } + + GetRangeRequest grr = new GetRangeRequest(); + RangeRowQueryCriteria rrqc = new RangeRowQueryCriteria(tableName); + rrqc.setDirection(Direction.FORWARD); + rrqc.setInclusiveStartPrimaryKey(csbsrr.getSplits().get(0).getLowerBound()); + PrimaryKey endPK = csbsrr.getSplits().get(0).getUpperBound(); + if (endPK.getPrimaryKeyColumns().length <= 1) { + List pkcl = new ArrayList(); + pkcl.add(endPK.getPrimaryKeyColumn(0)); + for (int i = 1; i < maxNumberPrimaryKeysEachRow; ++i) { + String ss = primaryKeyPrefix + i; + pkcl.add(new PrimaryKeyColumn(ss, PrimaryKeyValue.INF_MIN)); + } + endPK = new PrimaryKey(pkcl); + } + rrqc.setExclusiveEndPrimaryKey(endPK); + rrqc.setMaxVersions(5); + grr.setRangeRowQueryCriteria(rrqc); + GetRangeResponse grrs = null; + try { + grrs = client.getRange(grr); + } catch ( ClientException ce ) { + ce.printStackTrace(); + fail(); + } + + assertTrue(grrs.getRows().size() > 0); + + client.shutdown(); + } + + /** + * 测试目的:验证ComputeSplitsBySize功能可以正常地在空表格中进行操作。 + * 测试内容:调用ComputeSplitsBySize接口获得该表格的数据分块,并检查所返回的数据中分块数目等于1因为表格中没有数据。 + * @throws InterruptedException + */ + @Test + public void testComputeSplitsBySizeRequestWithEmptyDataSet() throws InterruptedException { + + // Testing configuration + String tableName = "testtargettable2"; + String primaryKeyPrefix = "primarykey_"; + int maxNumberPrimaryKeysEachRow = 4; + int defaultCuRead = 0; + int defaultCuWrite = 0; + SyncClient client = getClient(); + + // Creating empty table + ListTableResponse ltr = client.listTable(); + for (String tn : ltr.getTableNames()) { + if (tn.equals(tableName)) { + DeleteTableRequest dtr = new DeleteTableRequest(tableName); + client.deleteTable(dtr); + } + } + { + TableMeta tm = new TableMeta(tableName); + for (int j = 0; j < maxNumberPrimaryKeysEachRow; ++j) { + tm.addPrimaryKeyColumn(primaryKeyPrefix + j, PrimaryKeyType.STRING); + } + TableOptions to = new TableOptions(86400, 5, 86400); + ReservedThroughput rtp = new ReservedThroughput(new CapacityUnit(defaultCuRead, defaultCuWrite)); + CreateTableRequest ctr = new CreateTableRequest(tm, to, rtp); + client.createTable(ctr); + Thread.sleep(sleepTime); + } + + // ComputeSplitsBySize operation + long splitSize = 1l; + ComputeSplitsBySizeRequest csbsr = new ComputeSplitsBySizeRequest(); + csbsr.setTableName(tableName); + csbsr.setSplitSizeIn100MB(splitSize); + ComputeSplitsBySizeResponse csbsrr = null; + try { + csbsrr = client.computeSplitsBySize(csbsr); + } catch( TableStoreException tse ) { + tse.printStackTrace(); + fail(); + } catch( ClientException ce ) { + ce.printStackTrace(); + fail(); + } + + // To check and print the response. + assertTrue(csbsrr.getSplits().size() == 1); + for (Split split : csbsrr.getSplits()) { + assertNotNull(split.getLocation()); + assertTrue(!split.getLocation().equals("")); + } + + client.shutdown(); + } + + /** + * 测试目的:验证ComputeSplitsBySize功能在访问不存在的表格的时候会报出异常。 + * 测试内容:调用ComputeSplitsBySize接口在访问不存在的表格的时候会报出异常,且异常信息中会包含表格存在的错误异常信息。 + * @throws InterruptedException + */ + @Test + public void testComputeSplitsBySizeRequestWithNotExistedTable() throws InterruptedException { + + // Testing configuration + String tableName = "testtargettable3"; + SyncClient client = getClient(); + + // Creating empty table + ListTableResponse ltr = client.listTable(); + for (String tn : ltr.getTableNames()) { + if (tn.equals(tableName)) { + DeleteTableRequest dtr = new DeleteTableRequest(tableName); + client.deleteTable(dtr); + Thread.sleep(sleepTime); + } + } + + long splitSize = 1l; + ComputeSplitsBySizeRequest csbsr = new ComputeSplitsBySizeRequest(); + csbsr.setTableName(tableName); + csbsr.setSplitSizeIn100MB(splitSize); + try { + client.computeSplitsBySize(csbsr); + fail(); + } catch( TableStoreException tse ) { + if ( !tse.getMessage().contains("Requested table does not exist.") ) { + fail(); + } + } + } + + @Test + public void testComputeSplitsBySizeRequestWithNegativeSplitSize() throws InterruptedException { + // Testing configuration + String tableName = "testtargettable3"; + String primaryKeyPrefix = "primarykey_"; + int maxNumberPrimaryKeysEachRow = 4; + int defaultCuRead = 0; + int defaultCuWrite = 0; + SyncClient client = getClient(); + + // Creating empty table + ListTableResponse ltr = client.listTable(); + for (String tn : ltr.getTableNames()) { + if (tn.equals(tableName)) { + DeleteTableRequest dtr = new DeleteTableRequest(tableName); + client.deleteTable(dtr); + Thread.sleep(sleepTime); + } + } + { + TableMeta tm = new TableMeta(tableName); + for (int j = 0; j < maxNumberPrimaryKeysEachRow; ++j) { + tm.addPrimaryKeyColumn(primaryKeyPrefix + j, PrimaryKeyType.STRING); + } + TableOptions to = new TableOptions(86400, 5, 86400); + ReservedThroughput rtp = new ReservedThroughput(new CapacityUnit(defaultCuRead, defaultCuWrite)); + CreateTableRequest ctr = new CreateTableRequest(tm, to, rtp); + client.createTable(ctr); + Thread.sleep(sleepTime); + } + + long splitSize = -1l; + ComputeSplitsBySizeRequest csbsr = new ComputeSplitsBySizeRequest(); + csbsr.setTableName(tableName); + csbsr.setSplitSizeIn100MB(splitSize); + try { + client.computeSplitsBySize(csbsr); + fail(); + } catch( TableStoreException tse ) { + if ( !tse.getMessage().contains("split_size_in_MB is not positive") ) { + fail(); + } + } + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/BatchWriteTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/BatchWriteTest.java new file mode 100644 index 0000000..df39d36 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/BatchWriteTest.java @@ -0,0 +1,92 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.common.BaseFT; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.google.gson.JsonSyntaxException; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Logger; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +public class BatchWriteTest extends BaseFT { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static final String tableName = "BatchWriteTest"; + private static SyncClientInterface client; + private static Logger LOG = Logger.getLogger(BatchWriteTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + client = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + client.shutdown(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = client.listTable(); + + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + client.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + private void CreateTable(SyncClientInterface ots, String tableName, Map pk) throws Exception { + OTSHelper.createTable(ots, tableName, pk); + LOG.info("Create table: " + tableName); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + } + + /** + * public写重复行 + * @throws Exception + */ + @Test + public void testBatchWriteDuplicateRowsForPublic() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .build(); + + List updates = new ArrayList(); + RowUpdateChange updateChange = new RowUpdateChange(tableName, pk); + updateChange.put("attr", ColumnValue.fromString("hello world")); + updates.add(updateChange); + updates.add(updateChange); + BatchWriteRowResponse writeResponse = OTSHelper.batchWriteRow(client, null, updates, null); + assertTrue(writeResponse.isAllSucceed()); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.addColumnsToGet("PK1"); + query.addColumnsToGet("attr"); + query.setMaxVersions(1); + GetRowResponse readResponse = OTSHelper.getRow(client, query); + Row row = readResponse.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr").get(0).getValue().asString(), "hello world"); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/CapacityUnitTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/CapacityUnitTest.java new file mode 100644 index 0000000..d051452 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/CapacityUnitTest.java @@ -0,0 +1,949 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.common.BaseFT; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.*; +import com.google.gson.JsonSyntaxException; +import org.junit.*; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; + +public class CapacityUnitTest extends BaseFT { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static final String tableName = "CapacityUnitTest"; + private static SyncClientInterface client; + private static Logger LOG = Logger.getLogger(BatchWriteTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + client = Utils.getOTSInstance(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = client.listTable(); + + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + client.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + private void CreateTable(SyncClientInterface otsForPublic, String tableName, Map pk) throws Exception { + OTSHelper.createTable(otsForPublic, tableName, pk); + LOG.info("Create table: " + tableName); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + } + + public static PrimaryKeyValue getPKColumnValue(PrimaryKeyType type, String value) throws UnsupportedEncodingException { + switch (type) { + case INTEGER: + return PrimaryKeyValue.fromLong(Long.valueOf(value)); + case STRING: + return PrimaryKeyValue.fromString(value); + case BINARY: + return PrimaryKeyValue.fromBinary(value.getBytes("UTF-8")); + default: + throw new RuntimeException("Bug: not support : " + type); + } + } + + void assertCapacityUnitEqual(CapacityUnit ca, CapacityUnit cb) { + assertEquals(cb.getReadCapacityUnit(), ca.getReadCapacityUnit()); + assertEquals(cb.getWriteCapacityUnit(), ca.getWriteCapacityUnit()); + } + + String fixedSizeString(char c, long size) { + StringBuffer sb = new StringBuffer(); + for (long i = 0; i < size; ++i) { + sb.append(c); + } + return sb.toString(); + } + + /** + * 建一个表,不写数据,期望GetRow返回CU为1 + * @throws Exception + */ + @Test + public void testGetRowNonexistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "x"))); + + GetRowResponse result = OTSHelper.getRowForAll(client, tableName, new PrimaryKey(pk)); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 0)); + } + + /** + * 建一个表,写行"x",值大小为5K,读行"x",期望GetRow返回CU为2 + * @throws Exception + */ + @Test + public void testGetRowExistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "x"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 5000)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + + GetRowResponse result = OTSHelper.getRowForAll(client, tableName, new PrimaryKey(pk)); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(2, 0)); + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,期望GetRow('a')返回CU为1 + * @throws Exception + */ + @Test + public void testGetRowNonexistentSelect() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "x"))); + + List columns = new ArrayList(); + columns.add("a"); + + GetRowResponse result = OTSHelper.getRow(client, tableName, new PrimaryKey(pk), null, 1, columns); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 0)); + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"x",列"a","b","c","d","e",每列值大小2K,读行"x",期望GetRow("a", "b")返回CU为2 + * @throws Exception + */ + @Test + public void testGetRowSelectAllExistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "x"))); + + { + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("d", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("e", ColumnValue.fromString(fixedSizeString('a', 2048)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + { + List columns = new ArrayList(); + columns.add("a"); + columns.add("b"); + + GetRowResponse result = OTSHelper.getRow(client, tableName, new PrimaryKey(pk), null, 1, columns); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(2, 0)); + } + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"x",列"a","c","d",每列值大小2K,读行"x",期望GetRow("a", "b")返回CU为1 + * @throws Exception + */ + @Test + public void testGetRowSelectPartialExistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "x"))); + + { + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("d", ColumnValue.fromString(fixedSizeString('a', 2048)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + { + List columns = new ArrayList(); + columns.add("a"); + columns.add("b"); + + GetRowResponse result = OTSHelper.getRow(client, tableName, new PrimaryKey(pk), null, 1, columns); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 0)); + } + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"x",列"a","b","e",每列值大小4K,读行"x",期望GetRow("c", "d")返回CU为1 + * @throws Exception + */ + @Test + public void testGetRowSelectAllNonxistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "x"))); + + { + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("e", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + { + List columns = new ArrayList(); + columns.add("c"); + columns.add("d"); + + GetRowResponse result = OTSHelper.getRow(client, tableName, new PrimaryKey(pk), null, 1, columns); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 0)); + } + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"x","y","z",列"a","b","c","d","e",每列值大小2K,读行"x",期望BatchGetRow("x", "y", "z")返回每行CU为3 + * @throws Exception + */ + @Test + public void testBatchGetRow() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("d", ColumnValue.fromString(fixedSizeString('a', 2048)))); + columns.add(new Column("e", ColumnValue.fromString(fixedSizeString('a', 2048)))); + + String[] pkList = {"x", "y", "z"}; + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pkc), columns); + } + + MultiRowQueryCriteria multiRows = new MultiRowQueryCriteria(tableName); + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + + multiRows.addRow(new PrimaryKey(pkc)); + } + multiRows.setMaxVersions(1); + List request = new ArrayList(); + request.add(multiRows); + BatchGetRowResponse result = OTSHelper.batchGetRow(client, request); + List rowRets = result.getBatchGetRowResult(tableName); + + for (BatchGetRowResponse.RowResult ret: rowRets) { + CapacityUnit cu = ret.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(3, 0)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,期望GetRange("a", "b")返回CU为1 + * @throws Exception + */ + @Test + public void testGetRangeEmptyRange() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List startPK = new ArrayList(); + startPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List endPK = new ArrayList(); + endPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "b"))); + + RangeRowQueryCriteria query = new RangeRowQueryCriteria(tableName); + query.setInclusiveStartPrimaryKey(new PrimaryKey(startPK)); + query.setExclusiveEndPrimaryKey(new PrimaryKey(endPK)); + query.setMaxVersions(1); + + GetRangeResponse result = OTSHelper.getRange(client, query); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 0)); + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a",列"a","b","c",每列值大小4K,期望GetRange("a", "b")返回CU为4 + * @throws Exception + */ + @Test + public void testGetRange() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List startPK = new ArrayList(); + startPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List endPK = new ArrayList(); + endPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "b"))); + + RangeRowQueryCriteria query = new RangeRowQueryCriteria(tableName); + query.setInclusiveStartPrimaryKey(new PrimaryKey(startPK)); + query.setExclusiveEndPrimaryKey(new PrimaryKey(endPK)); + query.setMaxVersions(1); + + GetRangeResponse result = OTSHelper.getRange(client, query); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(4, 0)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a"和"b",列"a","b","c",每列值大小4K,期望GetRange("a", "c")返回CU为7 + * @throws Exception + */ + @Test + public void testGetRangeMultiRows() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "b"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List startPK = new ArrayList(); + startPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List endPK = new ArrayList(); + endPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "c"))); + + RangeRowQueryCriteria query = new RangeRowQueryCriteria(tableName); + query.setInclusiveStartPrimaryKey(new PrimaryKey(startPK)); + query.setExclusiveEndPrimaryKey(new PrimaryKey(endPK)); + query.setMaxVersions(1); + + GetRangeResponse result = OTSHelper.getRange(client, query); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(7, 0)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,期望GetRange("a", "b")("a")返回CU为1 + * @throws Exception + */ + @Test + public void testGetRangeEmptyRangeSelect() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List startPK = new ArrayList(); + startPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List endPK = new ArrayList(); + endPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "b"))); + + RangeRowQueryCriteria query = new RangeRowQueryCriteria(tableName); + query.setInclusiveStartPrimaryKey(new PrimaryKey(startPK)); + query.setExclusiveEndPrimaryKey(new PrimaryKey(endPK)); + query.setMaxVersions(1); + query.addColumnsToGet("a"); + + GetRangeResponse result = OTSHelper.getRange(client, query); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 0)); + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a"和"b",列"a","b","c",列"a每列值大小4K,期望GetRange("a", "c")("a", "b")返回CU为5 + * @throws Exception + */ + @Test + public void testGetRangeSelectAllExistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "b"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List startPK = new ArrayList(); + startPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List endPK = new ArrayList(); + endPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "c"))); + + RangeRowQueryCriteria query = new RangeRowQueryCriteria(tableName); + query.setInclusiveStartPrimaryKey(new PrimaryKey(startPK)); + query.setExclusiveEndPrimaryKey(new PrimaryKey(endPK)); + query.setMaxVersions(1); + query.addColumnsToGet("a"); + query.addColumnsToGet("b"); + + GetRangeResponse result = OTSHelper.getRange(client, query); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(5, 0)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a"和"b",列"a","b","c",列"a每列值大小4K,期望GetRange("a", "c")("d", "e")返回CU为1 + * @throws Exception + */ + @Test + public void testGetRangeSelectAllNonexistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "b"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List startPK = new ArrayList(); + startPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List endPK = new ArrayList(); + endPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "c"))); + + RangeRowQueryCriteria query = new RangeRowQueryCriteria(tableName); + query.setInclusiveStartPrimaryKey(new PrimaryKey(startPK)); + query.setExclusiveEndPrimaryKey(new PrimaryKey(endPK)); + query.setMaxVersions(1); + query.addColumnsToGet("d"); + query.addColumnsToGet("e"); + + GetRangeResponse result = OTSHelper.getRange(client, query); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 0)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a",列"a","b","c",行"b",列"a","c","e",每列值大小4K,期望GetRange("a", "c")("b", "e")返回CU为3 + * @throws Exception + */ + @Test + public void testGetRangeSelectPartialExistent() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "b"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("e", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List startPK = new ArrayList(); + startPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List endPK = new ArrayList(); + endPK.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "c"))); + + RangeRowQueryCriteria query = new RangeRowQueryCriteria(tableName); + query.setInclusiveStartPrimaryKey(new PrimaryKey(startPK)); + query.setExclusiveEndPrimaryKey(new PrimaryKey(endPK)); + query.setMaxVersions(1); + query.addColumnsToGet("b"); + query.addColumnsToGet("e"); + + GetRangeResponse result = OTSHelper.getRange(client, query); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(3, 0)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a",列"a","b","c",每列值大小4K,期望PutRow("a")("b": 4096, "e": 4096)返回CU为3 + * @throws Exception + */ + @Test + public void testPutRow() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("e", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + PutRowResponse result = OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(0, 3)); + } + + OTSHelper.deleteTable(client, tableName); + } + + @Test + public void testPutRowExpectExistOrNotExist() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("e", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + RowPutChange rowChange = new RowPutChange(tableName, new PrimaryKey(pk)); + for (Column col : columns) { + rowChange.addColumn(col); + } + rowChange.setCondition(new Condition(RowExistenceExpectation.EXPECT_NOT_EXIST)); + PutRowResponse result = OTSHelper.putRow(client, rowChange); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 3)); + + rowChange.setCondition(new Condition(RowExistenceExpectation.EXPECT_EXIST)); + result = OTSHelper.putRow(client, rowChange); + cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 3)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a",列"a","b","c",每列值大小4K,期望UpdateRow("a")("b": 4096, "e": 4096)返回CU为3 + * @throws Exception + */ + @Test + public void testUpdateRow() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + RowUpdateChange row = new RowUpdateChange(tableName, new PrimaryKey(pk)); + row.put(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + row.put(new Column("e", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + UpdateRowResponse result = OTSHelper.updateRow(client, row); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(0, 3)); + } + + OTSHelper.deleteTable(client, tableName); + } + + @Test + public void testUpdateRowExpectExist() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + RowUpdateChange row = new RowUpdateChange(tableName, new PrimaryKey(pk)); + row.put(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + row.put(new Column("e", ColumnValue.fromString(fixedSizeString('a', 4096)))); + row.deleteColumns("a"); + row.deleteColumns("c"); + row.setCondition(new Condition(RowExistenceExpectation.EXPECT_EXIST)); + UpdateRowResponse result = OTSHelper.updateRow(client, row); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 3)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a",列"a","b","c",每列值大小4K,期望DeleteRow("a")返回CU为1 + * @throws Exception + */ + @Test + public void testDeleteRow() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pk), columns); + } + + { + List pk = new ArrayList(); + pk.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, "a"))); + + RowDeleteChange row = new RowDeleteChange(tableName, new PrimaryKey(pk)); + + DeleteRowResponse result = OTSHelper.deleteRow(client, row); + CapacityUnit cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(0, 1)); + + row.setCondition(new Condition(RowExistenceExpectation.EXPECT_NOT_EXIST)); + result = OTSHelper.deleteRow(client, row); + cu = result.getConsumedCapacity().getCapacityUnit(); + assertCapacityUnitEqual(cu, new CapacityUnit(1, 1)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a","b","c",列"a","b","c",每列值大小4K, + * BatchWriteRow分别PutRow("a", "b", "c")("b": 4096, "e": 4096), + * 期望返回CU分别为3,3,3 + * @throws Exception + */ + @Test + public void testBatchPutRow() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + String[] pkList = {"a", "b", "c"}; + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pkc), columns); + } + + List putRows = new ArrayList(); + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + RowPutChange putRow = new RowPutChange(tableName, new PrimaryKey(pkc)); + putRow.addColumn("b", ColumnValue.fromString(fixedSizeString('a', 4096))); + putRow.addColumn("e", ColumnValue.fromString(fixedSizeString('a', 4096))); + putRows.add(putRow); + } + + BatchWriteRowResponse result = OTSHelper.batchWriteRow(client, putRows, null, null); + + List putRets = result.getRowStatus(tableName); + for (BatchWriteRowResponse.RowResult ret: putRets) { + assertCapacityUnitEqual(ret.getConsumedCapacity().getCapacityUnit(), new CapacityUnit(0, 3)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a","b","c",列"a","b","c",每列值大小4K, + * BatchWriteRow分别UpdateRow("a", "b", "c")("b": 4096, "e": 4096), + * 期望返回CU分别为3,3,3 + * @throws Exception + */ + @Test + public void testBatchUpdateRow() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + String[] pkList = {"a", "b", "c"}; + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pkc), columns); + } + + List updateRows = new ArrayList(); + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + RowUpdateChange updateRow = new RowUpdateChange(tableName, new PrimaryKey(pkc)); + updateRow.put("b", ColumnValue.fromString(fixedSizeString('a', 4096))); + updateRow.put("e", ColumnValue.fromString(fixedSizeString('a', 4096))); + updateRows.add(updateRow); + } + + BatchWriteRowResponse result = OTSHelper.batchWriteRow(client, null, updateRows, null); + + List updateRets = result.getRowStatus(tableName); + for (BatchWriteRowResponse.RowResult ret: updateRets) { + assertCapacityUnitEqual(ret.getConsumedCapacity().getCapacityUnit(), new CapacityUnit(0, 3)); + } + + OTSHelper.deleteTable(client, tableName); + } + + /** + * 建一个表,写行"a","b","c",列"a","b","c",每列值大小4K, + * BatchWriteRow分别DeleteRow("a", "b", "c"), + * 期望返回CU分别为1,1,1 + * @throws Exception + */ + @Test + public void testBatchDeleteRow() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + List columns = new ArrayList(); + columns.add(new Column("a", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("b", ColumnValue.fromString(fixedSizeString('a', 4096)))); + columns.add(new Column("c", ColumnValue.fromString(fixedSizeString('a', 4096)))); + + String[] pkList = {"a", "b", "c"}; + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + + OTSHelper.putRow(client, tableName, new PrimaryKey(pkc), columns); + } + + List deleteRows = new ArrayList(); + for (String pk: pkList) { + List pkc = new ArrayList(); + pkc.add(new PrimaryKeyColumn("PK1", getPKColumnValue(PrimaryKeyType.STRING, pk))); + RowDeleteChange deleteRow = new RowDeleteChange(tableName, new PrimaryKey(pkc)); + deleteRows.add(deleteRow); + } + + BatchWriteRowResponse result = OTSHelper.batchWriteRow(client, null, null, deleteRows); + + List deleteRets = result.getRowStatus(tableName); + for (BatchWriteRowResponse.RowResult ret: deleteRets) { + assertCapacityUnitEqual(ret.getConsumedCapacity().getCapacityUnit(), new CapacityUnit(0, 1)); + } + + OTSHelper.deleteTable(client, tableName); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/CreateTableTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/CreateTableTest.java new file mode 100644 index 0000000..464010c --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/CreateTableTest.java @@ -0,0 +1,200 @@ +package com.alicloud.openservices.tablestore.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Logger; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.alicloud.openservices.tablestore.SyncClientInterface; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.common.BaseFT; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.google.gson.JsonSyntaxException; + +public class CreateTableTest extends BaseFT { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static final String tableName = "CreateTableTest"; + private static SyncClientInterface client; + private static Logger LOG = Logger.getLogger(BatchWriteTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + client = Utils.getOTSInstance(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = client.listTable(); + + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + client.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + public static boolean checkNameExiste(List names, String name) { + for (String n : names) { + if (n.equals(name)) { + return true; + } + } + return false; + } + + public void testCommon(SyncClientInterface ots, PrimaryKeyType type, + int writeCU, int readCU, int timeToLive, int maxVersions) throws Exception { + int pkNum = 1 + ((int)Math.random() % 4); + Map pks = new TreeMap(); + for (int i = 0; i < pkNum; ++i) { + pks.put("PK" + Integer.toString(i), type); + } + + OTSHelper.createTable(ots, tableName, pks, readCU, writeCU, timeToLive, maxVersions); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + + DescribeTableResponse result = OTSHelper.describeTable(ots, tableName); + + assertEquals(pkNum, result.getTableMeta().getPrimaryKeyList().size()); + + for (int i = 0; i < pkNum; ++i) { + assertEquals("PK" + Integer.toString(i), result.getTableMeta().getPrimaryKeyList().get(i).getName()); + assertEquals(type, result.getTableMeta().getPrimaryKeyList().get(i).getType()); + } + + assertEquals(readCU, result.getReservedThroughputDetails().getCapacityUnit().getReadCapacityUnit()); + assertEquals(writeCU, result.getReservedThroughputDetails().getCapacityUnit().getWriteCapacityUnit()); + + assertTrue(result.getTableOptions().hasSetMaxVersions()); + assertTrue(result.getTableOptions().hasSetTimeToLive()); + + assertEquals(maxVersions, result.getTableOptions().getMaxVersions()); + assertEquals(timeToLive, result.getTableOptions().getTimeToLive()); + } + + /** + * 创建表的时候,TableMeta中有2个PK列,列名重复,期望返回OTSParameterInvalid,list table()确认没有这个表 + * @throws Exception + */ + @Test + public void testWithDuplicatePK() throws Exception { + try { + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("PK1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("PK1", PrimaryKeyType.STRING); + CreateTableRequest request = new CreateTableRequest(tableMeta, new com.alicloud.openservices.tablestore.model.TableOptions(-1, 1)); + request.setReservedThroughput(new ReservedThroughput(5000, 4000)); + client.createTable(request); + assertTrue(false); + } catch (TableStoreException e) { + assertEquals(ErrorCode.INVALID_PARAMETER, e.getErrorCode()); + } + + assertFalse(checkNameExiste(OTSHelper.listTable(client), tableName)); + } + + /** + * 建表的时候,0 CU,期望正常,describe table()获取信息与创表参数一致 + * @throws Exception + */ + @Test + public void testWithZeroCU() throws Exception { + int writeCU = 0; + int readCU = 0; + int timeToLive = 86400; + int maxVersions = (int)(Math.random() * 100) + 1; + PrimaryKeyType type = PrimaryKeyType.STRING; + testCommon(client, type, writeCU, readCU, timeToLive, maxVersions); + } + + /** + * 建表的时候,timeToLive为-1,期望正常,describe table()获取信息与创表参数一致 + * @throws Exception + */ + @Test + public void testWithNoTTL() throws Exception { + int writeCU = 0; + int readCU = 0; + int timeToLive = -1; + int maxVersions = (int)(Math.random() * 100) + 1; + PrimaryKeyType type = PrimaryKeyType.STRING; + testCommon(client, type, writeCU, readCU, timeToLive, maxVersions); + } + + /** + * 建表的时候,都为STRING类型,期望正常,describe table()获取信息与创表参数一致 + * @throws Exception + */ + @Test + public void testWithStringPK() throws Exception { + int writeCU = 0; + int readCU = 0; + int timeToLive = 86400; + int maxVersions = (int)(Math.random() * 100) + 1; + PrimaryKeyType type = PrimaryKeyType.STRING; + testCommon(client, type, writeCU, readCU, timeToLive, maxVersions); + } + + /** + * 创建表的时候,TableMeta中有4个PK列,都为INTEGER类型,期望正常,describe table()获取信息与创表参数一致 + * @throws Exception + */ + @Test + public void testWithIntegerPK() throws Exception { + int writeCU = 0; + int readCU = 0; + int timeToLive = 86400; + int maxVersions = (int)(Math.random() * 100) + 1; + PrimaryKeyType type = PrimaryKeyType.INTEGER; + testCommon(client, type, writeCU, readCU, timeToLive, maxVersions); + } + + /** + * 创建表的时候,TableMeta中有4个PK列,都为BINARY类型,期望正常,describe table()获取信息与创表参数一致 + * @throws Exception + */ + @Test + public void testWithBinaryPK() throws Exception { + int writeCU = 0; + int readCU = 0; + int timeToLive = 86400; + int maxVersions = (int)(Math.random() * 100) + 1; + PrimaryKeyType type = PrimaryKeyType.BINARY; + testCommon(client, type, writeCU, readCU, timeToLive, maxVersions); + } + + /** + * public实例,建表指定maxTimeDeviation + * @throws Exception + */ + @Test + public void testSetMaxTimeDeviation() throws Exception { + Map pks = new TreeMap(); + pks.put("PK0", PrimaryKeyType.STRING); + + TableOptions tableOptions = new TableOptions(-1, 1); + int deviation = 256 * 1024; + tableOptions.setMaxTimeDeviation(deviation); + CreateTableRequest request = new CreateTableRequest(OTSHelper.getTableMeta(tableName, pks), tableOptions); + request.setReservedThroughput(new ReservedThroughput(0, 0)); + client.createTable(request); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + + DescribeTableResponse result = OTSHelper.describeTable(client, tableName); + assertEquals(result.getTableOptions().getMaxTimeDeviation(), deviation); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/DeleteRowTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/DeleteRowTest.java new file mode 100644 index 0000000..657f443 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/DeleteRowTest.java @@ -0,0 +1,214 @@ +package com.alicloud.openservices.tablestore.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Logger; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.alicloud.openservices.tablestore.SyncClientInterface; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.google.gson.JsonSyntaxException; + +public class DeleteRowTest { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static final String tableName = "DeleteRowTest"; + private static SyncClientInterface client; + private static Logger LOG = Logger.getLogger(BatchWriteTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + client = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + client.shutdown(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = client.listTable(); + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + client.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + private void CreateTable(SyncClientInterface ots, String tableName, Map pk) throws Exception { + OTSHelper.createTable(ots, tableName, pk); + LOG.info("Create table: " + tableName); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + } + + /** + * 删除不存在的行,期望行存在性:IGNORE + * @throws Exception + */ + @Test + public void testDeleteNonExistRowWithIGnoreForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + OTSHelper.deleteRow(client, tableName, pk, RowExistenceExpectation.IGNORE); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row, null); + } + + /** + * 删除不存在的行,期望行存在性:存在,抛错 + * @throws Exception + */ + @Test + public void testDeleteNonExistRowWithExpectExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + try { + OTSHelper.deleteRow(client, tableName, pk, RowExistenceExpectation.EXPECT_EXIST); + assertTrue(false); + } catch (TableStoreException e) { + LOG.info(e.toString()); + assertEquals(ErrorCode.CONDITION_CHECK_FAIL, e.getErrorCode()); + } + } + + /** + * 删除不存在的行,期望行存在性:不存在 + * @throws Exception + */ + @Test + public void testDeleteExistRowWithExpectNonExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + OTSHelper.deleteRow(client, tableName, pk, RowExistenceExpectation.EXPECT_NOT_EXIST); + } + + /** + * 删除存在的行,期望行存在性:IGNORE + * @throws Exception + */ + @Test + public void testDeleteExistRowWithIGnoreForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + OTSHelper.deleteRow(client, tableName, pk, RowExistenceExpectation.IGNORE); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row, null); + } + + /** + * 删除存在的行,期望行存在性:存在 + * @throws Exception + */ + @Test + public void testDeleteExistRowWithExpectExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + // 删除相同行 + OTSHelper.deleteRow(client, tableName, pk, RowExistenceExpectation.EXPECT_EXIST); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row, null); + } + + /** + * 删除存在的行,期望行存在性:不存在,抛错 + * @throws Exception + */ + @Test + public void testDeleteNonExistRowWithExpectNonExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + try { + OTSHelper.deleteRow(client, tableName, pk, RowExistenceExpectation.EXPECT_NOT_EXIST); + } catch (TableStoreException e) { + LOG.info(e.toString()); + assertEquals(ErrorCode.CONDITION_CHECK_FAIL, e.getErrorCode()); + } + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/GetRowTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/GetRowTest.java new file mode 100644 index 0000000..cf6342e --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/GetRowTest.java @@ -0,0 +1,110 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.common.BaseFT; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.google.gson.JsonSyntaxException; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; + +public class GetRowTest extends BaseFT { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static final String tableName = "GetRowTest"; + private static SyncClientInterface client; + private static Logger LOG = Logger.getLogger(BatchWriteTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + client = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + client.shutdown(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = client.listTable(); + + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + client.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + private void CreateTable(SyncClientInterface ots, String tableName, Map pk) throws Exception { + OTSHelper.createTable(ots, tableName, pk); + LOG.info("Create table: " + tableName); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + } + + /** + * 不指定列读,public返回的列中不包含主键列 + * @throws Exception + */ + @Test + public void testReadWithoutColumnsForPublic() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .build(); + + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns); + + GetRowResponse response = OTSHelper.getRow(client, tableName, pk); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr").get(0).getValue().asString(), "hello world"); + } + + /** + * 指定主键列读,public返回的列中不包含主键列 + * @throws Exception + */ + @Test + public void testReadPKColumnsForPublic() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .build(); + + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.addColumnsToGet("PK1"); + query.addColumnsToGet("attr"); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr").get(0).getValue().asString(), "hello world"); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/PutRowTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/PutRowTest.java new file mode 100644 index 0000000..0370d92 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/PutRowTest.java @@ -0,0 +1,264 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.common.BaseFT; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.google.gson.JsonSyntaxException; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Logger; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; + +public class PutRowTest extends BaseFT { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static final String tableName = "PutRowTest"; + private static SyncClientInterface client; + private static Logger LOG = Logger.getLogger(BatchWriteTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + client = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + client.shutdown(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = client.listTable(); + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + client.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + private void CreateTable(SyncClientInterface ots, String tableName, Map pk) throws Exception { + OTSHelper.createTable(ots, tableName, pk); + LOG.info("Create table: " + tableName); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + } + + /** + * internal写入的行pk无序 + * @throws Exception + */ + @Test + public void testWriteDisorderedPKsForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .build(); + + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + try { + OTSHelper.putRow(client, tableName, pk, columns); + assertTrue(false); + } catch (TableStoreException e) { + LOG.info(e.toString()); + assertTableStoreException(ErrorCode.INVALID_PK, "Validate PK name fail. Input: PK2, Meta: PK1.", 400, e); + } + } + + /** + * 插入不存在的行,期望行存在性:IGNORE + * @throws Exception + */ + @Test + public void testPutNonExistRowWithIGnoreForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入不存在的行,期望行存在性:存在,抛错 + * @throws Exception + */ + @Test + public void testPutNonExistRowWithExpectExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + try { + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.EXPECT_EXIST); + assertTrue(false); + } catch (TableStoreException e) { + LOG.info(e.toString()); + assertEquals(ErrorCode.CONDITION_CHECK_FAIL, e.getErrorCode()); + } + } + + /** + * 插入不存在的行,期望行存在性:不存在 + * @throws Exception + */ + @Test + public void testPutExistRowWithExpectNonExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.EXPECT_NOT_EXIST); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入存在的行,期望行存在性:IGNORE + * @throws Exception + */ + @Test + public void testPutExistRowWithIGnoreForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + // 写入相同行 + columns.put("attr1", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 2); + assertEquals(row.getColumn("attr").get(0).getValue().asString(), "hello world"); + assertEquals(row.getColumn("attr1").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入存在的行,期望行存在性:存在 + * @throws Exception + */ + @Test + public void testPutExistRowWithExpectExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + // 写入相同行 + columns.put("attr1", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.EXPECT_EXIST); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 2); + assertEquals(row.getColumn("attr").get(0).getValue().asString(), "hello world"); + assertEquals(row.getColumn("attr1").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入存在的行,期望行存在性:不存在,抛错 + * @throws Exception + */ + @Test + public void testPutNonExistRowWithExpectNonExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + Map columns = new TreeMap(); + columns.put("attr", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.IGNORE); + + // 写入相同行 + try { + columns.put("attr1", ColumnValue.fromString("hello world")); + OTSHelper.putRow(client, tableName, pk, columns, RowExistenceExpectation.EXPECT_NOT_EXIST); + } catch (TableStoreException e) { + LOG.info(e.toString()); + assertEquals(ErrorCode.CONDITION_CHECK_FAIL, e.getErrorCode()); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowRequest.java new file mode 100644 index 0000000..fd5284f --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowRequest.java @@ -0,0 +1,201 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.common.TestUtil; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestBatchGetRowRequest { + + @Test + public void testEmptyRequest() { + BatchGetRowRequest request = new BatchGetRowRequest(); + + assertTrue(request.isEmpty()); + assertTrue(request.getCriteriasByTable().isEmpty()); + assertTrue(request.getCriteria("NonExistTable") == null); + assertTrue(request.getPrimaryKey("NonExistTable", 2) == null); + } + + private void checkTable(BatchGetRowRequest request, MultiRowQueryCriteria criteria, String tableName) { + assertTrue(request.getCriteria(tableName) != null); + MultiRowQueryCriteria target = request.getCriteria(tableName); + + List pks = criteria.getRowKeys(); + assertEquals(target.getRowKeys().size(), pks.size()); + for (int i = 0; i < pks.size(); i++) { + assertEquals(target.get(i), criteria.get(i)); + assertEquals(request.getPrimaryKey(tableName, i), criteria.get(i)); + } + } + + @Test + public void testRequest_WithOneTable() { + BatchGetRowRequest request = new BatchGetRowRequest(); + String tableName = "MyTable"; + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + PrimaryKeySchema[] schema = TestUtil.randomPrimaryKeySchema(5); + + List pks = new ArrayList(); + for (int i = 0; i < 100; i++) { + pks.add(TestUtil.randomPrimaryKey(schema)); + } + + for (PrimaryKey pk : pks) { + criteria.addRow(pk); + } + + request.addMultiRowQueryCriteria(criteria); + assertEquals(request.getCriteriasByTable().size(), 1); + + checkTable(request, criteria, tableName); + } + + @Test + public void testRequest_WithMultiTable() { + BatchGetRowRequest request = new BatchGetRowRequest(); + String tableName1 = "MyTable1"; + MultiRowQueryCriteria criteria1 = new MultiRowQueryCriteria(tableName1); + String tableName2 = "MyTable2"; + MultiRowQueryCriteria criteria2 = new MultiRowQueryCriteria(tableName2); + { + PrimaryKeySchema[] schema = TestUtil.randomPrimaryKeySchema(5); + + List pks = new ArrayList(); + for (int i = 0; i < 100; i++) { + pks.add(TestUtil.randomPrimaryKey(schema)); + } + + for (PrimaryKey pk : pks) { + criteria1.addRow(pk); + } + + request.addMultiRowQueryCriteria(criteria1); + } + { + PrimaryKeySchema[] schema = TestUtil.randomPrimaryKeySchema(5); + + List pks = new ArrayList(); + for (int i = 0; i < 50; i++) { + pks.add(TestUtil.randomPrimaryKey(schema)); + } + + for (PrimaryKey pk : pks) { + criteria2.addRow(pk); + } + + request.addMultiRowQueryCriteria(criteria2); + } + + assertEquals(request.getCriteriasByTable().size(), 2); + checkTable(request, criteria1, tableName1); + checkTable(request, criteria2, tableName2); + } + + @Test + public void testRequest_InvalidParameter() { + BatchGetRowRequest request = new BatchGetRowRequest(); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("MyTable"); + try { + // add empty parameter + request.addMultiRowQueryCriteria(criteria); + fail(); + } catch (IllegalArgumentException e) { + } + } + + @Test + public void testCreateRequestForRetry() { + BatchGetRowRequest request = new BatchGetRowRequest(); + MultiRowQueryCriteria criteria1 = new MultiRowQueryCriteria("Table1"); + criteria1.addColumnsToGet("Column1"); + criteria1.setMaxVersions(1); + criteria1.setTimeRange(new TimeRange(1, 100)); + List pks1 = new ArrayList(); + pks1.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1)).build()); + pks1.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(2)).build()); + pks1.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(3)).build()); + pks1.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(4)).build()); + pks1.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(5)).build()); + + for (PrimaryKey pk : pks1) { + criteria1.addRow(pk); + } + request.addMultiRowQueryCriteria(criteria1); + + MultiRowQueryCriteria criteria2 = new MultiRowQueryCriteria("Table2"); + List pks2 = new ArrayList(); + pks2.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1)).build()); + pks2.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(2)).build()); + pks2.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(3)).build()); + pks2.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(4)).build()); + pks2.add(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(5)).build()); + + for (PrimaryKey pk : pks2) { + criteria2.addRow(pk); + } + request.addMultiRowQueryCriteria(criteria2); + + // test no failed rows + List failedRows = new ArrayList(); + BatchGetRowRequest retryRequest = request.createRequestForRetry(failedRows); + assertTrue(retryRequest.isEmpty()); + + // test multi failed rows with one table + failedRows.add(new BatchGetRowResponse.RowResult("Table1", null, 1)); + failedRows.add(new BatchGetRowResponse.RowResult("Table1", null, 2)); + failedRows.add(new BatchGetRowResponse.RowResult("Table1", null, 4)); + + retryRequest = request.createRequestForRetry(failedRows); + assertTrue(!retryRequest.isEmpty()); + assertEquals(retryRequest.getCriteriasByTable().size(), 1); + assertTrue(retryRequest.getCriteria("Table1") != null); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().size(), 3); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().get(0), pks1.get(1)); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().get(1), pks1.get(2)); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().get(2), pks1.get(4)); + + // test multi failed rows with multi table + failedRows.add(new BatchGetRowResponse.RowResult("Table2", null, 1)); + failedRows.add(new BatchGetRowResponse.RowResult("Table2", null, 3)); + + retryRequest = request.createRequestForRetry(failedRows); + assertTrue(!retryRequest.isEmpty()); + assertEquals(retryRequest.getCriteriasByTable().size(), 2); + assertTrue(retryRequest.getCriteria("Table1") != null); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().size(), 3); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().get(0), pks1.get(1)); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().get(1), pks1.get(2)); + assertEquals(retryRequest.getCriteria("Table1").getRowKeys().get(2), pks1.get(4)); + assertTrue(retryRequest.getCriteria("Table2") != null); + assertEquals(retryRequest.getCriteria("Table2").getRowKeys().size(), 2); + assertEquals(retryRequest.getCriteria("Table2").getRowKeys().get(0), pks2.get(1)); + assertEquals(retryRequest.getCriteria("Table2").getRowKeys().get(1), pks2.get(3)); + + // test failed rows with non-exist index + List tmp = new ArrayList(); + tmp.addAll(failedRows); + tmp.add(new BatchGetRowResponse.RowResult("Table2", null, 5)); + try { + request.createRequestForRetry(tmp); + fail(); + } catch (IllegalArgumentException e) { + + } + + // test failed rows with non-exist table + tmp = new ArrayList(); + tmp.addAll(failedRows); + tmp.add(new BatchGetRowResponse.RowResult("Table3", null, 1)); + try { + request.createRequestForRetry(tmp); + fail(); + } catch (IllegalArgumentException e) { + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowResponse.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowResponse.java new file mode 100644 index 0000000..2da4189 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchGetRowResponse.java @@ -0,0 +1,187 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.common.TestUtil; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TestBatchGetRowResponse { + + @Test + public void testEmptyResult() { + BatchGetRowResponse result = new BatchGetRowResponse(new Response()); + + assertTrue(result.isAllSucceed()); + assertTrue(result.getFailedRows().isEmpty()); + assertTrue(result.getBatchGetRowResult("MyTable") == null); + assertTrue(result.getTableToRowsResult().isEmpty()); + + List succeed = new ArrayList(); + List failed = new ArrayList(); + result.getResult(succeed, failed); + assertTrue(succeed.isEmpty()); + assertTrue(failed.isEmpty()); + assertTrue(result.getFailedRows().isEmpty()); + assertTrue(result.getSucceedRows().isEmpty()); + } + + @Test + public void testResult_AllSucceed() { + BatchGetRowResponse result = new BatchGetRowResponse(new Response()); + Row[] rows = new Row[10]; + for (int i = 0; i < rows.length; i++) { + rows[i] = TestUtil.randomRow(3, 10); + } + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[0], null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[1], null, 1)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[2], null, 2)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[3], null, 3)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[4], null, 4)); + + result.addResult(new BatchGetRowResponse.RowResult("Table2", rows[5], null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table2", rows[6], null, 1)); + result.addResult(new BatchGetRowResponse.RowResult("Table2", rows[7], null, 2)); + + result.addResult(new BatchGetRowResponse.RowResult("Table3", rows[8], null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table3", rows[9], null, 1)); + + assertTrue(result.isAllSucceed()); + assertTrue(result.getFailedRows().isEmpty()); + assertEquals(result.getSucceedRows().size(), 10); + for (int i = 0; i < 10; i++) { + assertTrue(result.getSucceedRows().get(i).isSucceed()); + } + + assertEquals(result.getTableToRowsResult().size(), 3); + assertEquals(result.getTableToRowsResult().get("Table1").size(), 5); + + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(0).getRow(), rows[0]); + assertTrue(result.getTableToRowsResult().get("Table1").get(0).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(1).getRow(), rows[1]); + assertTrue(result.getTableToRowsResult().get("Table1").get(1).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(2).getRow(), rows[2]); + assertTrue(result.getTableToRowsResult().get("Table1").get(2).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(3).getRow(), rows[3]); + assertTrue(result.getTableToRowsResult().get("Table1").get(3).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(4).getRow(), rows[4]); + assertTrue(result.getTableToRowsResult().get("Table1").get(4).isSucceed()); + + assertEquals(result.getTableToRowsResult().get("Table2").size(), 3); + TestUtil.compareRow(result.getTableToRowsResult().get("Table2").get(0).getRow(), rows[5]); + assertTrue(result.getTableToRowsResult().get("Table2").get(0).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table2").get(1).getRow(), rows[6]); + assertTrue(result.getTableToRowsResult().get("Table2").get(1).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table2").get(2).getRow(), rows[7]); + assertTrue(result.getTableToRowsResult().get("Table2").get(2).isSucceed()); + + assertEquals(result.getTableToRowsResult().get("Table3").size(), 2); + TestUtil.compareRow(result.getTableToRowsResult().get("Table3").get(0).getRow(), rows[8]); + assertTrue(result.getTableToRowsResult().get("Table3").get(0).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table3").get(1).getRow(), rows[9]); + assertTrue(result.getTableToRowsResult().get("Table3").get(1).isSucceed()); + } + + @Test + public void testResult_AllFailed() { + BatchGetRowResponse result = new BatchGetRowResponse(new Response()); + + result.addResult(new BatchGetRowResponse.RowResult("Table1", null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", null, 1)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", null, 2)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", null, 3)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", null, 4)); + + result.addResult(new BatchGetRowResponse.RowResult("Table2", null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table2", null, 1)); + result.addResult(new BatchGetRowResponse.RowResult("Table2", null, 2)); + + result.addResult(new BatchGetRowResponse.RowResult("Table3", null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table3", null, 1)); + + assertTrue(!result.isAllSucceed()); + assertEquals(result.getFailedRows().size(), 10); + assertEquals(result.getSucceedRows().size(), 0); + + for (BatchGetRowResponse.RowResult rowResult : result.getFailedRows()) { + assertTrue(!rowResult.isSucceed()); + } + + assertEquals(result.getTableToRowsResult().size(), 3); + assertEquals(result.getTableToRowsResult().get("Table1").size(), 5); + + assertTrue(!result.getTableToRowsResult().get("Table1").get(0).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table1").get(1).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table1").get(2).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table1").get(3).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table1").get(4).isSucceed()); + + assertEquals(result.getTableToRowsResult().get("Table2").size(), 3); + assertTrue(!result.getTableToRowsResult().get("Table2").get(0).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table2").get(1).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table2").get(2).isSucceed()); + + assertEquals(result.getTableToRowsResult().get("Table3").size(), 2); + assertTrue(!result.getTableToRowsResult().get("Table3").get(0).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table3").get(1).isSucceed()); + } + + @Test + public void testResult_Mix() { + BatchGetRowResponse result = new BatchGetRowResponse(new Response()); + Row[] rows = new Row[6]; + for (int i = 0; i < rows.length; i++) { + rows[i] = TestUtil.randomRow(3, 10); + } + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[0], null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", null, 1)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[1], null, 2)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", null, 3)); + result.addResult(new BatchGetRowResponse.RowResult("Table1", rows[2], null, 4)); + + result.addResult(new BatchGetRowResponse.RowResult("Table2", rows[3], null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table2", null, 1)); + result.addResult(new BatchGetRowResponse.RowResult("Table2", rows[4], null, 2)); + + result.addResult(new BatchGetRowResponse.RowResult("Table3", rows[5], null, 0)); + result.addResult(new BatchGetRowResponse.RowResult("Table3", null, 1)); + + assertTrue(!result.isAllSucceed()); + assertEquals(result.getFailedRows().size(), 4); + assertEquals(result.getSucceedRows().size(), 6); + for (int i = 0; i < 6; i++) { + assertTrue(result.getSucceedRows().get(i).isSucceed()); + } + + for (int i = 0; i < 4; i++) { + assertTrue(!result.getFailedRows().get(i).isSucceed()); + } + + assertEquals(result.getTableToRowsResult().size(), 3); + assertEquals(result.getTableToRowsResult().get("Table1").size(), 5); + + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(0).getRow(), rows[0]); + assertTrue(result.getTableToRowsResult().get("Table1").get(0).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table1").get(1).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(2).getRow(), rows[1]); + assertTrue(result.getTableToRowsResult().get("Table1").get(2).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table1").get(3).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table1").get(4).getRow(), rows[2]); + assertTrue(result.getTableToRowsResult().get("Table1").get(4).isSucceed()); + + assertEquals(result.getTableToRowsResult().get("Table2").size(), 3); + TestUtil.compareRow(result.getTableToRowsResult().get("Table2").get(0).getRow(), rows[3]); + assertTrue(result.getTableToRowsResult().get("Table2").get(0).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table2").get(1).isSucceed()); + TestUtil.compareRow(result.getTableToRowsResult().get("Table2").get(2).getRow(), rows[4]); + assertTrue(result.getTableToRowsResult().get("Table2").get(2).isSucceed()); + + assertEquals(result.getTableToRowsResult().get("Table3").size(), 2); + TestUtil.compareRow(result.getTableToRowsResult().get("Table3").get(0).getRow(), rows[5]); + assertTrue(result.getTableToRowsResult().get("Table3").get(0).isSucceed()); + assertTrue(!result.getTableToRowsResult().get("Table3").get(1).isSucceed()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowRequest.java new file mode 100644 index 0000000..d92f16f --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowRequest.java @@ -0,0 +1,187 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.common.TestUtil; +import org.junit.Test; + +import java.lang.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import static org.junit.Assert.*; + +public class TestBatchWriteRowRequest { + + @Test + public void testEmptyRequest() { + BatchWriteRowRequest request = new BatchWriteRowRequest(); + + assertTrue(request.isEmpty()); + assertTrue(request.getRowChange().isEmpty()); + assertTrue(request.getRowChange("NonExistTable", 0) == null); + } + + @Test + public void testRequest_RowChange_WithOneTable() { + BatchWriteRowRequest request = new BatchWriteRowRequest(); + String tableName = "MyTable"; + + PrimaryKeySchema[] schema = TestUtil.randomPrimaryKeySchema(5); + List pks = new ArrayList(); + for (int i = 0; i < 100; i++) { + pks.add(TestUtil.randomPrimaryKey(schema)); + } + + for (int i = 0; i < 100; i++) { + RowPutChange rowChange = new RowPutChange(tableName, pks.get(i)); + rowChange.addColumn("column" + i, ColumnValue.fromString("HelloWorld")); + request.addRowChange(rowChange); + } + + assertEquals(request.getRowChange().size(), 1); + assertEquals(request.getRowChange().get(tableName).size(), 100); + for (int i = 0; i < 100; i++) { + assertEquals(request.getRowChange().get(tableName).get(i).getPrimaryKey(), pks.get(i)); + assertEquals(((RowPutChange)request.getRowChange().get(tableName).get(i)).getColumnsToPut().size(), 1); + assertEquals(((RowPutChange)request.getRowChange().get(tableName).get(i)).getColumnsToPut().get(0).getName(), "column" + i); + assertEquals(((RowPutChange)request.getRowChange().get(tableName).get(i)).getColumnsToPut().get(0).getValue(), ColumnValue.fromString("HelloWorld")); + } + + assertTrue(request.getRowChange().get("NonExistTable") == null); + assertTrue(request.getRowChange(tableName, 101) == null); + } + + @Test + public void testRequest_RowPutChange_WithMultiTable() { + BatchWriteRowRequest request = new BatchWriteRowRequest(); + String tableName1 = "MyTable1"; + String tableName2 = "MyTable2"; + + PrimaryKeySchema[] schema = TestUtil.randomPrimaryKeySchema(5); + List pks = new ArrayList(); + for (int i = 0; i < 100; i++) { + pks.add(TestUtil.randomPrimaryKey(schema)); + } + + for (int i = 0; i < 100; i++) { + RowPutChange rowChange = new RowPutChange(tableName1, pks.get(i)); + rowChange.addColumn("column1_" + i, ColumnValue.fromString("HelloWorld")); + request.addRowChange(rowChange); + + rowChange = new RowPutChange(tableName2, pks.get(i)); + rowChange.addColumn("column2_" + i, ColumnValue.fromString("HelloWorld")); + request.addRowChange(rowChange); + } + + assertEquals(request.getRowChange().size(), 2); + assertEquals(request.getRowChange().get(tableName1).size(), 100); + assertEquals(request.getRowChange().get(tableName2).size(), 100); + + for (int i = 0; i < 100; i++) { + assertEquals(request.getRowChange().get(tableName1).get(i).getPrimaryKey(), pks.get(i)); + assertEquals(((RowPutChange)request.getRowChange().get(tableName1).get(i)).getColumnsToPut().size(), 1); + assertEquals(((RowPutChange)request.getRowChange().get(tableName1).get(i)).getColumnsToPut().get(0).getName(), "column1_" + i); + assertEquals(((RowPutChange)request.getRowChange().get(tableName1).get(i)).getColumnsToPut().get(0).getValue(), ColumnValue.fromString("HelloWorld")); + + assertEquals(request.getRowChange().get(tableName2).get(i).getPrimaryKey(), pks.get(i)); + assertEquals(((RowPutChange)request.getRowChange().get(tableName2).get(i)).getColumnsToPut().size(), 1); + assertEquals(((RowPutChange)request.getRowChange().get(tableName2).get(i)).getColumnsToPut().get(0).getName(), "column2_" + i); + assertEquals(((RowPutChange)request.getRowChange().get(tableName2).get(i)).getColumnsToPut().get(0).getValue(), ColumnValue.fromString("HelloWorld")); + } + } + + @Test + public void testRequest_MixOperation_WithMultiTable() { + BatchWriteRowRequest request = new BatchWriteRowRequest(); + String tableName1 = "MyTable1"; + String tableName2 = "MyTable2"; + + PrimaryKeySchema[] schema = TestUtil.randomPrimaryKeySchema(5); + List pks = new ArrayList(); + for (int i = 0; i < 100; i++) { + pks.add(TestUtil.randomPrimaryKey(schema)); + } + + Random random = new Random(); + List types = new ArrayList(); + for (int i = 0; i < 100; i++) { + int opType = random.nextInt(3); + types.add(opType); + switch (opType) { + case 0: { + RowPutChange rowChange = new RowPutChange(tableName1, pks.get(i)); + rowChange.addColumn("column1_" + i, ColumnValue.fromString("HelloWorld")); + request.addRowChange(rowChange); + + rowChange = new RowPutChange(tableName2, pks.get(i)); + rowChange.addColumn("column2_" + i, ColumnValue.fromString("HelloWorld")); + request.addRowChange(rowChange); + break; + } + case 1: { + RowUpdateChange rowChange = new RowUpdateChange(tableName1, pks.get(i)); + rowChange.put("column1_" + i, ColumnValue.fromString("HelloWorld")); + request.addRowChange(rowChange); + + rowChange = new RowUpdateChange(tableName2, pks.get(i)); + rowChange.put("column2_" + i, ColumnValue.fromString("HelloWorld")); + request.addRowChange(rowChange); + break; + } + case 2: { + RowDeleteChange rowChange = new RowDeleteChange(tableName1, pks.get(i)); + request.addRowChange(rowChange); + rowChange = new RowDeleteChange(tableName2, pks.get(i)); + request.addRowChange(rowChange); + break; + } + default: { + throw new RuntimeException(); + } + } + } + + assertEquals(request.getRowChange().size(), 2); + assertEquals(request.getRowChange().get(tableName1).size(), 100); + assertEquals(request.getRowChange().get(tableName2).size(), 100); + + for (int i = 0; i < 100; i++) { + int opType = types.get(i); + switch (opType) { + case 0: { + assertEquals(request.getRowChange().get(tableName1).get(i).getPrimaryKey(), pks.get(i)); + assertEquals(((RowPutChange) request.getRowChange().get(tableName1).get(i)).getColumnsToPut().size(), 1); + assertEquals(((RowPutChange) request.getRowChange().get(tableName1).get(i)).getColumnsToPut().get(0).getName(), "column1_" + i); + assertEquals(((RowPutChange) request.getRowChange().get(tableName1).get(i)).getColumnsToPut().get(0).getValue(), ColumnValue.fromString("HelloWorld")); + + assertEquals(request.getRowChange().get(tableName2).get(i).getPrimaryKey(), pks.get(i)); + assertEquals(((RowPutChange) request.getRowChange().get(tableName2).get(i)).getColumnsToPut().size(), 1); + assertEquals(((RowPutChange) request.getRowChange().get(tableName2).get(i)).getColumnsToPut().get(0).getName(), "column2_" + i); + assertEquals(((RowPutChange) request.getRowChange().get(tableName2).get(i)).getColumnsToPut().get(0).getValue(), ColumnValue.fromString("HelloWorld")); + break; + } + case 1: { + assertEquals(request.getRowChange().get(tableName1).get(i).getPrimaryKey(), pks.get(i)); + assertEquals(((RowUpdateChange) request.getRowChange().get(tableName1).get(i)).getColumnsToUpdate().size(), 1); + assertEquals(((RowUpdateChange) request.getRowChange().get(tableName1).get(i)).getColumnsToUpdate().get(0).getFirst().getName(), "column1_" + i); + assertEquals(((RowUpdateChange) request.getRowChange().get(tableName1).get(i)).getColumnsToUpdate().get(0).getFirst().getValue(), ColumnValue.fromString("HelloWorld")); + + assertEquals(request.getRowChange().get(tableName2).get(i).getPrimaryKey(), pks.get(i)); + assertEquals(((RowUpdateChange) request.getRowChange().get(tableName2).get(i)).getColumnsToUpdate().size(), 1); + assertEquals(((RowUpdateChange) request.getRowChange().get(tableName2).get(i)).getColumnsToUpdate().get(0).getFirst().getName(), "column2_" + i); + assertEquals(((RowUpdateChange) request.getRowChange().get(tableName2).get(i)).getColumnsToUpdate().get(0).getFirst().getValue(), ColumnValue.fromString("HelloWorld")); + break; + } + case 2: { + assertEquals(((RowDeleteChange) request.getRowChange().get(tableName1).get(i)).getPrimaryKey(), pks.get(i)); + assertEquals(((RowDeleteChange) request.getRowChange().get(tableName2).get(i)).getPrimaryKey(), pks.get(i)); + break; + } + default: { + throw new RuntimeException(); + } + } + } + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowResponse.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowResponse.java new file mode 100644 index 0000000..88fff33 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestBatchWriteRowResponse.java @@ -0,0 +1,170 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.lang.*; +import java.util.*; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestBatchWriteRowResponse { + + @Test + public void testEmptyResult() { + BatchWriteRowResponse result = new BatchWriteRowResponse(new Response()); + + assertTrue(result.getRowStatus().isEmpty()); + assertTrue(result.getSucceedRows().isEmpty()); + + assertTrue(result.getRowStatus("Table") == null); + } + + private void compareStatus(List l, Map> m) { + Map> tmp = new HashMap>(); + for (BatchWriteRowResponse.RowResult rowResult : l) { + List tl = tmp.get(rowResult.getTableName()); + if (tl == null) { + tl = new ArrayList(); + tmp.put(rowResult.getTableName(), tl); + } + + tl.add(rowResult); + } + + for (String key : tmp.keySet()) { + List tl1 = tmp.get(key); + List tl2 = m.get(key); + compareStatusSorted(tl1, tl2); + } + } + + private Map> toMap(List l) { + Map> m = new HashMap>(); + for (BatchWriteRowResponse.RowResult rowResult : l) { + List tmp = m.get(rowResult.getTableName()); + if (tmp == null) { + tmp = new ArrayList(); + m.put(rowResult.getTableName(), tmp); + } + tmp.add(rowResult); + } + return m; + } + + private void compareStatusUnSorted(List tl1, List tl2) { + assertEquals(tl1.size(), tl2.size()); + Map> m1 = toMap(tl1); + Map> m2 = toMap(tl2); + + assertEquals(m1.size(), m2.size()); + + for (String key : m1.keySet()) { + compareStatusSorted(m1.get(key), m2.get(key)); + } + } + + private void compareStatusSorted(List tl1, List tl2) { + assertEquals(tl1.size(), tl2.size()); + + for (int i = 0; i < tl1.size(); i++) { + BatchWriteRowResponse.RowResult r1 = tl1.get(i); + BatchWriteRowResponse.RowResult r2 = tl2.get(i); + + assertEquals(r1.getTableName(), r2.getTableName()); + assertEquals(r1.isSucceed(), r2.isSucceed()); + assertEquals(r1.getIndex(), r2.getIndex()); + } + } + + private void compareStatusMixed(List succeedRows, List failedRows, List tl2) { + List s = new ArrayList(); + List f = new ArrayList(); + for (BatchWriteRowResponse.RowResult rowResult : tl2) { + if (rowResult.isSucceed()) { + s.add(rowResult); + } else { + f.add(rowResult); + } + } + compareStatusSorted(succeedRows, s); + compareStatusSorted(failedRows, f); + } + + @Test + public void testResult_AllSucceed() { + BatchWriteRowResponse result = new BatchWriteRowResponse(new Response()); + String tableName1 = "TableName1"; + String tableName2 = "TableName2"; + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName1, null, new ConsumedCapacity(new CapacityUnit(1, 1)), 0)); + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName1, null, new ConsumedCapacity(new CapacityUnit(1, 1)), 1)); + + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName2, null, new ConsumedCapacity(new CapacityUnit(1, 1)), 0)); + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName2, null, new ConsumedCapacity(new CapacityUnit(1, 1)), 1)); + + assertTrue(result.getFailedRows().isEmpty()); + + assertEquals(result.getSucceedRows().size(), 4); + compareStatus(result.getSucceedRows(), result.getRowStatus()); + } + + @Test + public void testResult_AllFailed() { + BatchWriteRowResponse result = new BatchWriteRowResponse(new Response()); + String tableName1 = "TableName1"; + String tableName2 = "TableName2"; + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName1, null, new Error("", ""), 0)); + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName1, null, new Error("", ""), 1)); + + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName2, null, new Error("", ""), 0)); + result.addRowResult(new BatchWriteRowResponse.RowResult(tableName2, null, new Error("", ""), 1)); + + assertTrue(result.getSucceedRows().isEmpty()); + + assertEquals(result.getFailedRows().size(), 4); + compareStatus(result.getFailedRows(), result.getRowStatus()); + } + + @Test + public void testResult_Mix() { + BatchWriteRowResponse result = new BatchWriteRowResponse(new Response()); + int tableCount = 10; + List rowPutSucceedResults = new ArrayList(); + List rowPutFailedResults = new ArrayList(); + + Random random = new Random(System.currentTimeMillis()); + for (int i = 0; i < 999; i++) { + if (random.nextBoolean()) { + rowPutFailedResults.add(new BatchWriteRowResponse.RowResult("TableName" + random.nextInt(tableCount), null, new Error("", ""), random.nextInt(100))); + } else { + rowPutSucceedResults.add(new BatchWriteRowResponse.RowResult("TableName" + random.nextInt(tableCount), null, new ConsumedCapacity(new CapacityUnit(1, 1)), random.nextInt(100))); + } + } + + for (BatchWriteRowResponse.RowResult rowResult : rowPutSucceedResults) { + result.addRowResult(rowResult); + } + for (BatchWriteRowResponse.RowResult rowResult : rowPutFailedResults) { + result.addRowResult(rowResult); + } + + assertEquals(result.getRowStatus().size(), tableCount); + + for (int i = 0; i < tableCount; i++) { + String tableName = "TableName" + i; + assertTrue(result.getRowStatus(tableName) != null); + + compareStatusMixed(toMap(rowPutSucceedResults).get(tableName), toMap(rowPutFailedResults).get(tableName), result.getRowStatus(tableName)); + } + + compareStatusUnSorted(rowPutSucceedResults, result.getSucceedRows()); + compareStatusUnSorted(rowPutFailedResults, result.getFailedRows()); + + List succeed = new ArrayList(); + List failed = new ArrayList(); + result.getResult(succeed, failed); + compareStatusUnSorted(rowPutSucceedResults, succeed); + compareStatusUnSorted(rowPutFailedResults, failed); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestCapacityUnit.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestCapacityUnit.java new file mode 100644 index 0000000..9837136 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestCapacityUnit.java @@ -0,0 +1,166 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestCapacityUnit { + + @Test + public void testConstructor_ReadWriteNotSet() { + CapacityUnit cu = new CapacityUnit(); + + assertTrue(!cu.hasSetReadCapacityUnit()); + assertTrue(!cu.hasSetWriteCapacityUnit()); + + try { + cu.getReadCapacityUnit(); + fail(); + } catch (IllegalStateException e) { + + } + try { + cu.getWriteCapacityUnit(); + fail(); + } catch (IllegalStateException e) { + + } + + CapacityUnit cu2 = new CapacityUnit(); + assertEquals(cu, cu2); + assertEquals(cu.hashCode(), cu2.hashCode()); + + cu2.setReadCapacityUnit(1); + assertEquals(cu2.getReadCapacityUnit(), 1); + assertTrue(!cu.equals(cu2)); + assertTrue(cu.hashCode() != cu2.hashCode()); + } + + @Test + public void testConstructor_ReadWriteSet() { + CapacityUnit cu = new CapacityUnit(1, 10); + + assertTrue(cu.hasSetReadCapacityUnit()); + assertTrue(cu.hasSetWriteCapacityUnit()); + + assertEquals(cu.getReadCapacityUnit(), 1); + assertEquals(cu.getWriteCapacityUnit(), 10); + + CapacityUnit cu2 = new CapacityUnit(1, 10); + assertEquals(cu, cu2); + assertEquals(cu.hashCode(), cu2.hashCode()); + + cu2.setReadCapacityUnit(2); + assertEquals(cu2.getReadCapacityUnit(), 2); + assertTrue(!cu.equals(cu2)); + assertTrue(cu.hashCode() != cu2.hashCode()); + } + + @Test + public void testGetSetRead() { + CapacityUnit cu = new CapacityUnit(); + cu.setReadCapacityUnit(100); + assertTrue(cu.hasSetReadCapacityUnit()); + assertEquals(cu.getReadCapacityUnit(), 100); + assertTrue(!cu.hasSetWriteCapacityUnit()); + try { + cu.getWriteCapacityUnit(); + fail(); + } catch (IllegalStateException e) { + + } + + cu.setReadCapacityUnit(999); + assertTrue(cu.hasSetReadCapacityUnit()); + assertEquals(cu.getReadCapacityUnit(), 999); + assertTrue(!cu.hasSetWriteCapacityUnit()); + try { + cu.getWriteCapacityUnit(); + fail(); + } catch (IllegalStateException e) { + + } + } + + @Test + public void testGetSetWrite() { + CapacityUnit cu = new CapacityUnit(); + cu.setWriteCapacityUnit(100); + assertTrue(cu.hasSetWriteCapacityUnit()); + assertEquals(cu.getWriteCapacityUnit(), 100); + assertTrue(!cu.hasSetReadCapacityUnit()); + try { + cu.getReadCapacityUnit(); + fail(); + } catch (IllegalStateException e) { + + } + + cu.setWriteCapacityUnit(999); + assertTrue(cu.hasSetWriteCapacityUnit()); + assertEquals(cu.getWriteCapacityUnit(), 999); + assertTrue(!cu.hasSetReadCapacityUnit()); + try { + cu.getReadCapacityUnit(); + fail(); + } catch (IllegalStateException e) { + + } + } + + private void checkInvalidConstructor(int read, int write) { + try { + new CapacityUnit(read, write); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testInvalidArguments() { + checkInvalidConstructor(-1, 1); + checkInvalidConstructor(1, -1); + + CapacityUnit capacityUnit = new CapacityUnit(10, 10); + + try { + capacityUnit.setReadCapacityUnit(-1); + fail(); + } catch (IllegalArgumentException e) { + } + try { + capacityUnit.setWriteCapacityUnit(-1); + fail(); + } catch (IllegalArgumentException e) { + } + } + + @Test + public void testEquals() { + CapacityUnit c1 = new CapacityUnit(1, 10); + CapacityUnit c2 = new CapacityUnit(1, 10); + CapacityUnit c3 = new CapacityUnit(1, 11); + + assertEquals(c1, c2); + assertEquals(c1.hashCode(), c2.hashCode()); + assertTrue(!c2.equals(c3)); + assertTrue(c2.hashCode() != c3.hashCode()); + assertTrue(!c1.equals(c3)); + assertTrue(c1.hashCode() != c3.hashCode()); + + // change not same to same + c3.setWriteCapacityUnit(10); + assertEquals(c1, c3); + assertEquals(c1.hashCode(), c3.hashCode()); + + // change same to not same + c2.setReadCapacityUnit(0); + assertTrue(!c1.equals(c2)); + assertTrue(c1.hashCode() != c2.hashCode()); + } + + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestColumn.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestColumn.java new file mode 100644 index 0000000..9c99a35 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestColumn.java @@ -0,0 +1,125 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestColumn { + + @Test + public void testConstructor() { + Column column = new Column("Column1", ColumnValue.fromLong(1000)); + assertEquals(column.getName(), "Column1"); + assertEquals(column.getValue(), ColumnValue.fromLong(1000)); + assertTrue(!column.hasSetTimestamp()); + + column = new Column("Column2", ColumnValue.fromString("ColumnValue"), 1418380771); + assertEquals(column.getName(), "Column2"); + assertEquals(column.getValue(), ColumnValue.fromString("ColumnValue")); + assertTrue(column.hasSetTimestamp()); + assertEquals(column.getTimestamp(), 1418380771); + } + + @Test + public void testConstructor_InvalidArguments() { + try { + new Column(null, ColumnValue.fromString("C")); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new Column("", ColumnValue.fromString("C")); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new Column("T", null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new Column("T", ColumnValue.fromString("C"), -1); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testEquals() { + Column c1 = new Column("T1", ColumnValue.fromLong(1), 1418380771); + Column c2 = new Column("T1", ColumnValue.fromLong(1), 1418380771); + assertEquals(c1, c2); + assertEquals(c1.hashCode(), c2.hashCode()); + + c1 = new Column("T1", ColumnValue.fromLong(1)); + c2 = new Column("T1", ColumnValue.fromLong(1)); + assertEquals(c1, c2); + assertEquals(c1.hashCode(), c2.hashCode()); + + // name not same + c1 = new Column("T1", ColumnValue.fromLong(1), 1418380771); + c2 = new Column("T2", ColumnValue.fromLong(1), 1418380771); + assertTrue(!c1.equals(c2)); + assertTrue(c1.hashCode() != c2.hashCode()); + + // value not same + c1 = new Column("T1", ColumnValue.fromLong(1), 1418380771); + c2 = new Column("T1", ColumnValue.fromLong(2), 1418380771); + assertTrue(!c1.equals(c2)); + assertTrue(c1.hashCode() != c2.hashCode()); + + + // timestamp not same + c1 = new Column("T1", ColumnValue.fromLong(1), 1418380771); + c2 = new Column("T1", ColumnValue.fromLong(1), 1418380772); + assertTrue(!c1.equals(c2)); + assertTrue(c1.hashCode() != c2.hashCode()); + + c1 = new Column("T1", ColumnValue.fromLong(1)); + c2 = new Column("T1", ColumnValue.fromLong(1), 1418380772); + assertTrue(!c1.equals(c2)); + assertTrue(c1.hashCode() != c2.hashCode()); + } + + @Test + public void testGetDataSize() { + Column column = new Column("column", ColumnValue.fromString("abc")); + assertEquals(column.getDataSize(), 9); + + column = new Column("column", ColumnValue.fromDouble(0.0)); + assertEquals(column.getDataSize(), 14); + + column = new Column("column", ColumnValue.fromLong(1)); + assertEquals(column.getDataSize(), 14); + + column = new Column("column", ColumnValue.fromBoolean(false)); + assertEquals(column.getDataSize(), 7); + + column = new Column("column", ColumnValue.fromBinary(new byte[]{0x0, 0x1, 0x2, 0x3, 0x4})); + assertEquals(column.getDataSize(), 11); + + column = new Column("column", ColumnValue.fromString("abc"), System.currentTimeMillis()); + assertEquals(column.getDataSize(), 17); + + column = new Column("column", ColumnValue.fromDouble(0.0), System.currentTimeMillis()); + assertEquals(column.getDataSize(), 22); + + column = new Column("column", ColumnValue.fromLong(1), System.currentTimeMillis()); + assertEquals(column.getDataSize(), 22); + + column = new Column("column", ColumnValue.fromBoolean(false), System.currentTimeMillis()); + assertEquals(column.getDataSize(), 15); + + column = new Column("column", ColumnValue.fromBinary(new byte[]{0x0, 0x1, 0x2, 0x3, 0x4}), System.currentTimeMillis()); + assertEquals(column.getDataSize(), 19); + } +} diff --git a/src/test/java/com/aliyun/openservices/ots/model/ColumnValueTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestColumnValue.java similarity index 77% rename from src/test/java/com/aliyun/openservices/ots/model/ColumnValueTest.java rename to src/test/java/com/alicloud/openservices/tablestore/model/TestColumnValue.java index e100e5f..19d66c5 100644 --- a/src/test/java/com/aliyun/openservices/ots/model/ColumnValueTest.java +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestColumnValue.java @@ -1,12 +1,12 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static org.junit.Assert.*; - -import com.aliyun.openservices.ots.utils.Bytes; -import com.aliyun.openservices.ots.utils.TestUtil; +import com.alicloud.openservices.tablestore.common.TestUtil; +import com.alicloud.openservices.tablestore.core.utils.Bytes; import org.junit.Test; -public class ColumnValueTest { +import static org.junit.Assert.*; + +public class TestColumnValue { private void checkType(ColumnValue v) { ColumnType type = v.getType(); @@ -27,6 +27,13 @@ private void checkType(ColumnValue v) { } catch (IllegalStateException e) { } + + try { + v.asStringInBytes(); + fail(); + } catch (IllegalStateException e) { + + } } if (type != ColumnType.BOOLEAN) { @@ -62,7 +69,6 @@ public void testInteger() { long value = TestUtil.randomLong(); ColumnValue v = ColumnValue.fromLong(value); assertEquals(v.asLong(), value); - assertEquals(v.getSize(), 8); checkType(v); } @@ -71,7 +77,7 @@ public void testString() { String value = TestUtil.randomString(100000); ColumnValue v = ColumnValue.fromString(value); assertEquals(v.asString(), value); - assertEquals(v.getSize(), Bytes.toBytes(value).length); + assertArrayEquals(v.asStringInBytes(), Bytes.toBytes(value)); checkType(v); } @@ -80,7 +86,6 @@ public void testDouble() { double value = TestUtil.randomDouble(); ColumnValue v = ColumnValue.fromDouble(value); assertEquals(v.asDouble(), value, 0.000001); - assertEquals(v.getSize(), 8); checkType(v); } @@ -89,7 +94,6 @@ public void testBoolean() { boolean value = TestUtil.randomBoolean(); ColumnValue v = ColumnValue.fromBoolean(value); assertEquals(v.asBoolean(), value); - assertEquals(v.getSize(), 1); checkType(v); } @@ -98,7 +102,6 @@ public void testBytes() { byte[] value = TestUtil.randomBytes(100000); ColumnValue v = ColumnValue.fromBinary(value); assertArrayEquals(v.asBinary(), value); - assertEquals(v.getSize(), value.length); checkType(v); } @@ -157,6 +160,44 @@ public void testEquals_Bytes() { assertTrue(!ColumnValue.fromBinary(new byte[]{0x1, 0x2, 0x3}).equals(ColumnValue.fromBoolean(false))); } + @Test + public void testPrimaryKeyAddOne() { + PrimaryKeyValue pk = PrimaryKeyValue.addOne(PrimaryKeyValue.fromLong(1000)); + System.out.println(pk); + assertTrue(pk.asLong() == 1001); + + PrimaryKeyValue pk3 = PrimaryKeyValue.addOne(PrimaryKeyValue.fromLong(Long.MAX_VALUE)); + System.out.println(pk3); + assertTrue(pk3.isInfMax()); + + String str = "aaestXXXaa"; + String str1 = "aaestXXXaa\0"; + String str2 = "aaestXXXab"; + String str3 = "aaestXXXaa\1"; + PrimaryKeyValue pk1 = PrimaryKeyValue.addOne(PrimaryKeyValue.fromString(str)); + System.out.println(pk1); + assertTrue(pk1.asString().equals(str1)); + assertTrue(pk1.compareTo(PrimaryKeyValue.fromString(str2)) < 0); + assertTrue(pk1.compareTo(PrimaryKeyValue.fromString(str3)) < 0); + assertTrue(pk1.compareTo(PrimaryKeyValue.fromString(str)) > 0); + + byte[] bstr = Bytes.toBytes("aaestXXXaa"); + byte[] bstr1 = Bytes.toBytes("aaestXXXaa\0"); + byte[] bstr2 = Bytes.toBytes("aaestXXXab"); + byte[] bstr3 = Bytes.toBytes("aaestXXXaa\1"); + PrimaryKeyValue pk2 = PrimaryKeyValue.addOne(PrimaryKeyValue.fromBinary(bstr)); + PrimaryKeyValue pk4 = PrimaryKeyValue.fromBinary(bstr1); + PrimaryKeyValue pk5 = PrimaryKeyValue.fromBinary(bstr2); + PrimaryKeyValue pk6 = PrimaryKeyValue.fromBinary(bstr3); + System.out.println(pk2); + System.out.println(pk4); + System.out.println(pk5); + System.out.println(pk6); + assertTrue(pk2.compareTo(pk4) == 0); + assertTrue(pk2.compareTo(pk5) < 0); + assertTrue(pk2.compareTo(pk6) < 0); + } + private void compareWithOtherType(ColumnValue v) { ColumnType type = v.getType(); @@ -220,7 +261,7 @@ public void testCompareTo_Integer() { public void testCompareTo_String() { ColumnValue value = ColumnValue.fromString("a b c d e"); assertTrue(value.compareTo(ColumnValue.fromString("a b c d e")) == 0); - assertTrue(ColumnValue.fromString("����Ͱ�").compareTo(ColumnValue.fromString("����Ͱ�")) == 0); + assertTrue(ColumnValue.fromString("??????").compareTo(ColumnValue.fromString("??????")) == 0); assertTrue(value.compareTo(ColumnValue.fromString("a b c d f")) < 0); assertTrue(value.compareTo(ColumnValue.fromString("a b c d d")) > 0); @@ -258,4 +299,14 @@ public void testCompareTo_Boolean() { compareWithOtherType(value); } + @Test + public void testGetDataSize() throws Exception { + assertEquals(ColumnValue.fromBinary(new byte[]{0x0, 0x1, 0x2, 0x3, 0x4, 0x5}).getDataSize(), 6); + assertEquals(ColumnValue.fromBoolean(true).getDataSize(), 1); + assertEquals(ColumnValue.fromLong(1).getDataSize(), 8); + assertEquals(ColumnValue.fromDouble(1.0).getDataSize(), 8); + + String value = "阿里巴巴"; + assertEquals(ColumnValue.fromString(value).getDataSize(), value.getBytes("utf-8").length); + } } diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeRequest.java new file mode 100644 index 0000000..8fa4b6f --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeRequest.java @@ -0,0 +1,41 @@ +package com.alicloud.openservices.tablestore.model; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class TestComputeSplitsBySizeRequest { + + @Test + public void testConstructor() { + String tableName = "testTableName"; + long splitSize = 5; + + ComputeSplitsBySizeRequest req = new ComputeSplitsBySizeRequest( tableName, splitSize ); + + assertEquals( req.getTableName(), tableName ); + assertEquals( req.getSplitSizeIn100MB(), splitSize ); + } + + @Test + public void testConstructorWithEmptyParameter() { + ComputeSplitsBySizeRequest req = new ComputeSplitsBySizeRequest(); + + assertEquals( req.getTableName(), null ); + assertEquals( req.getSplitSizeIn100MB(), 0l ); + } + + @Test + public void testSetterAndGetter() { + String tableName = "testTableName"; + long splitSize = 5; + + ComputeSplitsBySizeRequest req = new ComputeSplitsBySizeRequest(); + req.setTableName(tableName); + req.setSplitSizeIn100MB(splitSize); + + assertEquals( req.getTableName(), tableName ); + assertEquals( req.getSplitSizeIn100MB(), splitSize ); + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeResponse.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeResponse.java new file mode 100644 index 0000000..a5082ef --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestComputeSplitsBySizeResponse.java @@ -0,0 +1,150 @@ +package com.alicloud.openservices.tablestore.model; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class TestComputeSplitsBySizeResponse { + + private int maxNumberPrimaryKeyColumnEachRow = 4; + + @Test + public void testConstructorWithEmptyParameter() { + ComputeSplitsBySizeResponse resp = new ComputeSplitsBySizeResponse(new Response()); + assertEquals(resp.getConsumedCapacity(), null); + assertEquals(resp.getPrimaryKeySchema().size(), 0); + assertEquals(resp.getSplits().size(), 0); + } + + @Test + public void testSetterAndGetterForComsumedCapacity() { + ComputeSplitsBySizeResponse resp = new ComputeSplitsBySizeResponse(new Response()); + + ConsumedCapacity cc = new ConsumedCapacity(new CapacityUnit(1, 1)); + resp.setConsumedCapacity(cc); + assertTrue( resp.getConsumedCapacity().equals(cc) ); + } + + @Test + public void testSetterAndGetterForSplitList() { + ComputeSplitsBySizeResponse resp = new ComputeSplitsBySizeResponse(new Response()); + + List sl1 = new ArrayList(); + resp.setSplits(sl1); + assertEquals( resp.getSplits().size(), 0 ); + + List sl2 = new ArrayList(); + + String location = "location"; + String lowerPrimaryKeyNamePrefix = "lowerKeyNamePrefix_"; + String lowerPrimaryKeyValuePrefix = "lowerKeyValuePrefix_"; + String upperPrimaryKeyNamePrefix = "upperKeyNamePrefix_"; + String upperPrimaryKeyValuePrefix = "upperKeyValuePrefix_"; + List pkcl1 = new ArrayList(); + List pkcl2 = new ArrayList(); + for ( int i = 0; i < maxNumberPrimaryKeyColumnEachRow; ++i ) { + pkcl1.add(new PrimaryKeyColumn( lowerPrimaryKeyNamePrefix + i, PrimaryKeyValue.fromString(lowerPrimaryKeyValuePrefix + i) )); + pkcl2.add(new PrimaryKeyColumn( upperPrimaryKeyNamePrefix + i, PrimaryKeyValue.fromString(upperPrimaryKeyValuePrefix + i) )); + } + PrimaryKey pk1 = new PrimaryKey(pkcl1); + PrimaryKey pk2 = new PrimaryKey(pkcl2); + + Split s = new Split(location, pk1, pk2); + sl2.add(s); + + resp.addSplit(s); + assertEquals( resp.getSplits().size(), 1 ); + assertTrue( resp.getSplits().get(0).getLocation().equals(location) ); + assertTrue( resp.getSplits().get(0).getLowerBound().equals(pk1) ); + assertTrue( resp.getSplits().get(0).getUpperBound().equals(pk2) ); + + resp.setSplits(null); + assertEquals( resp.getSplits(), null ); + + resp.setSplits(sl2); + assertEquals( resp.getSplits().size(), 1 ); + assertTrue( resp.getSplits().get(0).getLocation().equals(location) ); + assertTrue( resp.getSplits().get(0).getLowerBound().equals(pk1) ); + assertTrue( resp.getSplits().get(0).getUpperBound().equals(pk2) ); + } + + @Test + public void testSetterAndGetterForPrimaryKeySchemaList() { + ComputeSplitsBySizeResponse resp = new ComputeSplitsBySizeResponse(new Response()); + resp.setPrimaryKeySchema(null); + assertEquals(resp.getPrimaryKeySchema(), null); + + List pksl = new ArrayList(); + resp.setPrimaryKeySchema(pksl); + assertEquals(resp.getPrimaryKeySchema().size(), 0); + + List pksl2 = new ArrayList(); + String primaryKeySchemaPrefix = "primaryKeySchemaPrefix"; + for ( int j = 0; j < maxNumberPrimaryKeyColumnEachRow; ++j ) { + pksl2.add(new PrimaryKeySchema(primaryKeySchemaPrefix + j, PrimaryKeyType.STRING)); + } + resp.setPrimaryKeySchema(pksl2); + assertEquals(resp.getPrimaryKeySchema().size(), maxNumberPrimaryKeyColumnEachRow); + for ( int j = 0; j < maxNumberPrimaryKeyColumnEachRow; ++j ) { + assertTrue( resp.getPrimaryKeySchema().get(j).getName().equals(primaryKeySchemaPrefix + j) ); + assertTrue( resp.getPrimaryKeySchema().get(j).getType().equals(PrimaryKeyType.STRING) ); + } + + resp = new ComputeSplitsBySizeResponse(new Response()); + String keyName = "name"; + resp.addPrimaryKeySchema(keyName, PrimaryKeyType.BINARY); + assertEquals( resp.getPrimaryKeySchema().size(), 1 ); + assertTrue( resp.getPrimaryKeySchema().get(0).getName().equals(keyName) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getType().equals(PrimaryKeyType.BINARY) ); + + resp = new ComputeSplitsBySizeResponse(new Response()); + String keyName2 = "name"; + resp.addPrimaryKeySchema(keyName2, PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + assertEquals( resp.getPrimaryKeySchema().size(), 1 ); + assertTrue( resp.getPrimaryKeySchema().get(0).getName().equals(keyName2) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getType().equals(PrimaryKeyType.INTEGER) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getOption().equals(PrimaryKeyOption.AUTO_INCREMENT) ); + + resp = new ComputeSplitsBySizeResponse(new Response()); + String keyName3 = "name"; + PrimaryKeyType keyType3 = PrimaryKeyType.INTEGER; + PrimaryKeyOption keyOption3 = PrimaryKeyOption.AUTO_INCREMENT; + PrimaryKeySchema pks = new PrimaryKeySchema( keyName3, keyType3, keyOption3 ); + resp.addPrimaryKeySchema(pks); + assertEquals( resp.getPrimaryKeySchema().size(), 1 ); + assertTrue( resp.getPrimaryKeySchema().get(0).getName().equals(keyName3) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getType().equals(keyType3) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getOption().equals(keyOption3) ); + + String keyName4 = "name4"; + PrimaryKeyType keyType4 = PrimaryKeyType.INTEGER; + PrimaryKeyOption keyOption4 = PrimaryKeyOption.AUTO_INCREMENT; + PrimaryKeySchema pks2 = new PrimaryKeySchema( keyName4, keyType4, keyOption4 ); + List pksll = new ArrayList(); + pksll.add(pks2); + resp.addPrimaryKeySchemas(pksll); + assertEquals( resp.getPrimaryKeySchema().size(), 2 ); + assertTrue( resp.getPrimaryKeySchema().get(0).getName().equals(keyName3) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getType().equals(keyType3) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getOption().equals(keyOption3) ); + assertTrue( resp.getPrimaryKeySchema().get(1).getName().equals(keyName4) ); + assertTrue( resp.getPrimaryKeySchema().get(1).getType().equals(keyType4) ); + assertTrue( resp.getPrimaryKeySchema().get(1).getOption().equals(keyOption4) ); + + resp = new ComputeSplitsBySizeResponse(new Response()); + PrimaryKeySchema[] pkss = new PrimaryKeySchema[2]; + pkss[0] = pks; + pkss[1] = pks2; + resp.addPrimaryKeySchemas(pkss); + assertTrue( resp.getPrimaryKeySchema().get(0).getName().equals(keyName3) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getType().equals(keyType3) ); + assertTrue( resp.getPrimaryKeySchema().get(0).getOption().equals(keyOption3) ); + assertTrue( resp.getPrimaryKeySchema().get(1).getName().equals(keyName4) ); + assertTrue( resp.getPrimaryKeySchema().get(1).getType().equals(keyType4) ); + assertTrue( resp.getPrimaryKeySchema().get(1).getOption().equals(keyOption4) ); + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestCreateTableRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestCreateTableRequest.java new file mode 100644 index 0000000..62c8010 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestCreateTableRequest.java @@ -0,0 +1,58 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.ArrayList; + +import static org.junit.Assert.fail; + +public class TestCreateTableRequest { + + @Test + public void testInvalidArguments() { + CreateTableRequest request = + new CreateTableRequest(new TableMeta("TableName"), new TableOptions()); + try { + request.setTableMeta(null); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + request.setTableOptions(null); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + request.setReservedThroughput(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testInvalidArgumentsEx() { + CreateTableRequest request = + new CreateTableRequest(new TableMeta("TableName"), new TableOptions()); + try { + request.setTableMeta(null); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + request.setTableOptions(null); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + request.setReservedThroughput(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestDefaultRetryStrategy.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestDefaultRetryStrategy.java new file mode 100644 index 0000000..f6beec8 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestDefaultRetryStrategy.java @@ -0,0 +1,194 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.PartialResultFailedException; +import com.alicloud.openservices.tablestore.TableStoreException; +import static com.alicloud.openservices.tablestore.core.ErrorCode.*; +import static com.alicloud.openservices.tablestore.model.OperationNames.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestDefaultRetryStrategy { + + private static List allOperations; + private static List idempotentOperations; + private static List unidempotentOperations; + private static Set test; + private Random rnd = new Random(); + private static Logger LOG = Logger.getLogger(TestDefaultRetryStrategy.class.getName()); + + @BeforeClass + public static void classBefore() { + allOperations = new ArrayList(); + allOperations.add(OP_CREATE_TABLE); + allOperations.add(OP_LIST_TABLE); + allOperations.add(OP_DELETE_TABLE); + allOperations.add(OP_DESCRIBE_TABLE); + allOperations.add(OP_UPDATE_TABLE); + allOperations.add(OP_GET_ROW); + allOperations.add(OP_PUT_ROW); + allOperations.add(OP_UPDATE_ROW); + allOperations.add(OP_DELETE_ROW); + allOperations.add(OP_BATCH_GET_ROW); + allOperations.add(OP_BATCH_WRITE_ROW); + allOperations.add(OP_GET_RANGE); + + idempotentOperations = new ArrayList(); + idempotentOperations.add(OP_LIST_TABLE); + idempotentOperations.add(OP_DESCRIBE_TABLE); + idempotentOperations.add(OP_GET_ROW); + idempotentOperations.add(OP_BATCH_GET_ROW); + idempotentOperations.add(OP_GET_RANGE); + + unidempotentOperations = new ArrayList(); + unidempotentOperations.add(OP_CREATE_TABLE); + unidempotentOperations.add(OP_DELETE_TABLE); + unidempotentOperations.add(OP_UPDATE_TABLE); + unidempotentOperations.add(OP_PUT_ROW); + unidempotentOperations.add(OP_UPDATE_ROW); + unidempotentOperations.add(OP_DELETE_ROW); + unidempotentOperations.add(OP_BATCH_WRITE_ROW); + } + + public void testTableStoreCommon(String action, String msg, String errorCode, int httpStatus, boolean expectRetry) { + LOG.info("Action:" + action + ", msg:" + msg + ", errorCode:" + errorCode + ", httpStatus:" + String.valueOf(httpStatus)); + TableStoreException e = new TableStoreException(msg, null, errorCode, "requestId", httpStatus); + DefaultRetryStrategy retry = new DefaultRetryStrategy(); + assertEquals(retry.shouldRetry(action, e), expectRetry); + } + + public void testClientCommon(String action, boolean expectRetry) { + LOG.info("Action:" + action); + ClientException e = new ClientException(); + DefaultRetryStrategy retry = new DefaultRetryStrategy(); + assertEquals(retry.shouldRetry(action, e), expectRetry); + } + + /** + * 若异常为TableStoreException,且错误码为OTSRowOperationConflict, OTSNotEnoughCapacityUnit, OTSTableNotReady, + * OTSPartitionUnavailable或OTSServerBusy,则可以重试。 + * @throws Exception + */ + @Test + public void testCase1() throws Exception { + List acceptErrors = new ArrayList(); + acceptErrors.add(ROW_OPERATION_CONFLICT); + acceptErrors.add(NOT_ENOUGH_CAPACITY_UNIT); + acceptErrors.add(TABLE_NOT_READY); + acceptErrors.add(PARTITION_UNAVAILABLE); + acceptErrors.add(SERVER_BUSY); + + testTableStoreCommon(allOperations.get(rnd.nextInt(allOperations.size())), "test", + acceptErrors.get(rnd.nextInt(acceptErrors.size())), 400, true); + } + + /** + * 若异常为OTSQuotaExhausted且异常消息为"Too frequent table operations.",则可以重试。 + * @throws Exception + */ + @Test + public void testCase2() throws Exception { + testTableStoreCommon(allOperations.get(rnd.nextInt(allOperations.size())), + "Too frequent table operations.", + QUOTA_EXHAUSTED, 400, true); + } + + /** + * 若异常为OTSQuotaExhausted且异常消息不是"Too frequent table operations.",则不可以重试。 + * @throws Exception + */ + @Test + public void testCase3() throws Exception { + testTableStoreCommon(allOperations.get(rnd.nextInt(allOperations.size())), + "error message", + QUOTA_EXHAUSTED, 400, false); + } + + /** + * 若异常为ClientException(网络类异常),且操作是幂等的,则可以重试。 + * @throws Exception + */ + @Test + public void testCase4() throws Exception { + testClientCommon(idempotentOperations.get(rnd.nextInt(idempotentOperations.size())), true); + } + + /** + * 若异常为ClientException(网络类异常),且操作不是幂等的,则不可以重试。 + * @throws Exception + */ + @Test + public void testCase5() throws Exception { + testClientCommon(unidempotentOperations.get(rnd.nextInt(unidempotentOperations.size())), false); + } + + /** + * 若异常为OTSTimeout, OTSInternalServerError, OTSServerUnavaillable或http状态码为500, 502或503,且操作为幂等的,则可以重试。 + * @throws Exception + */ + @Test + public void testCase6() throws Exception { + List acceptErrors = new ArrayList(); + acceptErrors.add(STORAGE_TIMEOUT); + acceptErrors.add(INTERNAL_SERVER_ERROR); + acceptErrors.add(SERVER_UNAVAILABLE); + + testTableStoreCommon(idempotentOperations.get(rnd.nextInt(idempotentOperations.size())), "test", + acceptErrors.get(rnd.nextInt(acceptErrors.size())), 400, true); + + int errorCode = 500 + rnd.nextInt(100); + testTableStoreCommon(idempotentOperations.get(rnd.nextInt(idempotentOperations.size())), "test", + CONDITION_CHECK_FAIL, errorCode, true); + } + + /** + * 若异常为OTSTimeout, OTSInternalServerError, OTSServerUnavaillable或http状态码为500, 502或503,且操作非幂等的,则不可以重试。 + * @throws Exception + */ + @Test + public void testCase7() throws Exception { + List acceptErrors = new ArrayList(); + acceptErrors.add(STORAGE_TIMEOUT); + acceptErrors.add(INTERNAL_SERVER_ERROR); + acceptErrors.add(SERVER_UNAVAILABLE); + + testTableStoreCommon(unidempotentOperations.get(rnd.nextInt(unidempotentOperations.size())), "test", + acceptErrors.get(rnd.nextInt(acceptErrors.size())), 400, false); + + int errorCode = 500 + rnd.nextInt(100); + testTableStoreCommon(unidempotentOperations.get(rnd.nextInt(unidempotentOperations.size())), "test", + CONDITION_CHECK_FAIL, errorCode, false); + } + + /** + * 若操作为Batch操作,只有所有失败的行可重试时,批量操作才可以重试。 + * @throws Exception + */ + @Test + public void testCase8() throws Exception { + PartialResultFailedException partialEx = new PartialResultFailedException(null, "test", null); + String action = OP_BATCH_WRITE_ROW; + TableStoreException exCanRetry = new TableStoreException("test", null, ROW_OPERATION_CONFLICT, "requestId", 500); + TableStoreException exCannotRetry = new TableStoreException("test", null, CONDITION_CHECK_FAIL, "requestId", 400); + + DefaultRetryStrategy retry = new DefaultRetryStrategy(); + + // 所有失败的行可重试 + partialEx.addError(exCanRetry); + partialEx.addError(exCanRetry); + assertEquals(retry.shouldRetry(action, partialEx), true); + + // 部分失败的行可重试 + partialEx.addError(exCannotRetry); + assertEquals(retry.shouldRetry(action, partialEx), false); + + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteRowRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteRowRequest.java new file mode 100644 index 0000000..c94b017 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteRowRequest.java @@ -0,0 +1,20 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +public class TestDeleteRowRequest { + + @Test + public void testInvalidArguments() { + DeleteRowRequest request = new DeleteRowRequest(); + + try { + request.setRowChange(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteTableRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteTableRequest.java new file mode 100644 index 0000000..b2db79f --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestDeleteTableRequest.java @@ -0,0 +1,25 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +public class TestDeleteTableRequest { + + @Test + public void testInvalidArguments() { + try { + DeleteTableRequest request = new DeleteTableRequest(null); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + DeleteTableRequest request = new DeleteTableRequest("T"); + request.setTableName(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestDescribeTableRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestDescribeTableRequest.java new file mode 100644 index 0000000..26b4382 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestDescribeTableRequest.java @@ -0,0 +1,25 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +public class TestDescribeTableRequest { + + @Test + public void testInvalidArguments() { + try { + DescribeTableRequest request = new DescribeTableRequest(null); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + DescribeTableRequest request = new DescribeTableRequest("T"); + request.setTableName(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestGetRangeRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestGetRangeRequest.java new file mode 100644 index 0000000..169a89e --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestGetRangeRequest.java @@ -0,0 +1,19 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +public class TestGetRangeRequest { + + @Test + public void testInvalidArguments() { + try { + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestGetRowRequest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestGetRowRequest.java new file mode 100644 index 0000000..ebdf5e7 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestGetRowRequest.java @@ -0,0 +1,19 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +public class TestGetRowRequest { + + @Test + public void testInvalidArguments() { + try { + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestMultiRowQueryCriteria.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestMultiRowQueryCriteria.java new file mode 100644 index 0000000..08ccb29 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestMultiRowQueryCriteria.java @@ -0,0 +1,122 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.common.TestUtil; +import com.alicloud.openservices.tablestore.model.filter.Filter; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; + +import static org.junit.Assert.*; + +public class TestMultiRowQueryCriteria { + + @Test + public void testEmpty() { + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("T"); + + assertEquals(criteria.getTableName(), "T"); + assertTrue(criteria.getRowKeys().isEmpty()); + assertTrue(criteria.get(0) == null); + assertEquals(criteria.size(), 0); + assertTrue(criteria.isEmpty()); + } + + @Test + public void testAddPrimaryKey() { + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("T"); + + PrimaryKey pk = TestUtil.randomPrimaryKey(TestUtil.randomPrimaryKeySchema(5)); + criteria.addRow(pk); + + assertEquals(criteria.size(), 1); + assertEquals(criteria.getRowKeys().size(), 1); + assertEquals(criteria.get(0), pk); + assertEquals(criteria.getRowKeys().get(0), pk); + assertTrue(!criteria.isEmpty()); + + PrimaryKey[] pks = new PrimaryKey[10]; + PrimaryKeySchema[] pkSchema = TestUtil.randomPrimaryKeySchema(10); + for (int i = 0; i < pks.length; i++) { + pks[i] = TestUtil.randomPrimaryKey(pkSchema); + } + + criteria.setRowKeys(Arrays.asList(pks)); + assertEquals(criteria.size(), pks.length); + assertArrayEquals(criteria.getRowKeys().toArray(), pks); + for (int i = 0; i < pks.length; i++) { + assertEquals(criteria.get(i), pks[i]); + } + + assertTrue(!criteria.isEmpty()); + + criteria.clear(); + assertTrue(criteria.getRowKeys().isEmpty()); + assertTrue(criteria.get(0) == null); + assertEquals(criteria.size(), 0); + assertTrue(criteria.isEmpty()); + } + + @Test + public void testInvalidArguments() { + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("T"); + try { + criteria.addRow(null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + criteria.setRowKeys(null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + criteria.setRowKeys(new ArrayList()); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testClone() { + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("T"); + PrimaryKey[] pks = new PrimaryKey[10]; + PrimaryKeySchema[] pkSchema = TestUtil.randomPrimaryKeySchema(10); + for (int i = 0; i < pks.length; i++) { + pks[i] = TestUtil.randomPrimaryKey(pkSchema); + } + + criteria.setRowKeys(Arrays.asList(pks)); + assertEquals(criteria.size(), pks.length); + assertArrayEquals(criteria.getRowKeys().toArray(), pks); + + criteria.setTimestamp(1912); + Filter filter = new SingleColumnValueFilter("column", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(10)); + criteria.setFilter(filter); + + MultiRowQueryCriteria newCriteria = criteria.cloneWithoutRowKeys(); + assertTrue(newCriteria != criteria); + assertTrue(newCriteria.getRowKeys().isEmpty()); + assertTrue(newCriteria.get(0) == null); + assertEquals(newCriteria.size(), 0); + assertTrue(newCriteria.isEmpty()); + assertTrue(newCriteria.getFilter() != null); + + assertTrue(newCriteria.hasSetTimeRange()); + assertTrue(!newCriteria.hasSetMaxVersions()); + assertEquals(newCriteria.getTimeRange(), criteria.getTimeRange()); + + Filter newFilter = newCriteria.getFilter(); + assertTrue(newFilter instanceof SingleColumnValueFilter); + assertEquals(((SingleColumnValueFilter)newFilter).getOperator(), SingleColumnValueFilter.CompareOperator.EQUAL); + assertEquals(((SingleColumnValueFilter)newFilter).getColumnValue(), ColumnValue.fromLong(10)); + assertEquals(((SingleColumnValueFilter)newFilter).getColumnName(), "column"); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestNameTimestampComparator.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestNameTimestampComparator.java new file mode 100644 index 0000000..f750696 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestNameTimestampComparator.java @@ -0,0 +1,88 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestNameTimestampComparator { + + @Test + public void testComparator_CompareName() { + NameTimestampComparator comparator = new NameTimestampComparator(); + Column column1 = new Column("T1", ColumnValue.fromLong(10), 1418380771); + Column column2 = new Column("T1", ColumnValue.fromLong(10), 1418380771); + Column column3 = new Column("T0", ColumnValue.fromLong(10), 1418380771); + Column column4 = new Column("T2", ColumnValue.fromLong(10), 1418380771); + assertTrue(comparator.compare(column1, column2) == 0); + assertTrue(comparator.compare(column1, column3) > 0); + assertTrue(comparator.compare(column1, column4) < 0); + } + + @Test + public void testComparator_CompareTimestamp() { + NameTimestampComparator comparator = new NameTimestampComparator(); + Column column1 = new Column("T1", ColumnValue.fromLong(10), 1418380772); + Column column2 = new Column("T1", ColumnValue.fromLong(10), 1418380772); + Column column3 = new Column("T1", ColumnValue.fromLong(10), 1418380773); + Column column4 = new Column("T1", ColumnValue.fromLong(10), 1418380771); + assertTrue(comparator.compare(column1, column2) == 0); + assertTrue(comparator.compare(column1, column3) > 0); + assertTrue(comparator.compare(column1, column4) < 0); + } + + @Test + public void testComparator_CompareValue() { + NameTimestampComparator comparator = new NameTimestampComparator(); + Column column1 = new Column("T1", ColumnValue.fromLong(10), 1418380771); + Column column2 = new Column("T1", ColumnValue.fromLong(11), 1418380771); + Column column3 = new Column("T1", ColumnValue.fromLong(12), 1418380771); + Column column4 = new Column("T1", ColumnValue.fromLong(13), 1418380771); + assertTrue(comparator.compare(column1, column2) == 0); + assertTrue(comparator.compare(column1, column3) == 0); + assertTrue(comparator.compare(column1, column4) == 0); + } + + @Test + public void testSort() { + List columns = new ArrayList(); + columns.add(new Column("T1", ColumnValue.fromLong(10), 1418380772)); + columns.add(new Column("T1", ColumnValue.fromLong(10), 1418380771)); + columns.add(new Column("T0", ColumnValue.fromLong(10), 1418380771)); + columns.add(new Column("T1", ColumnValue.fromLong(10), 1418380773)); + columns.add(new Column("T2", ColumnValue.fromLong(10), 1418380772)); + columns.add(new Column("T0", ColumnValue.fromLong(10), 1418380771)); + columns.add(new Column("T3", ColumnValue.fromLong(10), 1418380771)); + columns.add(new Column("T2", ColumnValue.fromLong(10), 1418380771)); + + Collections.sort(columns, new NameTimestampComparator()); + assertEquals(columns.get(0).getName(), "T0"); + assertEquals(columns.get(0).getTimestamp(), 1418380771); + + assertEquals(columns.get(1).getName(), "T0"); + assertEquals(columns.get(1).getTimestamp(), 1418380771); + + assertEquals(columns.get(2).getName(), "T1"); + assertEquals(columns.get(2).getTimestamp(), 1418380773); + + assertEquals(columns.get(3).getName(), "T1"); + assertEquals(columns.get(3).getTimestamp(), 1418380772); + + assertEquals(columns.get(4).getName(), "T1"); + assertEquals(columns.get(4).getTimestamp(), 1418380771); + + assertEquals(columns.get(5).getName(), "T2"); + assertEquals(columns.get(5).getTimestamp(), 1418380772); + + assertEquals(columns.get(6).getName(), "T2"); + assertEquals(columns.get(6).getTimestamp(), 1418380771); + + assertEquals(columns.get(7).getName(), "T3"); + assertEquals(columns.get(7).getTimestamp(), 1418380771); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestPartitionRange.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestPartitionRange.java new file mode 100644 index 0000000..3d82821 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestPartitionRange.java @@ -0,0 +1,25 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class TestPartitionRange { + + @Test + public void testConstructor() { + PartitionRange range = new PartitionRange(PrimaryKeyValue.fromString("A"), + PrimaryKeyValue.fromString("B")); + assertEquals(range.getBegin(), PrimaryKeyValue.fromString("A")); + assertEquals(range.getEnd(), PrimaryKeyValue.fromString("B")); + + // test type not same + try { + new PartitionRange(PrimaryKeyValue.fromLong(10), PrimaryKeyValue.fromString("A")); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKey.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKey.java new file mode 100644 index 0000000..5371602 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKey.java @@ -0,0 +1,179 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestPrimaryKey { + + @Test + public void testOperations() { + PrimaryKeyBuilder builder = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) + .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) + .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)) + .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)) + .addPrimaryKeyColumn("E", PrimaryKeyValue.fromLong(5)); + + PrimaryKey primaryKey = builder.build(); + + PrimaryKeyColumn[] pks = primaryKey.getPrimaryKeyColumns(); + assertEquals(primaryKey.size(), 5); + for (int i = 0; i < primaryKey.size(); i++) { + assertEquals(primaryKey.getPrimaryKeyColumn(i), pks[i]); + } + + assertEquals(primaryKey.getPrimaryKeyColumn("A").getValue(), PrimaryKeyValue.fromLong(1)); + assertEquals(primaryKey.getPrimaryKeyColumn("B").getValue(), PrimaryKeyValue.fromLong(2)); + assertEquals(primaryKey.getPrimaryKeyColumn("C").getValue(), PrimaryKeyValue.fromLong(3)); + assertEquals(primaryKey.getPrimaryKeyColumn("D").getValue(), PrimaryKeyValue.fromLong(4)); + assertEquals(primaryKey.getPrimaryKeyColumn("E").getValue(), PrimaryKeyValue.fromLong(5)); + + assertTrue(primaryKey.contains("A")); + assertTrue(primaryKey.contains("B")); + assertTrue(primaryKey.contains("C")); + assertTrue(primaryKey.contains("D")); + assertTrue(primaryKey.contains("E")); + assertTrue(!primaryKey.contains("a")); + + try { + primaryKey.getPrimaryKeyColumn(5); + fail(); + } catch (IllegalArgumentException e) { + + } + + assertTrue(!primaryKey.isEmpty()); + } + + @Test + public void testEquals() { + PrimaryKeyBuilder builder = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) + .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) + .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)) + .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)) + .addPrimaryKeyColumn("E", PrimaryKeyValue.fromLong(5)); + + PrimaryKey primaryKey1 = builder.build(); + PrimaryKey primaryKey2 = builder.build(); + + assertEquals(primaryKey1, primaryKey2); + assertEquals(primaryKey1.hashCode(), primaryKey2.hashCode()); + + PrimaryKeyColumn[] tmp = primaryKey1.getPrimaryKeyColumns(); + tmp[2] = new PrimaryKeyColumn("C", PrimaryKeyValue.fromLong(4)); + + PrimaryKey primaryKey3 = new PrimaryKey(tmp); + assertTrue(!primaryKey1.equals(primaryKey3)); + + PrimaryKey primaryKey4 = new PrimaryKey(Arrays.copyOf(primaryKey1.getPrimaryKeyColumns(), 4)); + assertTrue(!primaryKey1.equals(primaryKey4)); + } + + @Test + public void testCompareTo() { + PrimaryKeyBuilder builder = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) + .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) + .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)) + .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)) + .addPrimaryKeyColumn("E", PrimaryKeyValue.fromLong(5)); + + PrimaryKey primaryKey1 = builder.build(); + PrimaryKey primaryKey2 = builder.build(); + + assertTrue(primaryKey1.compareTo(primaryKey2) == 0); + assertEquals(primaryKey1.hashCode(), primaryKey2.hashCode()); + + PrimaryKeyColumn[] tmp = primaryKey1.getPrimaryKeyColumns(); + tmp[2] = new PrimaryKeyColumn("C", PrimaryKeyValue.fromLong(4)); + + PrimaryKey primaryKey3 = new PrimaryKey(tmp); + assertTrue(primaryKey1.compareTo(primaryKey3) < 0); + assertTrue(primaryKey3.compareTo(primaryKey1) > 0); + } + + @Test + public void testCompareTo_InvalidArguments() { + PrimaryKeyBuilder builder = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) + .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) + .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)) + .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)) + .addPrimaryKeyColumn("E", PrimaryKeyValue.fromLong(5)); + PrimaryKey primaryKey1 = builder.build(); + + // compare two primary key with different length + PrimaryKey primaryKey2 = new PrimaryKey(Arrays.copyOf(primaryKey1.getPrimaryKeyColumns(), 4)); + try { + primaryKey1.compareTo(primaryKey2); + fail(); + } catch (IllegalArgumentException e) { + + } + + // compare two primary key with different name + PrimaryKeyColumn[] tmp = primaryKey1.getPrimaryKeyColumns(); + tmp[2] = new PrimaryKeyColumn("CC", PrimaryKeyValue.fromLong(3)); + + PrimaryKey primaryKey3 = new PrimaryKey(tmp); + try { + primaryKey1.compareTo(primaryKey3); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new PrimaryKey(new PrimaryKeyColumn[0]); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testGetDataSize() { + { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(8)) + .build(); + assertEquals(primaryKey.getDataSize(), 11); + } + { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2})) + .build(); + assertEquals(primaryKey.getDataSize(), 6); + } + { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromString("abc")) + .build(); + assertEquals(primaryKey.getDataSize(), 6); + } + { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.AUTO_INCREMENT) + .build(); + assertEquals(primaryKey.getDataSize(), 3); + } + { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN) + .build(); + assertEquals(primaryKey.getDataSize(), 3); + } + { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX) + .build(); + assertEquals(primaryKey.getDataSize(), 3); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeyColumn.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeyColumn.java new file mode 100644 index 0000000..6be5967 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeyColumn.java @@ -0,0 +1,109 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestPrimaryKeyColumn { + + @Test + public void testConstructor() { + PrimaryKeyColumn pk = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1912)); + assertEquals(pk.getName(), "PK1"); + assertEquals(pk.getValue(), PrimaryKeyValue.fromLong(1912)); + + try { + new PrimaryKeyColumn(null, PrimaryKeyValue.fromLong(1912)); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + new PrimaryKeyColumn("", PrimaryKeyValue.fromLong(1912)); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + new PrimaryKeyColumn("PK1", null); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testEquals() { + PrimaryKeyColumn pk1 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1912)); + PrimaryKeyColumn pk2 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1912)); + + // value not equal + PrimaryKeyColumn pk3 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1911)); + + // name not equal + PrimaryKeyColumn pk4 = new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1912)); + assertEquals(pk1, pk2); + assertEquals(pk1.hashCode(), pk2.hashCode()); + + assertTrue(!pk1.equals(pk3)); + assertTrue(pk1.hashCode() != pk3.hashCode()); + assertTrue(!pk1.equals(pk4)); + assertTrue(pk1.hashCode() != pk4.hashCode()); + } + + @Test + public void testCompareTo() { + PrimaryKeyColumn pk1 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1912)); + PrimaryKeyColumn pk2 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1912)); + assertTrue(pk1.compareTo(pk2) == 0); + + PrimaryKeyColumn pk3 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1911)); + PrimaryKeyColumn pk4 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(1913)); + + assertTrue(pk1.compareTo(pk3) > 0); + assertTrue(pk1.compareTo(pk4) < 0); + + // name not equal + try { + PrimaryKeyColumn pk5 = new PrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1912)); + pk1.compareTo(pk5); + fail(); + } catch (IllegalArgumentException e) { + + } + + // value type not equal + try { + PrimaryKeyColumn pk6 = new PrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("1912")); + pk1.compareTo(pk6); + fail(); + } catch (IllegalArgumentException e) { + } + } + + @Test + public void testGetDataSize() { + PrimaryKeyColumn pkc = new PrimaryKeyColumn("pk0", PrimaryKeyValue.fromString("abc")); + assertEquals(pkc.getDataSize(), 6); + + pkc = new PrimaryKeyColumn("pk0", PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1})); + assertEquals(pkc.getDataSize(), 5); + + pkc = new PrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(100)); + assertEquals(pkc.getDataSize(), 11); + + pkc = new PrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN); + assertEquals(pkc.getDataSize(), 3); + + pkc = new PrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX); + assertEquals(pkc.getDataSize(), 3); + + pkc = new PrimaryKeyColumn("pk0", PrimaryKeyValue.AUTO_INCREMENT); + assertEquals(pkc.getDataSize(), 3); + + pkc = new PrimaryKeyColumn("pk0", PrimaryKeyValue.AUTO_INCRMENT); + assertEquals(pkc.getDataSize(), 3); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeySchema.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeySchema.java new file mode 100644 index 0000000..7fe534e --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeySchema.java @@ -0,0 +1,153 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestPrimaryKeySchema { + + @Test + public void testConstructor() { + PrimaryKeySchema schema = new PrimaryKeySchema("A", PrimaryKeyType.BINARY); + assertEquals(schema.getName(), "A"); + assertEquals(schema.getType(), PrimaryKeyType.BINARY); + + PrimaryKeySchema schema2 = new PrimaryKeySchema("B", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + assertEquals(schema2.getName(), "B"); + assertEquals(schema2.getType(), PrimaryKeyType.INTEGER); + assertEquals(schema2.getOption(), PrimaryKeyOption.AUTO_INCREMENT); + + try { + new PrimaryKeySchema(null, PrimaryKeyType.BINARY); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + new PrimaryKeySchema("", PrimaryKeyType.BINARY); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + new PrimaryKeySchema("A", null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new PrimaryKeySchema("A", PrimaryKeyType.INTEGER, null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new PrimaryKeySchema("A", PrimaryKeyType.BINARY, PrimaryKeyOption.AUTO_INCREMENT); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new PrimaryKeySchema("A", PrimaryKeyType.STRING, PrimaryKeyOption.AUTO_INCREMENT); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testEqual() { + { + PrimaryKeySchema schemaA = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + PrimaryKeySchema schemaB = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + assertTrue(schemaA.equals(schemaB)); + } + + { + PrimaryKeySchema schemaA = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + PrimaryKeySchema schemaB = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + assertTrue(!schemaA.equals(schemaB)); + } + + { + PrimaryKeySchema schemaA = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + PrimaryKeySchema schemaB = new PrimaryKeySchema("B", PrimaryKeyType.INTEGER); + assertTrue(!schemaA.equals(schemaB)); + } + + { + PrimaryKeySchema schemaA = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + PrimaryKeySchema schemaB = new PrimaryKeySchema("A", PrimaryKeyType.BINARY); + assertTrue(!schemaA.equals(schemaB)); + } + + { + PrimaryKeySchema schemaA = new PrimaryKeySchema("A", PrimaryKeyType.BINARY); + PrimaryKeySchema schemaB = new PrimaryKeySchema("A", PrimaryKeyType.STRING); + assertTrue(!schemaA.equals(schemaB)); + } + + { + PrimaryKeySchema schemaA = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + PrimaryKeySchema schemaB = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + assertTrue(schemaA.equals(schemaB)); + } + } + + @Test + public void testHashCode() { + { + Map schemaMap = new HashMap(); + PrimaryKeySchema schema = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + schemaMap.put(schema, "1"); + } + + { + Map schemaMap = new HashMap(); + PrimaryKeySchema schema = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + schemaMap.put(schema, "1"); + } + } + + @Test + public void testToString() { + { + PrimaryKeySchema schema = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + + String str = schema.toString(); + assertEquals("A:INTEGER", str); + } + + { + PrimaryKeySchema schema = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + + String str = schema.toString(); + assertEquals("A:INTEGER:AUTO_INCREMENT", str); + } + } + + @Test + public void testJsonizer() { + { + PrimaryKeySchema schema = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER); + + String json = schema.jsonize(); + assertEquals("{\"Name\": \"A\", \"Type\": \"INTEGER\"}", json); + } + + { + PrimaryKeySchema schema = new PrimaryKeySchema("A", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + + String json = schema.jsonize(); + assertEquals("{\"Name\": \"A\", \"Type\": \"INTEGER\", \"Option\":\"AUTO_INCREMENT\"}", json); + } + } +} diff --git a/src/test/java/com/aliyun/openservices/ots/model/PrimaryKeyValueTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeyValue.java similarity index 63% rename from src/test/java/com/aliyun/openservices/ots/model/PrimaryKeyValueTest.java rename to src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeyValue.java index 444027b..4024e03 100644 --- a/src/test/java/com/aliyun/openservices/ots/model/PrimaryKeyValueTest.java +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestPrimaryKeyValue.java @@ -1,34 +1,16 @@ -package com.aliyun.openservices.ots.model; +package com.alicloud.openservices.tablestore.model; -import static org.junit.Assert.*; - -import com.aliyun.openservices.ots.utils.Bytes; -import com.aliyun.openservices.ots.utils.TestUtil; +import com.alicloud.openservices.tablestore.common.TestUtil; +import com.alicloud.openservices.tablestore.core.utils.Bytes; import org.junit.Assert; import org.junit.Test; -public class PrimaryKeyValueTest { - - @Test - public void testVariousType() { - PrimaryKeyValue value = PrimaryKeyValue.fromLong(999); - assertEquals(value.asLong(), 999); - assertEquals(value.getType(), PrimaryKeyType.INTEGER); - assertTrue(value.equals(PrimaryKeyValue.fromLong(value.asLong()))); - try { - value.asString(); - fail(); - } catch(Exception e) {} - - value = PrimaryKeyValue.fromString("OTS"); - assertEquals(value.asString(), "OTS"); - assertEquals(value.getType(), PrimaryKeyType.STRING); - assertTrue(value.equals(PrimaryKeyValue.fromString(value.asString()))); - try { - value.asLong(); - fail(); - } catch(Exception e) {} - } +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.*; + +public class TestPrimaryKeyValue { private void checkType(PrimaryKeyValue v) { PrimaryKeyType type = v.getType(); @@ -50,6 +32,12 @@ private void checkType(PrimaryKeyValue v) { } + try { + v.asStringInBytes(); + fail(); + } catch (IllegalStateException e) { + + } } if (type != PrimaryKeyType.BINARY) { @@ -67,7 +55,6 @@ public void testInteger() { long value = TestUtil.randomLong(); PrimaryKeyValue v = PrimaryKeyValue.fromLong(value); assertEquals(v.asLong(), value); - assertEquals(v.getSize(), 8); checkType(v); } @@ -76,16 +63,15 @@ public void testString() { String value = TestUtil.randomString(100000); PrimaryKeyValue v = PrimaryKeyValue.fromString(value); assertEquals(v.asString(), value); - assertEquals(v.getSize(), Bytes.toBytes(value).length); + Assert.assertArrayEquals(v.asStringInBytes(), Bytes.toBytes(value)); checkType(v); } @Test - public void testBinary() { + public void testBytes() { byte[] value = TestUtil.randomBytes(100000); PrimaryKeyValue v = PrimaryKeyValue.fromBinary(value); - assertEquals(v.asBinary(), value); - assertEquals(v.getSize(), value.length); + assertArrayEquals(v.asBinary(), value); checkType(v); } @@ -98,21 +84,29 @@ private void checkEquals(PrimaryKeyValue v1, PrimaryKeyValue v2) { public void testEquals_Integer() { checkEquals(PrimaryKeyValue.fromLong(10), PrimaryKeyValue.fromLong(10)); assertTrue(!PrimaryKeyValue.fromLong(11).equals(PrimaryKeyValue.fromLong(10))); + assertTrue(!PrimaryKeyValue.fromLong(11).equals(PrimaryKeyValue.fromBinary(TestUtil.randomBytes(10)))); assertTrue(!PrimaryKeyValue.fromLong(11).equals(PrimaryKeyValue.fromString(TestUtil.randomString(10)))); } @Test - public void testEquals_String() { + public void testEquals_String() { checkEquals(PrimaryKeyValue.fromString("HelloWorld"), PrimaryKeyValue.fromString("HelloWorld")); assertTrue(!PrimaryKeyValue.fromString("HelloWorld").equals(PrimaryKeyValue.fromString("HelloWorld2"))); + assertTrue(!PrimaryKeyValue.fromString("HelloWorld").equals(PrimaryKeyValue.fromBinary(TestUtil.randomBytes(10)))); assertTrue(!PrimaryKeyValue.fromString("HelloWorld").equals(PrimaryKeyValue.fromLong(TestUtil.randomLong()))); } @Test - public void testEquals_Binary() { - checkEquals(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x3, 0x10}), PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x3, 0x10})); - assertTrue(!PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2, 0x10}).equals(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x2, 0x2, 0x10}))); - assertTrue(!PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2, 0x10}).equals(PrimaryKeyValue.fromLong(TestUtil.randomLong()))); + public void testEquals_Bytes() { + checkEquals(PrimaryKeyValue.fromBinary(new byte[]{0x1, 0x2, 0x3}), PrimaryKeyValue.fromBinary(new byte[]{0x1, 0x2, 0x3})); + assertTrue(!PrimaryKeyValue.fromBinary(new byte[]{0x1, 0x2, 0x3}).equals(PrimaryKeyValue.fromBinary(new byte[]{0x1, 0x3, 0x3}))); + assertTrue(!PrimaryKeyValue.fromBinary(new byte[]{0x1, 0x2, 0x3}).equals(PrimaryKeyValue.fromLong(TestUtil.randomLong()))); + assertTrue(!PrimaryKeyValue.fromBinary(new byte[]{0x1, 0x2, 0x3}).equals(PrimaryKeyValue.fromString("HelloWorld"))); + } + + @Test + public void testEquals_AUTOINCREMENT() { + checkEquals(PrimaryKeyValue.AUTO_INCREMENT, PrimaryKeyValue.AUTO_INCRMENT); } private void compareWithOtherType(PrimaryKeyValue v) { @@ -138,7 +132,7 @@ private void compareWithOtherType(PrimaryKeyValue v) { if (type != PrimaryKeyType.BINARY) { try { - v.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0})); + v.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x1, 0x2})); fail(); } catch (IllegalArgumentException e) { @@ -160,7 +154,7 @@ public void testCompareTo_Integer() { public void testCompareTo_String() { PrimaryKeyValue value = PrimaryKeyValue.fromString("a b c d e"); assertTrue(value.compareTo(PrimaryKeyValue.fromString("a b c d e")) == 0); - assertTrue(PrimaryKeyValue.fromString("阿里巴巴").compareTo(PrimaryKeyValue.fromString("阿里巴巴")) == 0); + assertTrue(PrimaryKeyValue.fromString("����Ͱ�").compareTo(PrimaryKeyValue.fromString("����Ͱ�")) == 0); assertTrue(value.compareTo(PrimaryKeyValue.fromString("a b c d f")) < 0); assertTrue(value.compareTo(PrimaryKeyValue.fromString("a b c d d")) > 0); @@ -169,12 +163,12 @@ public void testCompareTo_String() { @Test public void testCompareTo_Bytes() { - PrimaryKeyValue value = PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte) 0xff, 0x3}); + PrimaryKeyValue value = PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte)0xff, 0x3}); assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte)0xff, 0x3})) == 0); - assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte) 0xfe, 0x3})) > 0); - assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte) 0xff, 0x4})) < 0); - assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte) 0xff})) > 0); - assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte) 0xff, 0x3, 0x0})) < 0); + assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte)0xfe, 0x3})) > 0); + assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte)0xff, 0x4})) < 0); + assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte)0xff})) > 0); + assertTrue(value.compareTo(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, (byte)0xff, 0x3, 0x0})) < 0); compareWithOtherType(value); } @@ -185,13 +179,13 @@ public void testFromColumn() { PrimaryKeyValue pk = PrimaryKeyValue.fromColumn(column); assertEquals(pk.asString(), column.asString()); - column = ColumnValue.fromLong(1024); + column = ColumnValue.fromBinary(new byte[]{0xa, 0xb, 0xc, 0xd, 0xe}); pk = PrimaryKeyValue.fromColumn(column); - assertEquals(pk.asLong(), column.asLong()); + assertEquals(pk.asBinary(), column.asBinary()); - column = ColumnValue.fromBinary(new byte[]{0x0, 0x1, 0x2}); + column = ColumnValue.fromLong(1024); pk = PrimaryKeyValue.fromColumn(column); - assertArrayEquals(pk.asBinary(), column.asBinary()); + assertEquals(pk.asLong(), column.asLong()); column = ColumnValue.fromDouble(1024); try { @@ -210,4 +204,31 @@ public void testFromColumn() { } } + @Test + public void testHashCode() { + Map valueMap = new HashMap(); + { + PrimaryKeyValue value = PrimaryKeyValue.AUTO_INCREMENT; + valueMap.put(value, 100L); + } + + { + PrimaryKeyValue value = PrimaryKeyValue.INF_MAX; + valueMap.put(value, 100L); + } + + { + PrimaryKeyValue value = PrimaryKeyValue.INF_MIN; + valueMap.put(value, 100L); + } + } + + @Test + public void testGetDataSize() { + assertEquals(PrimaryKeyValue.AUTO_INCREMENT.getDataSize(), 0); + assertEquals(PrimaryKeyValue.AUTO_INCREMENT.getDataSize(), 0); + assertEquals(PrimaryKeyValue.fromString("abc").getDataSize(), 3); + assertEquals(PrimaryKeyValue.fromBinary(new byte[]{0x0, 0x1, 0x2}).getDataSize(), 3); + assertEquals(8, PrimaryKeyValue.fromLong(100).getDataSize()); + } } diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestReservedThroughput.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestReservedThroughput.java new file mode 100644 index 0000000..9b968b9 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestReservedThroughput.java @@ -0,0 +1,29 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestReservedThroughput { + + @Test + public void testConstructor() { + ReservedThroughput rt = new ReservedThroughput(new CapacityUnit(10, 0)); + assertEquals(rt.getCapacityUnit().getReadCapacityUnit(), 10); + assertEquals(rt.getCapacityUnit().getWriteCapacityUnit(), 0); + } + + @Test + public void testEquals() { + ReservedThroughput rt1 = new ReservedThroughput(new CapacityUnit(10, 11)); + ReservedThroughput rt2 = new ReservedThroughput(new CapacityUnit(10, 11)); + ReservedThroughput rt3 = new ReservedThroughput(new CapacityUnit(12, 11)); + assertEquals(rt1, rt2); + assertEquals(rt1.hashCode(), rt2.hashCode()); + + assertTrue(!rt1.equals(rt3)); + assertTrue(rt1.hashCode() != rt3.hashCode()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestRow.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestRow.java new file mode 100644 index 0000000..516a82f --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestRow.java @@ -0,0 +1,220 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.*; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestRow { + + @Test + public void testConstructorWithInvalidArguments() { + try { + new Row(null, new ArrayList()); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new Row(new PrimaryKey(new PrimaryKeyColumn[0]), new ArrayList()); + fail(); + } catch (IllegalArgumentException e) { + + } + + Row row = new Row(PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(100)).build(), + new ArrayList()); + assertTrue(row.isEmpty()); + assertTrue(row.getColumn("Column0").isEmpty()); + assertTrue(row.getLatestColumn("Column0") == null); + assertTrue(row.getColumns().length == 0); + assertTrue(row.getColumnsMap().isEmpty()); + } + + @Test + public void testOperations() { + List columns = new ArrayList(); + Random random = new Random(System.currentTimeMillis()); + + columns.add(new Column("Column0", ColumnValue.fromLong(11), 1418610011)); + columns.add(new Column("Column0", ColumnValue.fromLong(10), 1418610010)); + columns.add(new Column("Column0", ColumnValue.fromLong(9), 1418610009)); + + columns.add(new Column("Column1", ColumnValue.fromLong(15), 1418610015)); + columns.add(new Column("Column1", ColumnValue.fromLong(14), 1418610014)); + columns.add(new Column("Column1", ColumnValue.fromLong(13), 1418610013)); + + columns.add(new Column("Column2", ColumnValue.fromLong(13), 1418610013)); + columns.add(new Column("Column2", ColumnValue.fromLong(12), 1418610012)); + + columns.add(new Column("Column3", ColumnValue.fromLong(17), 1418610017)); + columns.add(new Column("Column3", ColumnValue.fromLong(16), 1418610016)); + columns.add(new Column("Column3", ColumnValue.fromLong(13), 1418610013)); + + columns.add(new Column("Column4", ColumnValue.fromLong(19), 1418610019)); + columns.add(new Column("Column4", ColumnValue.fromLong(18), 1418610018)); + columns.add(new Column("Column4", ColumnValue.fromLong(17), 1418610017)); + columns.add(new Column("Column4", ColumnValue.fromLong(15), 1418610015)); + + columns.add(new Column("Column5", ColumnValue.fromLong(15), 1418610015)); + columns.add(new Column("Column5", ColumnValue.fromLong(14), 1418610014)); + columns.add(new Column("Column5", ColumnValue.fromLong(13), 1418610013)); + columns.add(new Column("Column5", ColumnValue.fromLong(11), 1418610011)); + + List randomColumns = new ArrayList(columns); + Collections.shuffle(randomColumns, random); + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromLong(10)) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromString("A")).build(); + + Row row = new Row(primaryKey, randomColumns); + Column[] rowColumns = row.getColumns(); + + assertEquals(rowColumns.length, columns.size()); + for (int i = 0; i < rowColumns.length; i++) { + assertEquals(columns.get(i), rowColumns[i]); + } + + assertEquals(row.getPrimaryKey(), primaryKey); + + assertTrue(row.getColumn("Column6").isEmpty()); + assertTrue(row.getColumn("NonExistColumn").isEmpty()); + + List getColumns = row.getColumn("Column0"); + assertEquals(getColumns.size(), 3); + assertEquals(getColumns.get(0), columns.get(0)); + assertEquals(getColumns.get(1), columns.get(1)); + assertEquals(getColumns.get(2), columns.get(2)); + + getColumns = row.getColumn("Column1"); + assertEquals(getColumns.size(), 3); + assertEquals(getColumns.get(0), columns.get(3)); + assertEquals(getColumns.get(1), columns.get(4)); + assertEquals(getColumns.get(2), columns.get(5)); + + getColumns = row.getColumn("Column2"); + assertEquals(getColumns.size(), 2); + assertEquals(getColumns.get(0), columns.get(6)); + assertEquals(getColumns.get(1), columns.get(7)); + + getColumns = row.getColumn("Column3"); + assertEquals(getColumns.size(), 3); + assertEquals(getColumns.get(0), columns.get(8)); + assertEquals(getColumns.get(1), columns.get(9)); + assertEquals(getColumns.get(2), columns.get(10)); + + getColumns = row.getColumn("Column4"); + assertEquals(getColumns.size(), 4); + assertEquals(getColumns.get(0), columns.get(11)); + assertEquals(getColumns.get(1), columns.get(12)); + assertEquals(getColumns.get(2), columns.get(13)); + assertEquals(getColumns.get(3), columns.get(14)); + + getColumns = row.getColumn("Column5"); + assertEquals(getColumns.size(), 4); + assertEquals(getColumns.get(0), columns.get(15)); + assertEquals(getColumns.get(1), columns.get(16)); + assertEquals(getColumns.get(2), columns.get(17)); + assertEquals(getColumns.get(3), columns.get(18)); + + assertTrue(row.getLatestColumn("Column6") == null); + assertTrue(row.getLatestColumn("NonExistColumn") == null); + + assertEquals(row.getLatestColumn("Column0"), columns.get(0)); + assertEquals(row.getLatestColumn("Column1"), columns.get(3)); + assertEquals(row.getLatestColumn("Column2"), columns.get(6)); + assertEquals(row.getLatestColumn("Column3"), columns.get(8)); + assertEquals(row.getLatestColumn("Column4"), columns.get(11)); + assertEquals(row.getLatestColumn("Column5"), columns.get(15)); + + assertTrue(row.contains("Column0")); + assertTrue(row.contains("Column1")); + assertTrue(row.contains("Column2")); + assertTrue(row.contains("Column3")); + assertTrue(row.contains("Column4")); + assertTrue(row.contains("Column5")); + + assertTrue(!row.contains("Column6")); + assertTrue(!row.contains("NonExistColumn")); + + assertTrue(!row.isEmpty()); + + NavigableMap> columnsMap = row.getColumnsMap(); + assertEquals(columnsMap.size(), 6); + assertTrue(columnsMap.get("Column0") != null); + assertTrue(columnsMap.get("Column1") != null); + assertTrue(columnsMap.get("Column2") != null); + assertTrue(columnsMap.get("Column3") != null); + assertTrue(columnsMap.get("Column4") != null); + assertTrue(columnsMap.get("Column5") != null); + + assertEquals(columnsMap.ceilingKey("Column"), "Column0"); + assertEquals(columnsMap.ceilingKey("Column0"), "Column0"); + assertEquals(columnsMap.ceilingKey("Column00"), "Column1"); + + assertEquals(columnsMap.ceilingKey("Column1"), "Column1"); + assertEquals(columnsMap.ceilingKey("Column10"), "Column2"); + + assertEquals(columnsMap.ceilingKey("Column2"), "Column2"); + assertEquals(columnsMap.ceilingKey("Column20"), "Column3"); + + assertEquals(columnsMap.ceilingKey("Column3"), "Column3"); + assertEquals(columnsMap.ceilingKey("Column30"), "Column4"); + + assertEquals(columnsMap.ceilingKey("Column4"), "Column4"); + assertEquals(columnsMap.ceilingKey("Column40"), "Column5"); + + assertEquals(columnsMap.ceilingKey("Column5"), "Column5"); + assertTrue(columnsMap.ceilingKey("Column50") == null); + + String[] descendingKeys = columnsMap.descendingKeySet().toArray(new String[columnsMap.keySet().size()]); + assertEquals(descendingKeys.length, 6); + assertEquals(descendingKeys[0], "Column5"); + assertEquals(descendingKeys[1], "Column4"); + assertEquals(descendingKeys[2], "Column3"); + assertEquals(descendingKeys[3], "Column2"); + assertEquals(descendingKeys[4], "Column1"); + assertEquals(descendingKeys[5], "Column0"); + + NavigableMap values = columnsMap.get("Column0"); + compareTimestamps(values, values.descendingKeySet().toArray(new Long[values.keySet().size()]), + new long[]{1418610009, 1418610010, 1418610011}); + + values = columnsMap.get("Column1"); + compareTimestamps(values, values.descendingKeySet().toArray(new Long[values.keySet().size()]), + new long[]{1418610013, 1418610014, 1418610015}); + + values = columnsMap.get("Column2"); + compareTimestamps(values, values.descendingKeySet().toArray(new Long[values.keySet().size()]), + new long[]{1418610012, 1418610013}); + + values = columnsMap.get("Column3"); + compareTimestamps(values, values.descendingKeySet().toArray(new Long[values.keySet().size()]), + new long[]{1418610013, 1418610016, 1418610017}); + + values = columnsMap.get("Column4"); + compareTimestamps(values, values.descendingKeySet().toArray(new Long[values.keySet().size()]), + new long[]{1418610015, 1418610017, 1418610018, 1418610019}); + + values = columnsMap.get("Column5"); + compareTimestamps(values, values.descendingKeySet().toArray(new Long[values.keySet().size()]), + new long[]{1418610011, 1418610013, 1418610014, 1418610015}); + } + + private void compareTimestamps(NavigableMap values, Long[] l1, long[] l2) { + assertEquals(l1.length, l2.length); + for (int i = 0; i < l1.length; i++) { + assertEquals(l1[i].longValue(), l2[i]); + assertEquals(values.get(l1[i]).asLong(), l2[i] - 1418610000); + } + } + + @Test + public void testRowCompareTo() { + + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestRowDeleteChange.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowDeleteChange.java new file mode 100644 index 0000000..06f8630 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowDeleteChange.java @@ -0,0 +1,77 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class TestRowDeleteChange { + + @Test + public void testConstructorWithInvalidArguments() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowDeleteChange rowChange = new RowDeleteChange("T", primaryKey); + assertEquals(rowChange.getTableName(), "T"); + assertEquals(rowChange.getPrimaryKey(), primaryKey); + + try { + new RowDeleteChange("", primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowDeleteChange(null, primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowDeleteChange("T", null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowDeleteChange("T", PrimaryKeyBuilder.createPrimaryKeyBuilder().build()); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testCompareTo() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + PrimaryKey primaryKey2 = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowDeleteChange rowChange = new RowDeleteChange("T", primaryKey); + RowDeleteChange rowChange2 = new RowDeleteChange("T", primaryKey2); + + assertTrue(rowChange.compareTo(rowChange2) == 0); + } + + @Test + public void testGetDataSize() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(8)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abcde")) + .build(); + + PrimaryKey primaryKey2 = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(8)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abcde")) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromString("abcde")) + .build(); + + RowDeleteChange rdc = new RowDeleteChange("TestTable", primaryKey); + assertEquals(rdc.getDataSize(), 19); + + rdc.setPrimaryKey(primaryKey2); + assertEquals(rdc.getDataSize(), 27); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestRowPutChange.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowPutChange.java new file mode 100644 index 0000000..56ac939 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowPutChange.java @@ -0,0 +1,206 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.*; + +public class TestRowPutChange { + + @Test + public void testAddColumn_WithDefaultTimestamp() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + + RowPutChange rowChange = new RowPutChange("T", primaryKey, 1418630000); + + rowChange.addColumn("Column0", ColumnValue.fromLong(10)); + + Column target = rowChange.getColumnsToPut().get(0); + assertEquals(target.getName(), "Column0"); + assertEquals(target.getValue(), ColumnValue.fromLong(10)); + assertTrue(target.hasSetTimestamp()); + assertEquals(target.getTimestamp(), 1418630000); + assertEquals(rowChange.getReturnType(), ReturnType.RT_NONE); + + rowChange.addColumn("Column0", ColumnValue.fromLong(11), 1418630002); + target = rowChange.getColumnsToPut().get(1); + assertEquals(target.getName(), "Column0"); + assertEquals(target.getValue(), ColumnValue.fromLong(11)); + assertTrue(target.hasSetTimestamp()); + assertEquals(target.getTimestamp(), 1418630002); + + rowChange.addColumn(new Column("Column1", ColumnValue.fromLong(12))); + target = rowChange.getColumnsToPut().get(2); + assertEquals(target.getName(), "Column1"); + assertEquals(target.getValue(), ColumnValue.fromLong(12)); + assertTrue(!target.hasSetTimestamp()); + } + + @Test + public void testAddColumn_WithReturnType() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + + RowPutChange rowChange = new RowPutChange("T", primaryKey, 1418630000); + rowChange.setReturnType(ReturnType.RT_PK); + + rowChange.addColumn("Column0", ColumnValue.fromLong(10)); + + Column target = rowChange.getColumnsToPut().get(0); + assertEquals(target.getName(), "Column0"); + assertEquals(target.getValue(), ColumnValue.fromLong(10)); + assertTrue(target.hasSetTimestamp()); + assertEquals(target.getTimestamp(), 1418630000); + assertEquals(rowChange.getReturnType(), ReturnType.RT_PK); + } + + @Test + public void testAddColumn_WithoutDefaultTimestamp() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + + RowPutChange rowChange = new RowPutChange("T", primaryKey); + + rowChange.addColumn("Column0", ColumnValue.fromLong(10)); + + Column target = rowChange.getColumnsToPut().get(0); + assertEquals(target.getName(), "Column0"); + assertEquals(target.getValue(), ColumnValue.fromLong(10)); + assertTrue(!target.hasSetTimestamp()); + + rowChange.addColumn("Column0", ColumnValue.fromLong(11), 1418630002); + target = rowChange.getColumnsToPut().get(1); + assertEquals(target.getName(), "Column0"); + assertEquals(target.getValue(), ColumnValue.fromLong(11)); + assertTrue(target.hasSetTimestamp()); + assertEquals(target.getTimestamp(), 1418630002); + + rowChange.addColumn(new Column("Column1", ColumnValue.fromLong(12))); + target = rowChange.getColumnsToPut().get(2); + assertEquals(target.getName(), "Column1"); + assertEquals(target.getValue(), ColumnValue.fromLong(12)); + assertTrue(!target.hasSetTimestamp()); + } + + @Test + public void testAddColumns() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + + RowPutChange rowChange = new RowPutChange("T", primaryKey); + + List columns = new ArrayList(); + for (int i = 0; i < 10; i++) { + if (i % 2 == 0) { + columns.add(new Column("Column" + i, ColumnValue.fromLong(i))); + } else { + columns.add(new Column("Column" + i, ColumnValue.fromLong(i), 1418630000 + i)); + } + } + rowChange.addColumns(columns); + + assertEquals(rowChange.getColumnsToPut().size(), 10); + for (int i = 0; i < 10; i++) { + assertEquals(rowChange.getColumnsToPut().get(i), columns.get(i)); + } + + for (int i = 0; i < 10; i++) { + String columnName = "Column" + i; + assertTrue(rowChange.has(columnName)); + assertTrue(!rowChange.has("Column_" + i)); + + if (i % 2 != 0) { + assertTrue(rowChange.has(columnName, 1418630000 + i)); + assertTrue(!rowChange.has(columnName, 1418630000 + i + 1)); + assertTrue(rowChange.has(columnName, 1418630000 + i, ColumnValue.fromLong(i))); + assertTrue(!rowChange.has(columnName, 1418630000 + i + 1, ColumnValue.fromLong(i))); + assertTrue(!rowChange.has(columnName, 1418630000 + i, ColumnValue.fromLong(i + 1))); + } else { + assertTrue(!rowChange.has(columnName, 1418630000 + i)); + assertTrue(rowChange.has(columnName, ColumnValue.fromLong(i))); + assertTrue(!rowChange.has(columnName, ColumnValue.fromLong(i + 1))); + } + + assertEquals(rowChange.getColumnsToPut(columnName).size(), 1); + assertEquals(rowChange.getColumnsToPut(columnName).get(0).getName(), columnName); + assertEquals(rowChange.getColumnsToPut(columnName).get(0).getValue(), ColumnValue.fromLong(i)); + + if (i % 2 == 0) { + assertTrue(!rowChange.getColumnsToPut(columnName).get(0).hasSetTimestamp()); + } else { + assertTrue(rowChange.getColumnsToPut(columnName).get(0).hasSetTimestamp()); + assertEquals(rowChange.getColumnsToPut(columnName).get(0).getTimestamp(), 1418630000 + i); + } + } + } + + @Test + public void testConstructorWithInvalidArguments() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowPutChange rowChange = new RowPutChange("T", primaryKey); + assertEquals(rowChange.getTableName(), "T"); + assertEquals(rowChange.getPrimaryKey(), primaryKey); + + try { + new RowPutChange("", primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowPutChange(null, primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowPutChange("T", null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowPutChange("T", PrimaryKeyBuilder.createPrimaryKeyBuilder().build()); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testCompareTo() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + PrimaryKey primaryKey2 = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowPutChange rowChange = new RowPutChange("T", primaryKey); + RowPutChange rowChange2 = new RowPutChange("T", primaryKey2); + + assertTrue(rowChange.compareTo(rowChange2) == 0); + } + + @Test + public void testGetDataSize() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(11)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abcde")) + .build(); + + RowPutChange rpc = new RowPutChange("TestTable", primaryKey); + rpc.addColumn("col0", ColumnValue.fromString("abcde")); + rpc.addColumn("col1", ColumnValue.fromString("abcde"), System.currentTimeMillis()); + rpc.addColumn(new Column("col2", ColumnValue.fromBinary(new byte[]{0x0, 0x1, 0x2}))); + rpc.addColumns(new Column[]{new Column("col3", ColumnValue.fromBoolean(false))}); + rpc.addColumns(Arrays.asList(new Column("col3", ColumnValue.fromLong(1)))); + + assertEquals(rpc.getDataSize(), 69); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestRowQueryCriteria.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowQueryCriteria.java new file mode 100644 index 0000000..7fcdb87 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowQueryCriteria.java @@ -0,0 +1,170 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; +import com.alicloud.openservices.tablestore.model.condition.SingleColumnValueCondition; +import com.alicloud.openservices.tablestore.model.filter.Filter; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestRowQueryCriteria { + @Test + public void testConstructor() { + RowQueryCriteria criteria = new RowQueryCriteria("T"); + assertEquals(criteria.getTableName(), "T"); + assertTrue(!criteria.hasSetTimeRange()); + assertTrue(!criteria.hasSetMaxVersions()); + assertTrue(criteria.getColumnsToGet().isEmpty()); + assertEquals(criteria.numColumnsToGet(), 0); + + try { + new RowQueryCriteria(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testGetSetMaxVersions() { + RowQueryCriteria criteria = new RowQueryCriteria("T"); + assertTrue(!criteria.hasSetMaxVersions()); + try { + criteria.getMaxVersions(); + fail(); + } catch (IllegalStateException e) { + + } + + try { + criteria.setMaxVersions(0); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + criteria.setMaxVersions(-1); + fail(); + } catch (IllegalArgumentException e) { + + } + + criteria.setMaxVersions(10); + assertEquals(criteria.getMaxVersions(), 10); + } + + @Test + public void testGetSetTimeRange() { + RowQueryCriteria criteria = new RowQueryCriteria("T"); + assertTrue(!criteria.hasSetTimeRange()); + try { + criteria.getTimeRange(); + fail(); + } catch (IllegalStateException e) { + + } + + try { + criteria.setTimeRange(null); + fail(); + } catch (IllegalArgumentException e) { + + } + try { + criteria.setTimestamp(-1); + fail(); + } catch (IllegalArgumentException e) { + + } + + TimeRange timeRange = new TimeRange(1418380771, 1418390771); + criteria.setTimeRange(timeRange); + assertEquals(criteria.getTimeRange(), timeRange); + + criteria.setTimestamp(1418380771); + assertEquals(criteria.getTimeRange(), new TimeRange(1418380771, 1418380772)); + } + + @Test + public void testGetSetFilter() { + RowQueryCriteria criteria = new RowQueryCriteria("T"); + assertTrue(!criteria.hasSetFilter()); + try { + criteria.getFilter(); + fail(); + } catch (IllegalStateException e) { + + } + + try { + criteria.setFilter(null); + fail(); + } catch (IllegalArgumentException e) { + + } + + SingleColumnValueFilter filter = new SingleColumnValueFilter("column_1", + SingleColumnValueFilter.CompareOperator.GREATER_THAN, ColumnValue.fromLong(10)); + criteria.setFilter(filter); + + assertTrue(criteria.getFilter() != null); + Filter tmp = criteria.getFilter(); + assertTrue(tmp instanceof SingleColumnValueFilter); + assertEquals(((SingleColumnValueFilter) tmp).getColumnValue(), ColumnValue.fromLong(10)); + assertEquals(((SingleColumnValueFilter)tmp).getColumnName(), "column_1"); + assertEquals(((SingleColumnValueFilter)tmp).getOperator(), SingleColumnValueFilter.CompareOperator.GREATER_THAN); + } + + @Test + public void testGetSetColumnsToGet() { + RowQueryCriteria criteria = new RowQueryCriteria("T"); + + assertTrue(criteria.getColumnsToGet().isEmpty()); + assertEquals(criteria.numColumnsToGet(), 0); + + criteria.addColumnsToGet("Column1"); + assertEquals(criteria.numColumnsToGet(), 1); + assertTrue(criteria.getColumnsToGet().contains("Column1")); + + String[] columns = new String[4]; + columns[0] = "Column2"; + columns[1] = "Column3"; + columns[2] = "Column4"; + columns[3] = "Column3"; // duplicate column + criteria.addColumnsToGet(columns); + assertEquals(criteria.numColumnsToGet(), 4); + assertTrue(criteria.getColumnsToGet().contains("Column1")); + assertTrue(criteria.getColumnsToGet().contains("Column2")); + assertTrue(criteria.getColumnsToGet().contains("Column3")); + assertTrue(criteria.getColumnsToGet().contains("Column4")); + + criteria.addColumnsToGet("Column2"); // duplicate column + criteria.addColumnsToGet("Column3"); // duplicate column + assertEquals(criteria.numColumnsToGet(), 4); + assertTrue(criteria.getColumnsToGet().contains("Column1")); + assertTrue(criteria.getColumnsToGet().contains("Column2")); + assertTrue(criteria.getColumnsToGet().contains("Column3")); + assertTrue(criteria.getColumnsToGet().contains("Column4")); + + List columnsToAdd = new ArrayList(); + columnsToAdd.add("Column5"); + columnsToAdd.add("Column6"); + columnsToAdd.add("Column6"); // duplicate column + columnsToAdd.add("Column7"); + criteria.addColumnsToGet(columnsToAdd); + assertEquals(criteria.numColumnsToGet(), 7); + assertTrue(criteria.getColumnsToGet().contains("Column1")); + assertTrue(criteria.getColumnsToGet().contains("Column2")); + assertTrue(criteria.getColumnsToGet().contains("Column3")); + assertTrue(criteria.getColumnsToGet().contains("Column4")); + assertTrue(criteria.getColumnsToGet().contains("Column5")); + assertTrue(criteria.getColumnsToGet().contains("Column6")); + assertTrue(criteria.getColumnsToGet().contains("Column7")); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestRowUpdateChange.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowUpdateChange.java new file mode 100644 index 0000000..bd0d7a8 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestRowUpdateChange.java @@ -0,0 +1,145 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.*; + +public class TestRowUpdateChange { + + @Test + public void testConstructor() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowUpdateChange rowChange = new RowUpdateChange("T", primaryKey); + + assertEquals(rowChange.getTableName(), "T"); + assertEquals(rowChange.getPrimaryKey(), primaryKey); + assertTrue(rowChange.getColumnsToUpdate().isEmpty()); + } + + @Test + public void testOperations() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowUpdateChange rowChange = new RowUpdateChange("T", primaryKey); + + Column column1 = new Column("Column0", ColumnValue.fromLong(1912), 1418647314); + rowChange.put(column1); + assertEquals(rowChange.getColumnsToUpdate().size(), 1); + assertEquals(rowChange.getColumnsToUpdate().get(0).getSecond(), RowUpdateChange.Type.PUT); + assertEquals(rowChange.getColumnsToUpdate().get(0).getFirst(), column1); + + rowChange.put("Column1", ColumnValue.fromString("Column Value")); + assertEquals(rowChange.getColumnsToUpdate().size(), 2); + assertEquals(rowChange.getColumnsToUpdate().get(1).getSecond(), RowUpdateChange.Type.PUT); + assertEquals(rowChange.getColumnsToUpdate().get(1).getFirst(), new Column("Column1", ColumnValue.fromString("Column Value"))); + + rowChange.put("Column2", ColumnValue.fromString("Column Value"), 1418647315); + assertEquals(rowChange.getColumnsToUpdate().size(), 3); + assertEquals(rowChange.getColumnsToUpdate().get(2).getSecond(), RowUpdateChange.Type.PUT); + assertEquals(rowChange.getColumnsToUpdate().get(2).getFirst(), new Column("Column2", ColumnValue.fromString("Column Value"), 1418647315)); + + rowChange.deleteColumn("Column1", 1418647312); + assertEquals(rowChange.getColumnsToUpdate().size(), 4); + assertEquals(rowChange.getColumnsToUpdate().get(3).getSecond(), RowUpdateChange.Type.DELETE); + assertEquals(rowChange.getColumnsToUpdate().get(3).getFirst().getName(), "Column1"); + assertEquals(rowChange.getColumnsToUpdate().get(3).getFirst().getTimestamp(), 1418647312); + + rowChange.deleteColumns("Column2"); + assertEquals(rowChange.getColumnsToUpdate().size(), 5); + assertEquals(rowChange.getColumnsToUpdate().get(4).getSecond(), RowUpdateChange.Type.DELETE_ALL); + assertEquals(rowChange.getColumnsToUpdate().get(4).getFirst().getName(), "Column2"); + } + + @Test + public void testPutList() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowUpdateChange rowChange = new RowUpdateChange("T", primaryKey); + + List columns = new ArrayList(); + for (int i = 0; i < 1000; i++) { + if (i % 2 == 0) { + columns.add(new Column("Column" + i, ColumnValue.fromLong(i))); + } else { + columns.add(new Column("Column" + i, ColumnValue.fromLong(i), 1418647300 + i)); + } + } + + rowChange.put(columns); + + assertEquals(rowChange.getColumnsToUpdate().size(), columns.size()); + for (int i = 0; i < columns.size(); i++) { + assertEquals(rowChange.getColumnsToUpdate().get(i).getSecond(), RowUpdateChange.Type.PUT); + assertEquals(rowChange.getColumnsToUpdate().get(i).getFirst(), columns.get(i)); + } + } + + @Test + public void testConstructorWithInvalidArguments() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowUpdateChange rowChange = new RowUpdateChange("T", primaryKey); + assertEquals(rowChange.getTableName(), "T"); + assertEquals(rowChange.getPrimaryKey(), primaryKey); + + try { + new RowUpdateChange("", primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowUpdateChange(null, primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowUpdateChange("T", null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new RowUpdateChange("T", PrimaryKeyBuilder.createPrimaryKeyBuilder().build()); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testCompareTo() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + PrimaryKey primaryKey2 = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + RowUpdateChange rowChange = new RowUpdateChange("T", primaryKey); + RowUpdateChange rowChange2 = new RowUpdateChange("T", primaryKey2); + + assertTrue(rowChange.compareTo(rowChange2) == 0); + } + + @Test + public void testGetDataSize() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(8)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("abcde")) + .build(); + + RowUpdateChange ruc = new RowUpdateChange("TestTable", primaryKey); + ruc.deleteColumns("col0"); + ruc.deleteColumn("col1", System.currentTimeMillis()); + ruc.put("col2", ColumnValue.fromString("abcde")); + ruc.put("col3", ColumnValue.fromString("abcde"), System.currentTimeMillis()); + + assertEquals(ruc.getDataSize(), 61); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestSingleRowQueryCriteria.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestSingleRowQueryCriteria.java new file mode 100644 index 0000000..2a5ea44 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestSingleRowQueryCriteria.java @@ -0,0 +1,55 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestSingleRowQueryCriteria { + + @Test + public void testConstructor() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria("T", primaryKey); + + assertEquals(criteria.getTableName(), "T"); + assertEquals(criteria.getPrimaryKey(), primaryKey); + + assertTrue(criteria.compareTo(criteria) == 0); + } + + @Test + public void testInvalidArguments() { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(1912)).build(); + try { + new SingleRowQueryCriteria("", primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new SingleRowQueryCriteria(null, primaryKey); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new SingleRowQueryCriteria("T", null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new SingleRowQueryCriteria("T", PrimaryKeyBuilder.createPrimaryKeyBuilder().build()); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestSplit.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestSplit.java new file mode 100644 index 0000000..0a2c400 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestSplit.java @@ -0,0 +1,64 @@ +package com.alicloud.openservices.tablestore.model; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class TestSplit { + + private int maxNumberPrimaryKeyColumnEachRow = 4; + + @Test + public void testConstructor() { + Split s = new Split(); + assertEquals(s.getLocation(), null); + assertEquals(s.getLowerBound(), null); + assertEquals(s.getUpperBound(), null); + + String lowerKeyNamePrefix = "lowerKeyNamePrefix"; + String upperKeyNamePrefix = "upperKeyNamePrefix"; + String lowerKeyValuePrefix = "lowerKeyValuePrefix"; + String upperKeyValuePrefix = "upperKeyValuePrefix"; + List lpkcl = new ArrayList(); + List upkcl = new ArrayList(); + for ( int i = 0; i < maxNumberPrimaryKeyColumnEachRow; ++i ) { + lpkcl.add(new PrimaryKeyColumn(lowerKeyNamePrefix + i, PrimaryKeyValue.fromString(lowerKeyValuePrefix + i))); + upkcl.add(new PrimaryKeyColumn(upperKeyNamePrefix + i, PrimaryKeyValue.fromString(upperKeyValuePrefix + i))); + } + PrimaryKey lpk = new PrimaryKey(lpkcl); + PrimaryKey upk = new PrimaryKey(upkcl); + String loc = "location"; + s = new Split(loc, lpk, upk); + assertTrue(s.getLocation().equals(loc)); + assertTrue(s.getLowerBound().equals(lpk)); + assertTrue(s.getUpperBound().equals(upk)); + } + + @Test + public void testSetterAndGetter() { + String lowerKeyNamePrefix = "lowerKeyNamePrefix"; + String upperKeyNamePrefix = "upperKeyNamePrefix"; + String lowerKeyValuePrefix = "lowerKeyValuePrefix"; + String upperKeyValuePrefix = "upperKeyValuePrefix"; + List lpkcl = new ArrayList(); + List upkcl = new ArrayList(); + for ( int i = 0; i < maxNumberPrimaryKeyColumnEachRow; ++i ) { + lpkcl.add(new PrimaryKeyColumn(lowerKeyNamePrefix + i, PrimaryKeyValue.fromString(lowerKeyValuePrefix + i))); + upkcl.add(new PrimaryKeyColumn(upperKeyNamePrefix + i, PrimaryKeyValue.fromString(upperKeyValuePrefix + i))); + } + PrimaryKey lpk = new PrimaryKey(lpkcl); + PrimaryKey upk = new PrimaryKey(upkcl); + String loc = "location"; + Split s = new Split(); + s.setLocation(loc); + s.setLowerBound(lpk); + s.setUpperBound(upk); + assertTrue(s.getLocation().equals(loc)); + assertTrue(s.getLowerBound().equals(lpk)); + assertTrue(s.getUpperBound().equals(upk)); + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestTableMeta.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestTableMeta.java new file mode 100644 index 0000000..c42d40d --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestTableMeta.java @@ -0,0 +1,372 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestTableMeta { + + @Test + public void testOperations() { + TableMeta tableMeta = new TableMeta("T"); + assertEquals(tableMeta.getTableName(), "T"); + assertTrue(tableMeta.getPrimaryKeyList().isEmpty()); + assertTrue(tableMeta.getPrimaryKeyMap().isEmpty()); + + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("PK1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("PK2", PrimaryKeyType.BINARY); + + assertEquals(tableMeta.getPrimaryKeyList().size(), 3); + assertEquals(tableMeta.getPrimaryKeyList().get(0), new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER)); + assertEquals(tableMeta.getPrimaryKeyList().get(1), new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + assertEquals(tableMeta.getPrimaryKeyList().get(2), new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY)); + + assertEquals(tableMeta.getPrimaryKeyMap().size(), 3); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK0"), PrimaryKeyType.INTEGER); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK1"), PrimaryKeyType.STRING); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK2"), PrimaryKeyType.BINARY); + } + + @Test + public void testAddPKs_WithArray() { + TableMeta tableMeta = new TableMeta("T"); + PrimaryKeySchema[] pks = new PrimaryKeySchema[3]; + pks[0] = new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER); + pks[1] = new PrimaryKeySchema("PK1", PrimaryKeyType.STRING); + pks[2] = new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY); + + tableMeta.addPrimaryKeyColumns(pks); + assertEquals(tableMeta.getPrimaryKeyList().size(), 3); + assertEquals(tableMeta.getPrimaryKeyList().get(0), new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER)); + assertEquals(tableMeta.getPrimaryKeyList().get(1), new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + assertEquals(tableMeta.getPrimaryKeyList().get(2), new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY)); + + assertEquals(tableMeta.getPrimaryKeyMap().size(), 3); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK0"), PrimaryKeyType.INTEGER); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK1"), PrimaryKeyType.STRING); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK2"), PrimaryKeyType.BINARY); + } + + @Test + public void testAddPKs_WithList() { + TableMeta tableMeta = new TableMeta("T"); + PrimaryKeySchema[] pks = new PrimaryKeySchema[3]; + pks[0] = new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER); + pks[1] = new PrimaryKeySchema("PK1", PrimaryKeyType.STRING); + pks[2] = new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY); + + tableMeta.addPrimaryKeyColumns(Arrays.asList(pks)); + assertEquals(tableMeta.getPrimaryKeyList().size(), 3); + assertEquals(tableMeta.getPrimaryKeyList().get(0), new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER)); + assertEquals(tableMeta.getPrimaryKeyList().get(1), new PrimaryKeySchema("PK1", PrimaryKeyType.STRING)); + assertEquals(tableMeta.getPrimaryKeyList().get(2), new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY)); + + assertEquals(tableMeta.getPrimaryKeyMap().size(), 3); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK0"), PrimaryKeyType.INTEGER); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK1"), PrimaryKeyType.STRING); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK2"), PrimaryKeyType.BINARY); + } + + @Test + public void testPkAutoIncrement() { + { + TableMeta tableMeta = new TableMeta("T"); + PrimaryKeySchema[] pks = new PrimaryKeySchema[3]; + pks[0] = new PrimaryKeySchema("PK0", PrimaryKeyType.STRING); + pks[1] = new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + pks[2] = new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY); + + tableMeta.addPrimaryKeyColumns(Arrays.asList(pks)); + assertEquals(tableMeta.getPrimaryKeyList().size(), 3); + assertEquals(tableMeta.getPrimaryKeyList().get(0), new PrimaryKeySchema("PK0", PrimaryKeyType.STRING)); + assertEquals(tableMeta.getPrimaryKeyList().get(1), new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(tableMeta.getPrimaryKeyList().get(2), new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY)); + + assertEquals(tableMeta.getPrimaryKeyMap().size(), 3); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK0"), PrimaryKeyType.STRING); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK1"), PrimaryKeyType.INTEGER); + assertEquals(tableMeta.getPrimaryKeyMap().get("PK2"), PrimaryKeyType.BINARY); + } + + { + TableMeta tableMeta = new TableMeta("T"); + + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("PK1", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + + assertEquals(tableMeta.getPrimaryKeyList().size(), 2); + assertEquals(tableMeta.getPrimaryKeyList().get(0), new PrimaryKeySchema("PK0", PrimaryKeyType.STRING)); + assertEquals(tableMeta.getPrimaryKeyList().get(1), new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + } + + { + TableMeta tableMeta = new TableMeta("T"); + + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.STRING); + tableMeta.addAutoIncrementPrimaryKeyColumn("PK1"); + + assertEquals(tableMeta.getPrimaryKeyList().size(), 2); + assertEquals(tableMeta.getPrimaryKeyList().get(0), new PrimaryKeySchema("PK0", PrimaryKeyType.STRING)); + assertEquals(tableMeta.getPrimaryKeyList().get(1), new PrimaryKeySchema("PK1", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + } + } + + @Test + public void testJsonizer() { + TableMeta tableMeta = new TableMeta("T"); + + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.STRING); + tableMeta.addAutoIncrementPrimaryKeyColumn("PK1"); + + String json = tableMeta.jsonize(); + assertEquals("{\n" + + " \"TableName\": \"T\",\n" + + " \"PrimaryKey\": [\n" + + " {\"Name\": \"PK0\", \"Type\": \"STRING\"},\n" + + " {\"Name\": \"PK1\", \"Type\": \"INTEGER\", \"Option\":\"AUTO_INCREMENT\"}],\n \"DefinedColumn\": [\n" + + " ]}", json); + } + + @Test + public void testInvalidArguments() { + try { + new TableMeta(""); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new TableMeta(null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + TableMeta tableMeta = new TableMeta("T"); + tableMeta.setTableName(null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + TableMeta tableMeta = new TableMeta("T"); + tableMeta.setTableName(""); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + TableMeta tableMeta = new TableMeta("T"); + PrimaryKeySchema[] pks = new PrimaryKeySchema[3]; + pks[0] = new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + pks[1] = new PrimaryKeySchema("PK1", PrimaryKeyType.STRING); + pks[2] = new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY); + + tableMeta.addPrimaryKeyColumns(Arrays.asList(pks)); + } catch (IllegalArgumentException e) { + + } + + try { + TableMeta tableMeta = new TableMeta("T"); + PrimaryKeySchema[] pks = new PrimaryKeySchema[3]; + pks[0] = new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER); + pks[1] = new PrimaryKeySchema("PK1", PrimaryKeyType.STRING, PrimaryKeyOption.AUTO_INCREMENT); + pks[2] = new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY); + + tableMeta.addPrimaryKeyColumns(Arrays.asList(pks)); + } catch (IllegalArgumentException e) { + + } + + try { + TableMeta tableMeta = new TableMeta("T"); + PrimaryKeySchema[] pks = new PrimaryKeySchema[3]; + pks[0] = new PrimaryKeySchema("PK0", PrimaryKeyType.INTEGER); + pks[1] = new PrimaryKeySchema("PK1", PrimaryKeyType.STRING); + pks[2] = new PrimaryKeySchema("PK2", PrimaryKeyType.BINARY, PrimaryKeyOption.AUTO_INCREMENT); + + tableMeta.addPrimaryKeyColumns(Arrays.asList(pks)); + } catch (IllegalArgumentException e) { + + } + + try { + TableMeta tableMeta = new TableMeta("T"); + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.STRING, PrimaryKeyOption.AUTO_INCREMENT); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + TableMeta tableMeta = new TableMeta("T"); + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.BINARY, PrimaryKeyOption.AUTO_INCREMENT); + fail(); + } catch (IllegalArgumentException e) { + + } + } + + @Test + public void testGetPrimaryKeyMap() { + TableMeta tableMeta = new TableMeta("TestTable"); + tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.INTEGER); + + Map primaryKeyTypeMap = tableMeta.getPrimaryKeyMap(); + Map primaryKeySchemaMap = tableMeta.getPrimaryKeySchemaMap(); + + assertEquals(primaryKeySchemaMap.size(), 2); + assertEquals(primaryKeyTypeMap.size(), 2); + + assertEquals(primaryKeySchemaMap.get("pk0"), new PrimaryKeySchema("pk0", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk1"), new PrimaryKeySchema("pk1", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeyTypeMap.get("pk0"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk1"), PrimaryKeyType.INTEGER); + + { + tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT); + primaryKeyTypeMap = tableMeta.getPrimaryKeyMap(); + primaryKeySchemaMap = tableMeta.getPrimaryKeySchemaMap(); + + assertEquals(primaryKeySchemaMap.size(), 3); + assertEquals(primaryKeyTypeMap.size(), 3); + + assertEquals(primaryKeySchemaMap.get("pk0"), new PrimaryKeySchema("pk0", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk1"), new PrimaryKeySchema("pk1", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk2"), new PrimaryKeySchema("pk2", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + + assertEquals(primaryKeyTypeMap.get("pk0"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk1"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk2"), PrimaryKeyType.INTEGER); + } + + { + tableMeta.addAutoIncrementPrimaryKeyColumn("pk3"); + primaryKeyTypeMap = tableMeta.getPrimaryKeyMap(); + primaryKeySchemaMap = tableMeta.getPrimaryKeySchemaMap(); + + assertEquals(primaryKeySchemaMap.size(), 4); + assertEquals(primaryKeyTypeMap.size(), 4); + + assertEquals(primaryKeySchemaMap.get("pk0"), new PrimaryKeySchema("pk0", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk1"), new PrimaryKeySchema("pk1", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk2"), new PrimaryKeySchema("pk2", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk3"), new PrimaryKeySchema("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + + assertEquals(primaryKeyTypeMap.get("pk0"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk1"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk2"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk3"), PrimaryKeyType.INTEGER); + } + + { + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema("pk4", PrimaryKeyType.BINARY)); + primaryKeyTypeMap = tableMeta.getPrimaryKeyMap(); + primaryKeySchemaMap = tableMeta.getPrimaryKeySchemaMap(); + + assertEquals(primaryKeySchemaMap.size(), 5); + assertEquals(primaryKeyTypeMap.size(), 5); + + assertEquals(primaryKeySchemaMap.get("pk0"), new PrimaryKeySchema("pk0", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk1"), new PrimaryKeySchema("pk1", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk2"), new PrimaryKeySchema("pk2", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk3"), new PrimaryKeySchema("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk4"), new PrimaryKeySchema("pk4", PrimaryKeyType.BINARY)); + + assertEquals(primaryKeyTypeMap.get("pk0"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk1"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk2"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk3"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk4"), PrimaryKeyType.BINARY); + } + + { + tableMeta.addPrimaryKeyColumn("pk5", PrimaryKeyType.INTEGER); + primaryKeyTypeMap = tableMeta.getPrimaryKeyMap(); + primaryKeySchemaMap = tableMeta.getPrimaryKeySchemaMap(); + + assertEquals(primaryKeySchemaMap.size(), 6); + assertEquals(primaryKeyTypeMap.size(), 6); + + assertEquals(primaryKeySchemaMap.get("pk0"), new PrimaryKeySchema("pk0", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk1"), new PrimaryKeySchema("pk1", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk2"), new PrimaryKeySchema("pk2", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk3"), new PrimaryKeySchema("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk4"), new PrimaryKeySchema("pk4", PrimaryKeyType.BINARY)); + assertEquals(primaryKeySchemaMap.get("pk5"), new PrimaryKeySchema("pk5", PrimaryKeyType.INTEGER)); + + assertEquals(primaryKeyTypeMap.get("pk0"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk1"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk2"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk3"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk4"), PrimaryKeyType.BINARY); + assertEquals(primaryKeyTypeMap.get("pk5"), PrimaryKeyType.INTEGER); + } + + { + tableMeta.addPrimaryKeyColumns(Arrays.asList(new PrimaryKeySchema("pk6", PrimaryKeyType.STRING))); + primaryKeyTypeMap = tableMeta.getPrimaryKeyMap(); + primaryKeySchemaMap = tableMeta.getPrimaryKeySchemaMap(); + + assertEquals(primaryKeySchemaMap.size(), 7); + assertEquals(primaryKeyTypeMap.size(), 7); + + assertEquals(primaryKeySchemaMap.get("pk0"), new PrimaryKeySchema("pk0", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk1"), new PrimaryKeySchema("pk1", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk2"), new PrimaryKeySchema("pk2", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk3"), new PrimaryKeySchema("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk4"), new PrimaryKeySchema("pk4", PrimaryKeyType.BINARY)); + assertEquals(primaryKeySchemaMap.get("pk5"), new PrimaryKeySchema("pk5", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk6"), new PrimaryKeySchema("pk6", PrimaryKeyType.STRING)); + + assertEquals(primaryKeyTypeMap.get("pk0"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk1"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk2"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk3"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk4"), PrimaryKeyType.BINARY); + assertEquals(primaryKeyTypeMap.get("pk5"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk6"), PrimaryKeyType.STRING); + } + + { + tableMeta.addPrimaryKeyColumns(new PrimaryKeySchema[]{new PrimaryKeySchema("pk7", PrimaryKeyType.STRING)}); + primaryKeyTypeMap = tableMeta.getPrimaryKeyMap(); + primaryKeySchemaMap = tableMeta.getPrimaryKeySchemaMap(); + + assertEquals(primaryKeySchemaMap.size(), 8); + assertEquals(primaryKeyTypeMap.size(), 8); + + assertEquals(primaryKeySchemaMap.get("pk0"), new PrimaryKeySchema("pk0", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk1"), new PrimaryKeySchema("pk1", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk2"), new PrimaryKeySchema("pk2", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk3"), new PrimaryKeySchema("pk3", PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + assertEquals(primaryKeySchemaMap.get("pk4"), new PrimaryKeySchema("pk4", PrimaryKeyType.BINARY)); + assertEquals(primaryKeySchemaMap.get("pk5"), new PrimaryKeySchema("pk5", PrimaryKeyType.INTEGER)); + assertEquals(primaryKeySchemaMap.get("pk6"), new PrimaryKeySchema("pk6", PrimaryKeyType.STRING)); + assertEquals(primaryKeySchemaMap.get("pk7"), new PrimaryKeySchema("pk7", PrimaryKeyType.STRING)); + + assertEquals(primaryKeyTypeMap.get("pk0"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk1"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk2"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk3"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk4"), PrimaryKeyType.BINARY); + assertEquals(primaryKeyTypeMap.get("pk5"), PrimaryKeyType.INTEGER); + assertEquals(primaryKeyTypeMap.get("pk6"), PrimaryKeyType.STRING); + assertEquals(primaryKeyTypeMap.get("pk7"), PrimaryKeyType.STRING); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/TestTimeRange.java b/src/test/java/com/alicloud/openservices/tablestore/model/TestTimeRange.java new file mode 100644 index 0000000..167cabb --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/TestTimeRange.java @@ -0,0 +1,77 @@ +package com.alicloud.openservices.tablestore.model; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class TestTimeRange { + + @Test + public void testConstructor() { + TimeRange tr = new TimeRange(); + assertEquals(tr.getStart(), 0); + assertEquals(tr.getEnd(), Long.MAX_VALUE); + + tr = new TimeRange(1912); + assertEquals(tr.getStart(), 1912); + assertEquals(tr.getEnd(), Long.MAX_VALUE); + + tr = new TimeRange(1912, 1999); + assertEquals(tr.getStart(), 1912); + assertEquals(tr.getEnd(), 1999); + } + + @Test + public void testWithIn() { + TimeRange tr = new TimeRange(1912, 1999); + assertTrue(tr.withinTimeRange(1912)); + assertTrue(tr.withinTimeRange(1916)); + assertTrue(!tr.withinTimeRange(1999)); + assertTrue(!tr.withinTimeRange(2000)); + } + + @Test + public void testCompare() { + TimeRange tr = new TimeRange(1912, 1999); + assertEquals(tr.compare(1912), 0); + assertEquals(tr.compare(1913), 0); + assertEquals(tr.compare(1911), -1); + assertEquals(tr.compare(1999), 1); + assertEquals(tr.compare(2000), 1); + } + + @Test + public void testEquals() { + TimeRange tr1 = new TimeRange(1912, 1999); + TimeRange tr2 = new TimeRange(1912, 1999); + assertEquals(tr1, tr2); + TimeRange tr3 = new TimeRange(1912, 2000); + assertTrue(!tr1.equals(tr3)); + } + + @Test + public void testInvalidArguments() { + try { + new TimeRange(-1); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new TimeRange(0, 0); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new TimeRange(1, 0); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedConditionalUpdateTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedConditionalUpdateTest.java new file mode 100644 index 0000000..db2e834 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedConditionalUpdateTest.java @@ -0,0 +1,552 @@ +/** + * Copyright (C) Alibaba Cloud Computing + * All rights reserved. + * + * 版权所有 (C)阿里云计算有限公司 + */ + +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; +import com.alicloud.openservices.tablestore.model.condition.CompositeColumnValueCondition; +import com.alicloud.openservices.tablestore.model.condition.SingleColumnValueCondition; +import com.google.gson.JsonSyntaxException; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; + +import static org.junit.Assert.*; + + +public class UnifiedConditionalUpdateTest { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static String tableName = "conditional_update_test_table"; + + private static SyncClientInterface ots; + private static Logger LOG = Logger.getLogger(UnifiedConditionalUpdateTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = ots.listTable(); + + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + ots.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + @Test + public void testSingleFilter() throws Exception { + CreateTable(); + + // put a row first + boolean success = putRow(19, "Col1", ColumnValue.fromString("Value1"), null); + assertTrue(success); + + // put row with condition: col1 != value1 + success = putRow(19, "Col2", ColumnValue.fromString("Value2"), + new SingleColumnValueCondition("Col1", + SingleColumnValueCondition.CompareOperator.NOT_EQUAL, + ColumnValue.fromString("Value1"))); + assertTrue(!success); + + // put row with condition: col1 == value1 + success = putRow(19, "Col2", ColumnValue.fromString("Value2"), + new SingleColumnValueCondition("Col1", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("Value1"))); + assertTrue(success); + + // update row with condition: col2 < value1 + success = putRow(19, "Col3", ColumnValue.fromString("Value3"), + new SingleColumnValueCondition("Col2", + SingleColumnValueCondition.CompareOperator.LESS_THAN, + ColumnValue.fromString("Value1"))); + assertTrue(!success); + + // update row with condition: col2 >= value2 + success = putRow(19, "Col3", ColumnValue.fromString("Value3"), + new SingleColumnValueCondition("Col2", + SingleColumnValueCondition.CompareOperator.GREATER_EQUAL, + ColumnValue.fromString("Value2"))); + assertTrue(success); + + // delete row with condition: col3 <= value2 + success = deleteRow(19, "Col3", ColumnValue.fromString("Value3"), + new SingleColumnValueCondition("Col3", + SingleColumnValueCondition.CompareOperator.LESS_EQUAL, + ColumnValue.fromString("Value2"))); + assertTrue(!success); + + // delete row with condition: col3 > value2 + success = deleteRow(19, "Col3", ColumnValue.fromString("Value3"), + new SingleColumnValueCondition("Col3", + SingleColumnValueCondition.CompareOperator.GREATER_THAN, + ColumnValue.fromString("Value2"))); + assertTrue(success); + } + + @Test + public void testColumnMissing() throws Exception { + CreateTable(); + + // put a row first + boolean success = putRow(19, "Col1", ColumnValue.fromString("Value1"), null); + assertTrue(success); + + // put row with condition: colX != valueY + // with passIfMissing == true, this should succeed + success = putRow(19, "Col2", ColumnValue.fromString("Value2"), + new SingleColumnValueCondition("ColX", + SingleColumnValueCondition.CompareOperator.NOT_EQUAL, + ColumnValue.fromString("ValueY"))); + assertTrue(success); + + // put row with condition: colX != valueY + // with passIfMissing == false, this should fail + SingleColumnValueCondition cond = new SingleColumnValueCondition("ColX", + SingleColumnValueCondition.CompareOperator.NOT_EQUAL, + ColumnValue.fromString("ValueY")); + cond.setPassIfMissing(false); + success = putRow(19, "Col2", ColumnValue.fromString("Value2"), cond); + assertTrue(!success); + } + + @Test + public void testCompositeFilter() throws Exception { + CreateTable(); + + // put a row first + boolean success = putRow(19, "Col1", ColumnValue.fromString("Value1"), null); + assertTrue(success); + success = updateRow(19, "Col2", ColumnValue.fromString("Value2"), null); + assertTrue(success); + + // update with condition: + // col1 == value2 OR col2 == value1 + CompositeColumnValueCondition cond = new CompositeColumnValueCondition(CompositeColumnValueCondition.LogicOperator.OR); + cond.addCondition(new SingleColumnValueCondition( + "Col1", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("Value2"))) + .addCondition(new SingleColumnValueCondition( + "Col2", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("Value1"))); + success = updateRow(19, "Col3", ColumnValue.fromString("Value3"), cond); + assertTrue(!success); + + // update with condition: + // Not col1 == value2 + cond = new CompositeColumnValueCondition(CompositeColumnValueCondition.LogicOperator.NOT); + cond.addCondition(new SingleColumnValueCondition( + "Col1", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("Value2"))); + success = updateRow(19, "Col3", ColumnValue.fromString("Value3"), cond); + assertTrue(success); + + // delete with condition: + // col1 == valueX OR (col2 == value2 AND col3 == value3) + cond = new CompositeColumnValueCondition(CompositeColumnValueCondition.LogicOperator.OR); + cond.addCondition(new SingleColumnValueCondition( + "Col1", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))); + CompositeColumnValueCondition cond2 = new CompositeColumnValueCondition(CompositeColumnValueCondition.LogicOperator.AND); + cond2.addCondition(new SingleColumnValueCondition( + "Col2", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("Value2"))) + .addCondition(new SingleColumnValueCondition( + "Col3", + SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("Value3"))); + cond.addCondition(cond2); + + success = deleteRow(19, "Col3", ColumnValue.fromString("Value3"), cond); + assertTrue(success); + } + + // Txn: + // oldV = read + // newV = oldV + 1 + // update v = newV if v == oldV + public class DoTxn implements Runnable { + private volatile int count = 0; + private int round = 100; + + @Override + public void run() { + for (int i = 0; i < round; ++i) { + Row r = readRow(tableName, 23); + ColumnValue oldValue = r.getColumn("Col1").get(0).getValue(); + + ColumnValue newValue = ColumnValue.fromLong(oldValue.asLong() + 1); + SingleColumnValueCondition cond = new SingleColumnValueCondition( + "Col1", SingleColumnValueCondition.CompareOperator.EQUAL, oldValue); + boolean success = updateRow(23, "Col1", newValue, cond); + if (success) { + ++count; + } + } + } + + public int getValue() { + return count; + } + } + + @Test + public void testTransactionalUpdate() throws Exception { + CreateTable(); + + boolean success = putRow(23, "Col1", ColumnValue.fromLong(0), null); + assertTrue(success); + + int threadNum = 100; + List runnables = new ArrayList(); + List threads = new ArrayList(); + + for (int i = 0; i < threadNum; ++i) { + runnables.add(new DoTxn()); + threads.add(new Thread(runnables.get(i))); + threads.get(i).start(); + } + + for (Thread t: threads) { + t.join(); + } + + int total = 0; + for (DoTxn t: runnables) { + total += t.getValue(); + } + + ColumnValue v = readRow(tableName, 23).getColumn("Col1").get(0).getValue(); + assertTrue(total > 0); + assertEquals(total, v.asLong()); + } + + @Test + public void testLimits() throws Exception { + CreateTable(); + + // column condition count <= 10 + CompositeColumnValueCondition cond = new CompositeColumnValueCondition(CompositeColumnValueCondition.LogicOperator.OR); + cond.addCondition(new SingleColumnValueCondition( + "ColX1", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX2", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX3", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX4", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX5", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX6", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX7", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX8", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX9", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))); + + boolean success = putRow(23, "Col1", ColumnValue.fromString("Value1"), cond); + assertTrue(success); + + cond.addCondition(new SingleColumnValueCondition( + "ColX10", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))); + success = putRow(23, "Col1", ColumnValue.fromString("Value1"), cond); + assertTrue(!success); + + // invalid column value in column condition + String invalidValue = ""; + for (int i = 0; i < 64 * 1024 + 1; ++i) { + invalidValue += "x"; + } + cond = new CompositeColumnValueCondition(CompositeColumnValueCondition.LogicOperator.AND); + cond.addCondition(new SingleColumnValueCondition( + "ColX9", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))) + .addCondition(new SingleColumnValueCondition( + "ColX9", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("ValueX"))); + assertTrue(!success); + } + + /** + * 写入1行,包含1列,并且有10个cell,值分别为0, 1, 2 ... 9。测试LatestVersionOnly为默认值, + * 或者为True,False的情况,分别测试condition条件为 <=1, >=3更新并校验。 + * @throws Exception + */ + @Test + public void testLatestVersionOnly() throws Exception { + CreateTable(100); + + int row = 1; + String colName = "col"; + { + // 准备数据 + RowUpdateChange change = new RowUpdateChange(tableName); + change.setPrimaryKey(getPrimaryKeys(row)); + for (int i = 0; i < 10; ++i) { + ColumnValue colValue = ColumnValue.fromLong(i); + change.put(colName, colValue, i); + } + UpdateRowRequest request = new UpdateRowRequest(); + request.setRowChange(change); + ots.updateRow(request); + } + + { + // LatestVersionOnly:true, <=1, 更新失败 + SingleColumnValueCondition columnCondition = new SingleColumnValueCondition( + colName, SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromLong(1)); + columnCondition.setLatestVersionsOnly(true); + assertTrue(!updateRow(row, colName, ColumnValue.fromLong(9), columnCondition)); + } + { + // LatestVersionOnly:true, >=3, 更新成功 + SingleColumnValueCondition columnCondition = new SingleColumnValueCondition( + colName, SingleColumnValueCondition.CompareOperator.GREATER_THAN, + ColumnValue.fromLong(3)); + columnCondition.setLatestVersionsOnly(true); + assertTrue(updateRow(row, colName, ColumnValue.fromLong(9), columnCondition)); + } + { + // LatestVersionOnly:false, <=1, 更新成功 + SingleColumnValueCondition columnCondition = new SingleColumnValueCondition( + colName, SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromLong(1)); + columnCondition.setLatestVersionsOnly(false); + assertTrue(updateRow(row, colName, ColumnValue.fromLong(9), columnCondition)); + } + { + // LatestVersionOnly:false, >=3, 更新成功 + SingleColumnValueCondition columnCondition = new SingleColumnValueCondition( + colName, SingleColumnValueCondition.CompareOperator.GREATER_THAN, + ColumnValue.fromLong(3)); + columnCondition.setLatestVersionsOnly(false); + assertTrue(updateRow(row, colName, ColumnValue.fromLong(9), columnCondition)); + } + } + + @Test + public void testBatchWriteRow() throws Exception { + CreateTable(); + + boolean success = putRow(20, "Col1", ColumnValue.fromString("Value20"), null); + assertTrue(success); + + success = putRow(21, "Col1", ColumnValue.fromString("Value21"), null); + assertTrue(success); + + success = putRow(22, "Col1", ColumnValue.fromString("Value22"), null); + + RowPutChange putChange = new RowPutChange(tableName); + putChange.setPrimaryKey(getPrimaryKeys(20)); + putChange.addColumn("Col2", ColumnValue.fromString("Value2")); + Condition cond = new Condition(RowExistenceExpectation.IGNORE); + cond.setColumnCondition(new SingleColumnValueCondition( + "Col1", SingleColumnValueCondition.CompareOperator.NOT_EQUAL, + ColumnValue.fromString("Value20"))); + putChange.setCondition(cond); + + RowUpdateChange updateChange = new RowUpdateChange(tableName); + updateChange.setPrimaryKey(getPrimaryKeys(21)); + updateChange.put("Col3", ColumnValue.fromString("Value3")); + cond = new Condition(RowExistenceExpectation.IGNORE); + cond.setColumnCondition(new SingleColumnValueCondition( + "Col1", SingleColumnValueCondition.CompareOperator.EQUAL, + ColumnValue.fromString("Value21"))); + updateChange.setCondition(cond); + + RowDeleteChange deleteChange = new RowDeleteChange(tableName); + deleteChange.setPrimaryKey(getPrimaryKeys(22)); + cond = new Condition(RowExistenceExpectation.IGNORE); + cond.setColumnCondition(new SingleColumnValueCondition( + "Col1", SingleColumnValueCondition.CompareOperator.GREATER_THAN, + ColumnValue.fromString("Value22"))); + deleteChange.setCondition(cond); + + BatchWriteRowRequest request = new BatchWriteRowRequest(); + request.addRowChange(putChange); + request.addRowChange(updateChange); + request.addRowChange(deleteChange); + + BatchWriteRowResponse Response = ots.batchWriteRow(request); + List rowStatus = Response.getRowStatus(tableName); + assertEquals(3, rowStatus.size()); + assertTrue(!rowStatus.get(0).isSucceed()); + assertTrue(rowStatus.get(1).isSucceed()); + assertTrue(!rowStatus.get(2).isSucceed()); + } + + private void CreateTable() throws Exception { + CreateTable(1); + } + + private void CreateTable(int maxVersions) throws Exception { + TableMeta tableMeta = getTestTableMeta(); + TableOptions options = new TableOptions(); + options.setMaxVersions(maxVersions); + options.setMaxTimeDeviation(Long.MAX_VALUE / 1000000); + options.setTimeToLive(-1); + CreateTableRequest request = new CreateTableRequest(tableMeta, options); + CapacityUnit tableCU = getTestCapacityUnit(); + request.setReservedThroughput(new ReservedThroughput(tableCU)); + ots.createTable(request); + + LOG.info("Create table: " + tableName); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + } + + private boolean putRow(int row, String colName, ColumnValue colValue, ColumnCondition cond) + { + RowPutChange change = new RowPutChange(tableName); + change.setPrimaryKey(getPrimaryKeys(row)); + change.addColumn(colName, colValue); + Condition c = new Condition(RowExistenceExpectation.IGNORE); + c.setColumnCondition(cond); + change.setCondition(c); + PutRowRequest request = new PutRowRequest(); + request.setRowChange(change); + + boolean success = true; + try { + ots.putRow(request); + } catch (TableStoreException e) { + LOG.warning("PutRow fails: " + e.toString()); + success = false; + } + + return success; + } + + private boolean updateRow(int row, String colName, ColumnValue colValue, ColumnCondition cond) + { + RowUpdateChange change = new RowUpdateChange(tableName); + change.setPrimaryKey(getPrimaryKeys(row)); + change.put(colName, colValue); + Condition c = new Condition(RowExistenceExpectation.IGNORE); + c.setColumnCondition(cond); + change.setCondition(c); + UpdateRowRequest request = new UpdateRowRequest(); + request.setRowChange(change); + + boolean success = true; + try { + ots.updateRow(request); + } catch (TableStoreException e) { + LOG.warning("UpdateRow fails: " + e.toString()); + success = false; + } + + return success; + } + private boolean updateRow(int row, String colName, ColumnValue colValue, long ts, ColumnCondition cond) + { + RowUpdateChange change = new RowUpdateChange(tableName); + change.setPrimaryKey(getPrimaryKeys(row)); + change.put(colName, colValue, ts); + Condition c = new Condition(RowExistenceExpectation.IGNORE); + c.setColumnCondition(cond); + change.setCondition(c); + UpdateRowRequest request = new UpdateRowRequest(); + request.setRowChange(change); + + boolean success = true; + try { + ots.updateRow(request); + } catch (TableStoreException e) { + LOG.warning("UpdateRow fails: " + e.toString()); + success = false; + } + + return success; + } + + private boolean deleteRow(int row, String colName, ColumnValue colValue, ColumnCondition cond) + { + RowDeleteChange change = new RowDeleteChange(tableName); + change.setPrimaryKey(getPrimaryKeys(row)); + Condition c = new Condition(RowExistenceExpectation.IGNORE); + c.setColumnCondition(cond); + change.setCondition(c); + DeleteRowRequest request = new DeleteRowRequest(); + request.setRowChange(change); + + boolean success = true; + try { + ots.deleteRow(request); + } catch (TableStoreException e) { + LOG.warning("DeleteRow fails: " + e.toString()); + success = false; + } + + return success; + } + + private TableMeta getTestTableMeta() { + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("uid", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("name", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("flag", PrimaryKeyType.INTEGER); + return tableMeta; + } + + private CapacityUnit getTestCapacityUnit() { + CapacityUnit capacityUnit = new CapacityUnit(); + capacityUnit.setReadCapacityUnit(0); + capacityUnit.setWriteCapacityUnit(0); + return capacityUnit; + } + + private Row readRow(String tableName, int i) { + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); + rowQueryCriteria.setPrimaryKey(getPrimaryKeys(i)); + rowQueryCriteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(rowQueryCriteria); + GetRowResponse Response = ots.getRow(request); + return Response.getRow(); + } + + private PrimaryKey getPrimaryKeys(int i) { + PrimaryKeyBuilder primaryKeys = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeys.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(i)); + primaryKeys.addPrimaryKeyColumn("name", PrimaryKeyValue.fromString(String.format("%05d", i))); + primaryKeys.addPrimaryKeyColumn("flag", PrimaryKeyValue.fromLong(i * i)); + return primaryKeys.build(); + } +} diff --git a/src/test/java/com/aliyun/openservices/ots/integration/FilterAdvanceTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedFilterAdvanceTest.java similarity index 51% rename from src/test/java/com/aliyun/openservices/ots/integration/FilterAdvanceTest.java rename to src/test/java/com/alicloud/openservices/tablestore/model/UnifiedFilterAdvanceTest.java index 8f6e3eb..be1aa80 100644 --- a/src/test/java/com/aliyun/openservices/ots/integration/FilterAdvanceTest.java +++ b/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedFilterAdvanceTest.java @@ -1,17 +1,15 @@ -package com.aliyun.openservices.ots.integration; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.common.BaseFT; -import com.aliyun.openservices.ots.common.OTSHelper; -import com.aliyun.openservices.ots.common.Utils; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.condition.CompositeCondition; -import com.aliyun.openservices.ots.model.condition.RelationalCondition; -import com.aliyun.openservices.ots.utils.ServiceSettings; -import com.aliyun.openservices.ots.utils.TestUtil; +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.SyncClientInterface; +import com.alicloud.openservices.tablestore.common.*; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.model.filter.CompositeColumnValueFilter; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import com.google.gson.JsonSyntaxException; + import org.junit.*; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -21,29 +19,35 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class FilterAdvanceTest extends BaseFT { - private static Logger LOG = Logger.getLogger(FilterAdvanceTest.class.getName()); - - private static String tableName = TestUtil.newTableName("FilterAdvanceFunctionTest"); +public class UnifiedFilterAdvanceTest extends BaseFT { + private static Logger LOG = Logger.getLogger(UnifiedFilterAdvanceTest.class.getName()); - private static final OTS ots = OTSClientFactory.createOTSClient(ServiceSettings.load()); + private static String tableName = "FilterAdvanceFunctionTest"; + private static SyncClientInterface ots; private static final int SECONDS_UNTIL_TABLE_READY = 10; + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + @AfterClass public static void classAfter() { - TestUtil.DeleteTable(ots, tableName); ots.shutdown(); } @Before public void setup() throws Exception { - LOG.info("Instance: " + ServiceSettings.load().getOTSInstanceName()); + ListTableResponse r = ots.listTable(); - try { - DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName); + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); ots.deleteTable(deleteTableRequest); - } catch (Exception ex) {;} + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } } @@ -52,29 +56,36 @@ public void teardown() { } - public void checkReadRangeResult(long expectRowNum, Direction direction) throws Exception { + public void checkReadRangeResponse(long expectRowNum, Direction direction) throws Exception { - // expected result + // expected Response List expectRows = new ArrayList(); for (int i = 0; i < expectRowNum; i++) { - Row row = new Row(); + PrimaryKeyColumn[] pk = new PrimaryKeyColumn[1]; if (direction == Direction.FORWARD) { - row.addColumn("pk", ColumnValue.fromLong(i)); + pk[0] = new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i)); } else { - row.addColumn("pk", ColumnValue.fromLong(expectRowNum-i-1)); + pk[0] = new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(expectRowNum-i-1)); } + Column[] cols = new Column[10]; for (int j = 0; j < 10; j++) { - row.addColumn("col" + j, ColumnValue.fromLong(j)); + cols[j] = new Column("col" + j, ColumnValue.fromLong(j), 1); } + PrimaryKey primaryKey = new PrimaryKey(pk); + Row row = new Row(primaryKey, cols); expectRows.add(row); } - RelationalCondition filter = - new RelationalCondition("pk", RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromLong(expectRowNum)); + SingleColumnValueFilter filter = + new SingleColumnValueFilter("pk", SingleColumnValueFilter.CompareOperator.LESS_THAN, ColumnValue.fromLong(expectRowNum)); - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX); - RowPrimaryKey nextKey = null; + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN)); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX)); + PrimaryKey end = new PrimaryKey(pks); + PrimaryKey nextKey = null; RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); @@ -89,18 +100,19 @@ public void checkReadRangeResult(long expectRowNum, Direction direction) throws } rangeRowQueryCriteria.setDirection(direction); rangeRowQueryCriteria.setFilter(filter); + rangeRowQueryCriteria.setMaxVersions(1); List allRows = new ArrayList(); while (nextKey != null) { rangeRowQueryCriteria.setInclusiveStartPrimaryKey(nextKey); - GetRangeResult result = OTSHelper.getRange(ots, rangeRowQueryCriteria); - nextKey = result.getNextStartPrimaryKey(); - allRows.addAll(result.getRows()); + GetRangeResponse Response = OTSHelper.getRange(ots, rangeRowQueryCriteria); + nextKey = Response.getNextStartPrimaryKey(); + allRows.addAll(Response.getRows()); } assertEquals(expectRowNum, allRows.size()); for (int i = 0; i < allRows.size(); i++) { - checkRow(expectRows.get(i), allRows.get(i)); + checkRowNoTimestamp(expectRows.get(i), allRows.get(i)); } } @@ -111,8 +123,6 @@ public void checkReadRangeResult(long expectRowNum, Direction direction) throws */ @Test public void testReadRangeFilterRows() throws Exception { - LOG.info("Start testReadRangeFilterRows"); - // createTable TableMeta tableMeta = new TableMeta(tableName); tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.INTEGER); @@ -120,39 +130,38 @@ public void testReadRangeFilterRows() throws Exception { OTSHelper.createTable(ots, tableMeta); Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - // put 1000 rows * 10 cols * 1 version - LOG.info("put 1000 rows"); - int kRowCount = 1000; + // put 10000 rows * 10 cols * 1 version + int kRowCount = 10000; int kColumnCount = 10; Map columns = new HashMap(); for (int i = 0; i < kColumnCount; i++) { columns.put("col" + i, ColumnValue.fromLong(i)); } - + ArrayList pks = new ArrayList(); for (int i = 0; i < kRowCount; i++) { - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i)); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))); + PrimaryKey pk = new PrimaryKey(pks); OTSHelper.putRow(ots, tableName, pk, columns); } // 正向,通过filter读出的行数 - LOG.info("check result"); - checkReadRangeResult(0, Direction.FORWARD); - checkReadRangeResult(1, Direction.FORWARD); - checkReadRangeResult(499, Direction.FORWARD); - checkReadRangeResult(500, Direction.FORWARD); - checkReadRangeResult(501, Direction.FORWARD); - checkReadRangeResult(999, Direction.FORWARD); - checkReadRangeResult(1000, Direction.FORWARD); + checkReadRangeResponse(0, Direction.FORWARD); + checkReadRangeResponse(1, Direction.FORWARD); + checkReadRangeResponse(4999, Direction.FORWARD); + checkReadRangeResponse(5000, Direction.FORWARD); + checkReadRangeResponse(5001, Direction.FORWARD); + checkReadRangeResponse(9999, Direction.FORWARD); + checkReadRangeResponse(10000, Direction.FORWARD); // 反向,通过filter读出的行数 - checkReadRangeResult(0, Direction.BACKWARD); - checkReadRangeResult(1, Direction.BACKWARD); - checkReadRangeResult(499, Direction.BACKWARD); - checkReadRangeResult(500, Direction.BACKWARD); - checkReadRangeResult(501, Direction.BACKWARD); - checkReadRangeResult(999, Direction.BACKWARD); - checkReadRangeResult(1000, Direction.BACKWARD); + checkReadRangeResponse(0, Direction.BACKWARD); + checkReadRangeResponse(1, Direction.BACKWARD); + checkReadRangeResponse(4999, Direction.BACKWARD); + checkReadRangeResponse(5000, Direction.BACKWARD); + checkReadRangeResponse(5001, Direction.BACKWARD); + checkReadRangeResponse(9999, Direction.BACKWARD); + checkReadRangeResponse(10000, Direction.BACKWARD); } enum FilterIfMissingType @@ -162,7 +171,7 @@ enum FilterIfMissingType FT_FALSE } - public void checkFilterIfMissing(int rowCount, FilterIfMissingType typeForExistCol, FilterIfMissingType typeForNotExistCol, boolean expectResult) + public void checkFilterIfMissing(int rowCount, FilterIfMissingType typeForExistCol, FilterIfMissingType typeForNotExistCol, boolean expectResponse) { // columns to get List columnNames = new ArrayList(); @@ -171,10 +180,10 @@ public void checkFilterIfMissing(int rowCount, FilterIfMissingType typeForExistC columnNames.add("col_not_exist"); // (col == 999) AND (col_not_exist == 999) - RelationalCondition filterForExistCol = new RelationalCondition("col_exist", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(999)); - RelationalCondition filterForNotExistCol = new RelationalCondition("col_not_exist", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(999)); + SingleColumnValueFilter filterForExistCol = new SingleColumnValueFilter("col_exist", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(999)); + SingleColumnValueFilter filterForNotExistCol = new SingleColumnValueFilter("col_not_exist", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(999)); if (typeForExistCol == FilterIfMissingType.FT_TRUE) { filterForExistCol.setPassIfMissing(false); } else if (typeForExistCol == FilterIfMissingType.FT_FALSE) { @@ -185,83 +194,92 @@ public void checkFilterIfMissing(int rowCount, FilterIfMissingType typeForExistC } else if (typeForNotExistCol == FilterIfMissingType.FT_FALSE) { filterForNotExistCol.setPassIfMissing(true); } - CompositeCondition filter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - filter.addCondition(filterForExistCol).addCondition(filterForNotExistCol); - + CompositeColumnValueFilter filter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.AND); + filter.addFilter(filterForExistCol).addFilter(filterForNotExistCol); + + ArrayList pks = new ArrayList(); // 测试GetRow { for (int i = 0; i < rowCount; i++) { - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i)); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))); + PrimaryKey pk = new PrimaryKey(pks); SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); rowQueryCriteria.setPrimaryKey(pk); - rowQueryCriteria.setColumnsToGet(columnNames); + rowQueryCriteria.addColumnsToGet(columnNames); rowQueryCriteria.setFilter(filter); + rowQueryCriteria.setMaxVersions(1); GetRowRequest getRowRequest = new GetRowRequest(rowQueryCriteria); - GetRowResult result = ots.getRow(getRowRequest); - Row row = result.getRow(); - if (expectResult) { + GetRowResponse Response = ots.getRow(getRowRequest); + Row row = Response.getRow(); + if (expectResponse) { assertTrue(row != null); - assertEquals(2, row.getColumns().size()); - assertEquals(i, row.getColumns().get("pk").asLong()); - assertEquals(999, row.getColumns().get("col_exist").asLong()); + assertEquals(1, row.getColumns().length); + assertEquals(i, row.getPrimaryKey().getPrimaryKeyColumn(0).getValue().asLong()); + assertEquals(999, row.getColumn("col_exist").get(0).getValue().asLong()); } else { - checkRow(new Row(), row); + checkRow(null, row); } } } // 测试BatchGetRow { - List primaryKeys = new ArrayList(); + List primaryKeys = new ArrayList(); for (int i = 0; i < rowCount; i++) { - primaryKeys.add(new RowPrimaryKey().addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))); + primaryKeys.add(new PrimaryKey(pks)); } List criterias = new ArrayList(); MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(tableName); multiRowQueryCriteria.setRowKeys(primaryKeys); - multiRowQueryCriteria.setColumnsToGet(columnNames); + multiRowQueryCriteria.addColumnsToGet(columnNames); multiRowQueryCriteria.setFilter(filter); + multiRowQueryCriteria.setMaxVersions(1); criterias.add(multiRowQueryCriteria); - List result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), rowCount); - for (int i = 0; i < result.size(); i++) { - BatchGetRowResult.RowStatus rowResult = result.get(i); - Row row = rowResult.getRow(); - assertTrue(rowResult.isSucceed()); - if (expectResult) { + List Response = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); + assertEquals(Response.size(), rowCount); + for (int i = 0; i < Response.size(); i++) { + BatchGetRowResponse.RowResult rowResponse = Response.get(i); + Row row = rowResponse.getRow(); + assertTrue(rowResponse.isSucceed()); + if (expectResponse) { assertTrue(row != null); - assertEquals(2, row.getColumns().size()); - assertEquals(i, row.getColumns().get("pk").asLong()); - assertEquals(999, row.getColumns().get("col_exist").asLong()); + assertEquals(1, row.getColumns().length); + assertEquals(i, row.getPrimaryKey().getPrimaryKeyColumn(0).getValue().asLong()); + assertEquals(999, row.getColumn("col_exist").get(0).getValue().asLong()); } else { - checkRow(new Row(), row); + checkRow(null, row); } } } // 测试GetRange { - RowPrimaryKey beginKey = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN); - RowPrimaryKey endKey = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN)); + PrimaryKey beginKey = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX)); + PrimaryKey endKey = new PrimaryKey(pks); RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); rangeRowQueryCriteria.setInclusiveStartPrimaryKey(beginKey); rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endKey); rangeRowQueryCriteria.setFilter(filter); - GetRangeResult result = OTSHelper.getRange(ots, rangeRowQueryCriteria); - List rows = result.getRows(); - if (expectResult) { + rangeRowQueryCriteria.setMaxVersions(1); + GetRangeResponse Response = OTSHelper.getRange(ots, rangeRowQueryCriteria); + List rows = Response.getRows(); + if (expectResponse) { assertEquals(rows.size(), rowCount); for (int i = 0; i < rowCount; i++) { Row row = rows.get(i); assertTrue(row != null); - assertEquals(2, row.getColumns().size()); - assertEquals(i, row.getColumns().get("pk").asLong()); - assertEquals(999, row.getColumns().get("col_exist").asLong()); + assertEquals(1, row.getColumns().length); + assertEquals(i, row.getPrimaryKey().getPrimaryKeyColumn(0).getValue().asLong()); + assertEquals(999, row.getColumn("col_exist").get(0).getValue().asLong()); } } else { assertEquals(rows.size(), 0); @@ -276,8 +294,6 @@ public void checkFilterIfMissing(int rowCount, FilterIfMissingType typeForExistC */ @Test public void testFilterIfMissing() throws Exception { - LOG.info("Start testFilterIfMissing"); - // createTable TableMeta tableMeta = new TableMeta(tableName); tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.INTEGER); @@ -289,9 +305,11 @@ public void testFilterIfMissing() throws Exception { Map columns = new HashMap(); columns.put("col_exist", ColumnValue.fromLong(999)); + ArrayList pks = new ArrayList(); for (int i = 0; i < 10; i++) { - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i)); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))); + PrimaryKey pk = new PrimaryKey(pks); OTSHelper.putRow(ots, tableName, pk, columns); } @@ -318,8 +336,6 @@ public void testFilterIfMissing() throws Exception { */ @Test public void testFilterIfMissing1000Rows() throws Exception { - LOG.info("Start testFilterIfMissing1000Rows"); - // createTable TableMeta tableMeta = new TableMeta(tableName); tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.INTEGER); @@ -330,32 +346,36 @@ public void testFilterIfMissing1000Rows() throws Exception { List expectRows1 = new ArrayList(); List expectRows2 = new ArrayList(); + ArrayList pks = new ArrayList(); // put 1000 rows - LOG.info("put 1000 rows"); for (int i = 0; i < 500; i++) { Map columns = new HashMap(); - RowPrimaryKey pk = new RowPrimaryKey().addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i)); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromLong(i)); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))); + PrimaryKey pk = new PrimaryKey(pks); + Column[] cols = new Column[128]; for (int j = 0; j < 128; j++) { + cols[j] = new Column("col" + j, ColumnValue.fromLong(999), 1); columns.put("col" + j, ColumnValue.fromLong(999)); - row.addColumn("col" + j, ColumnValue.fromLong(999)); } + Row row = new Row(pk, cols); OTSHelper.putRow(ots, tableName, pk, columns); expectRows1.add(row); expectRows2.add(row); } for (int i = 500; i < 1000; i++) { Map columns = new HashMap(); - RowPrimaryKey pk = new RowPrimaryKey().addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i)); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromLong(i)); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))); + PrimaryKey pk = new PrimaryKey(pks); + Column[] cols = new Column[128]; for (int j = 0; j < 127; j++) { + cols[j] = new Column("col" + j, ColumnValue.fromLong(999), 1); columns.put("col" + j, ColumnValue.fromLong(999)); - row.addColumn("col" + j, ColumnValue.fromLong(999)); } + cols[127] = new Column("col_unique", ColumnValue.fromLong(999)); columns.put("col_unique", ColumnValue.fromLong(999)); - row.addColumn("col_unique", ColumnValue.fromLong(999)); + Row row = new Row(pk, cols); OTSHelper.putRow(ots, tableName, pk, columns); expectRows2.add(row); } @@ -367,53 +387,54 @@ public void testFilterIfMissing1000Rows() throws Exception { } // 测试GetRange,FilterIfMissing = true - RelationalCondition filter = new RelationalCondition("col127", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(999)); + SingleColumnValueFilter filter = new SingleColumnValueFilter("col127", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(999)); filter.setPassIfMissing(false); // for GetRange - RowPrimaryKey beginKey = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN); - RowPrimaryKey endKey = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MIN)); + PrimaryKey beginKey = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.INF_MAX)); + PrimaryKey endKey = new PrimaryKey(pks); RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(tableName); rangeRowQueryCriteria.setInclusiveStartPrimaryKey(beginKey); rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endKey); rangeRowQueryCriteria.setFilter(filter); + rangeRowQueryCriteria.setMaxVersions(1); - LOG.info("start get range"); List allRows = new ArrayList(); - RowPrimaryKey nextKey = beginKey; + PrimaryKey nextKey = beginKey; while (nextKey != null) { rangeRowQueryCriteria.setInclusiveStartPrimaryKey(nextKey); - GetRangeResult result = OTSHelper.getRange(ots, rangeRowQueryCriteria); - nextKey = result.getNextStartPrimaryKey(); - allRows.addAll(result.getRows()); + GetRangeResponse Response = OTSHelper.getRange(ots, rangeRowQueryCriteria); + nextKey = Response.getNextStartPrimaryKey(); + allRows.addAll(Response.getRows()); } assertEquals(500, allRows.size()); for (int i = 0; i < allRows.size(); i++) { Row row = allRows.get(i); - checkRow(expectRows1.get(i), row); + checkRowNoTimestamp(expectRows1.get(i), row); } // 测试GetRange,FilterIfMissing = false filter.setPassIfMissing(true); rangeRowQueryCriteria.setFilter(filter); - LOG.info("check result"); allRows.clear(); nextKey = beginKey; while (nextKey != null) { rangeRowQueryCriteria.setInclusiveStartPrimaryKey(nextKey); - GetRangeResult result = OTSHelper.getRange(ots, rangeRowQueryCriteria); - nextKey = result.getNextStartPrimaryKey(); - allRows.addAll(result.getRows()); + GetRangeResponse Response = OTSHelper.getRange(ots, rangeRowQueryCriteria); + nextKey = Response.getNextStartPrimaryKey(); + allRows.addAll(Response.getRows()); } assertEquals(1000, allRows.size()); for (int i = 0; i < allRows.size(); i++) { Row row = allRows.get(i); - checkRow(expectRows2.get(i), row); + checkRowNoTimestamp(expectRows2.get(i), row); } } @@ -424,8 +445,6 @@ public void testFilterIfMissing1000Rows() throws Exception { */ @Test public void testCompoundFilter() throws Exception { - LOG.info("Start testCompoundFilter"); - // createTable TableMeta tableMeta = new TableMeta(tableName); tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.INTEGER); @@ -434,32 +453,35 @@ public void testCompoundFilter() throws Exception { Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); ColumnValue abcValue = ColumnValue.fromBinary("ABC".getBytes()); + ArrayList pks = new ArrayList(); { // put 1 rows * 4 cols int kColumnCount = 4; Map columns = new HashMap(); - RowPrimaryKey pk = new RowPrimaryKey().addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(0)); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromLong(0)); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(0))); + PrimaryKey pk = new PrimaryKey(pks); + Column[] cols = new Column[kColumnCount]; for (int j = 0; j < kColumnCount; j++) { columns.put("C" + Integer.toString(j), ColumnValue.fromBinary("ABC".getBytes())); - row.addColumn("C" + Integer.toString(j), ColumnValue.fromBinary("ABC".getBytes())); + cols[j] = new Column("C" + Integer.toString(j), ColumnValue.fromBinary("ABC".getBytes())); } + Row row = new Row(pk, cols); OTSHelper.putRow(ots, tableName, pk, columns); // 测试GetRow,并设置以下filter:C0 > 'AAA' OR C1 < 'ABD' OR NOT C2 = 'XXX' AND C3 = 'ABC' - CompositeCondition subFilter1 = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - subFilter1.addCondition(new RelationalCondition("C2", RelationalCondition.CompareOperator.EQUAL, + CompositeColumnValueFilter subFilter1 = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.NOT); + subFilter1.addFilter(new SingleColumnValueFilter("C2", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBinary("XXX".getBytes()))); - CompositeCondition subFilter2 = new CompositeCondition(CompositeCondition.LogicOperator.AND); - subFilter2.addCondition(subFilter1).addCondition(new RelationalCondition("C3", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBinary("ABC".getBytes()))); - CompositeCondition filter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - filter.addCondition(new RelationalCondition("C0", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromBinary("AAA".getBytes()))) - .addCondition(new RelationalCondition("C1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromBinary("ABD".getBytes()))) - .addCondition(subFilter2); + CompositeColumnValueFilter subFilter2 = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.AND); + subFilter2.addFilter(subFilter1).addFilter(new SingleColumnValueFilter("C3", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBinary("ABC".getBytes()))); + CompositeColumnValueFilter filter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + filter.addFilter(new SingleColumnValueFilter("C0", + SingleColumnValueFilter.CompareOperator.GREATER_THAN, ColumnValue.fromBinary("AAA".getBytes()))) + .addFilter(new SingleColumnValueFilter("C1", + SingleColumnValueFilter.CompareOperator.LESS_THAN, ColumnValue.fromBinary("ABD".getBytes()))) + .addFilter(subFilter2); List columnNames = new ArrayList(); columnNames.add("pk"); @@ -468,41 +490,44 @@ public void testCompoundFilter() throws Exception { } SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); rowQueryCriteria.setPrimaryKey(pk); - rowQueryCriteria.setColumnsToGet(columnNames); + rowQueryCriteria.addColumnsToGet(columnNames); rowQueryCriteria.setFilter(filter); + rowQueryCriteria.setMaxVersions(1); GetRowRequest getRowRequest = new GetRowRequest(rowQueryCriteria); - GetRowResult result = ots.getRow(getRowRequest); - Row resultRow = result.getRow(); - assertTrue(resultRow != null); - checkRow(row, resultRow); + GetRowResponse Response = ots.getRow(getRowRequest); + Row ResponseRow = Response.getRow(); + assertTrue(ResponseRow != null); + checkRowNoTimestamp(row, ResponseRow); } { // put 1 rows * 4 cols int kColumnCount = 4; Map columns = new HashMap(); - RowPrimaryKey pk = new RowPrimaryKey().addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1)); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromLong(1)); + pks.clear(); + pks.add(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(1))); + PrimaryKey pk = new PrimaryKey(pks); + Column[] cols = new Column[kColumnCount]; for (int j = 0; j < kColumnCount; j++) { columns.put("C" + Integer.toString(j), ColumnValue.fromBinary("XXX".getBytes())); - row.addColumn("C" + Integer.toString(j), ColumnValue.fromBinary("XXX".getBytes())); + cols[j] = new Column("C" + Integer.toString(j), ColumnValue.fromBinary("XXX".getBytes())); } + Row row = new Row(pk, cols); OTSHelper.putRow(ots, tableName, pk, columns); // 测试GetRow,并设置以下filter:C0 > 'AAA' OR C1 < 'ABD' OR NOT C2 = 'XXX' AND C3 = 'ABC' - CompositeCondition subFilter1 = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - subFilter1.addCondition(new RelationalCondition("C2", RelationalCondition.CompareOperator.EQUAL, + CompositeColumnValueFilter subFilter1 = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.NOT); + subFilter1.addFilter(new SingleColumnValueFilter("C2", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBinary("XXX".getBytes()))); - CompositeCondition subFilter2 = new CompositeCondition(CompositeCondition.LogicOperator.AND); - subFilter2.addCondition(subFilter1).addCondition(new RelationalCondition("C3", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBinary("ABC".getBytes()))); - CompositeCondition filter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - filter.addCondition(new RelationalCondition("C0", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromBinary("AAA".getBytes()))) - .addCondition(new RelationalCondition("C1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromBinary("ABD".getBytes()))) - .addCondition(subFilter2); + CompositeColumnValueFilter subFilter2 = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.AND); + subFilter2.addFilter(subFilter1).addFilter(new SingleColumnValueFilter("C3", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBinary("ABC".getBytes()))); + CompositeColumnValueFilter filter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + filter.addFilter(new SingleColumnValueFilter("C0", + SingleColumnValueFilter.CompareOperator.GREATER_THAN, ColumnValue.fromBinary("AAA".getBytes()))) + .addFilter(new SingleColumnValueFilter("C1", + SingleColumnValueFilter.CompareOperator.LESS_THAN, ColumnValue.fromBinary("ABD".getBytes()))) + .addFilter(subFilter2); List columnNames = new ArrayList(); columnNames.add("pk"); @@ -511,13 +536,14 @@ public void testCompoundFilter() throws Exception { } SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); rowQueryCriteria.setPrimaryKey(pk); - rowQueryCriteria.setColumnsToGet(columnNames); + rowQueryCriteria.addColumnsToGet(columnNames); rowQueryCriteria.setFilter(filter); + rowQueryCriteria.setMaxVersions(1); GetRowRequest getRowRequest = new GetRowRequest(rowQueryCriteria); - GetRowResult result = ots.getRow(getRowRequest); - Row resultRow = result.getRow(); - assertTrue(resultRow != null); - checkRow(row, resultRow); + GetRowResponse Response = ots.getRow(getRowRequest); + Row ResponseRow = Response.getRow(); + assertTrue(ResponseRow != null); + checkRowNoTimestamp(row, ResponseRow); } } } diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedFilterRestrictionAndParamCheckingTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedFilterRestrictionAndParamCheckingTest.java new file mode 100644 index 0000000..2944ea1 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/UnifiedFilterRestrictionAndParamCheckingTest.java @@ -0,0 +1,1572 @@ +package com.alicloud.openservices.tablestore.model; + +import com.alicloud.openservices.tablestore.SyncClientInterface; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.common.*; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.model.filter.ColumnValueFilter; +import com.alicloud.openservices.tablestore.model.filter.CompositeColumnValueFilter; +import com.alicloud.openservices.tablestore.model.filter.Filter; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import com.google.gson.JsonSyntaxException; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +public class UnifiedFilterRestrictionAndParamCheckingTest extends BaseFT { + private static Logger LOG = Logger.getLogger(UnifiedFilterAdvanceTest.class.getName()); + + private static String tableName = "FilterRestrictionTest"; + + private static SyncClientInterface ots; + + private static final int SECONDS_UNTIL_TABLE_READY = 10; + + private static final int MAX_FILTER_COUNT = 10; + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + ots = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + ots.shutdown(); + } + + @Before + public void setup() throws Exception { + OTSHelper.deleteAllTable(ots); + + ListTableResponse r = ots.listTable(); + + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + ots.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.INTEGER); + + OTSHelper.createTable(ots, tableMeta); + Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); + } + + public Filter makeFilterWithMaxDepth(int depth, CompositeColumnValueFilter.LogicOperator operator) { + CompositeColumnValueFilter rootFilter = new CompositeColumnValueFilter(operator); + CompositeColumnValueFilter lastFilter = rootFilter; + int filterCount = 1; + + for (int i = 2; i < depth; i++) { + if (operator != CompositeColumnValueFilter.LogicOperator.NOT) { + lastFilter.addFilter(new SingleColumnValueFilter("ColumnA", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromString("A"))); + filterCount++; + } + + CompositeColumnValueFilter tmp = new CompositeColumnValueFilter(operator); + filterCount++; + lastFilter.addFilter(tmp); + lastFilter = tmp; + } + + lastFilter.addFilter(new SingleColumnValueFilter("ColumnB", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromString("B"))); + filterCount++; + + if (operator != CompositeColumnValueFilter.LogicOperator.NOT) { + lastFilter.addFilter(new SingleColumnValueFilter("ColumnC", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromString("C"))); + filterCount++; + } + + for (int i = filterCount; i < MAX_FILTER_COUNT; i++) { + lastFilter.addFilter(new SingleColumnValueFilter("ColumnD", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); + } + return rootFilter; + } + + public Filter makeFilterWithMaxBreadth(int maxCount, CompositeColumnValueFilter.LogicOperator operator) { + CompositeColumnValueFilter rootFilter = new CompositeColumnValueFilter(operator); + + for (int i = 1; i < maxCount; i++) { + rootFilter.addFilter(new SingleColumnValueFilter("Column_" + i, SingleColumnValueFilter.CompareOperator.GREATER_EQUAL, ColumnValue.fromString("A"))); + } + + return rootFilter; + } + + public Filter createFilter(int filterNumber, int maxCount, CompositeColumnValueFilter.LogicOperator operator) { + boolean hasLeftNode = (2 * filterNumber) <= maxCount; + boolean hasRightNode = (2 * filterNumber + 1) <= maxCount; + + //System.out.println(filterNumber + " " + hasLeftNode + " " + hasRightNode + " " + maxCount); + if (hasLeftNode || hasRightNode) { + if (hasRightNode) { + return new CompositeColumnValueFilter(operator); + } else { + // if only has left node, the operator should only be NOT + return new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.NOT); + } + } else { + return new SingleColumnValueFilter("Column1_" + filterNumber, SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromString("A")); + } + } + + public Filter makeFilterInBinaryForm(int maxCount, CompositeColumnValueFilter.LogicOperator operator) { + if (maxCount <= 0) { + throw new IllegalArgumentException("There must be at least one filter."); + } + + if (maxCount == 1) { + return new SingleColumnValueFilter("Column1", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromString("A")); + } + + List filters = new ArrayList(); + filters.add(new CompositeColumnValueFilter(operator)); + + for (int index = 0; index < maxCount; index++) { + int filterNumber = index + 1; + int leftFilterNumber = 2 * filterNumber; + int rightFilterNumber = leftFilterNumber + 1; + + if (!(filters.get(index) instanceof CompositeColumnValueFilter)) { + continue; + } + + CompositeColumnValueFilter rootFilter = (CompositeColumnValueFilter)filters.get(index); + // add left node + if (leftFilterNumber <= maxCount) { + Filter leftFilter = createFilter(leftFilterNumber, maxCount, operator); + rootFilter.addFilter((ColumnValueFilter) leftFilter); + filters.add(leftFilter); + } + + // add right node + if (rightFilterNumber <= maxCount) { + Filter rightFilter = createFilter(rightFilterNumber, maxCount, operator); + rootFilter.addFilter((ColumnValueFilter) rightFilter); + filters.add(rightFilter); + } + } + + //printFilter(filters); + + return filters.get(0); + } + + private void printFilter(List filters) { + for (Filter filter : filters) { + if (filter instanceof CompositeColumnValueFilter) { + System.out.println("CompositeColumnValueFilter " + ((CompositeColumnValueFilter) filter).getOperationType()); + } else { + System.out.println("SingleColumnValueFilter"); + } + } + } + + /** + * 构造一个深度为1000的composite filter,测试GetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_ExceedMaxDepth_GetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + // test OR + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + + /** + * 构造一个深度为1000的composite filter,测试GetRange操作。 + */ + @Test + public void testCompositeColumnValueFilter_ExceedMaxDepth_GetRange() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + + + // test OR + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.OR)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.AND)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个深度为1000的composite filter,测试BatchGetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_ExceedMaxDepth_BatchGetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey); + + // test OR + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.OR)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.AND)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个深度优先刚好超过和刚好不超过Filter个数限制的composite filter,测试GetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_NotExceedMaxDepth_GetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + + // test OR + { + try { + criteria.setFilter(makeFilterWithMaxDepth(6, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(5, CompositeColumnValueFilter.LogicOperator.OR)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + + // test AND + { + try { + criteria.setFilter(makeFilterWithMaxDepth(6, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(5, CompositeColumnValueFilter.LogicOperator.AND)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterWithMaxDepth(11, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(10, CompositeColumnValueFilter.LogicOperator.NOT)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + } + + /** + * 构造一个深度优先刚好超过和刚好不超过Filter个数限制的composite filter,测试GetRange操作。 + */ + @Test + public void testCompositeColumnValueFilter_NotExceedMaxDepth_GetRange() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + + + // test OR + { + try { + criteria.setFilter(makeFilterWithMaxDepth(6, CompositeColumnValueFilter.LogicOperator.OR)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(5, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + + // test AND + { + try { + criteria.setFilter(makeFilterWithMaxDepth(6, CompositeColumnValueFilter.LogicOperator.AND)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(5, CompositeColumnValueFilter.LogicOperator.AND)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterWithMaxDepth(11, CompositeColumnValueFilter.LogicOperator.NOT)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(10, CompositeColumnValueFilter.LogicOperator.NOT)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + } + + /** + * 构造一个深度优先刚好超过和刚好不超过Filter个数限制的composite filter,测试BatchGetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_NotExceedMaxDepth_BatchGetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey1 = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey primaryKey2 = new PrimaryKey(pks); + + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey1); + criteria.addRow(primaryKey2); + // test AND + { + try { + criteria.setFilter(makeFilterWithMaxDepth(6, CompositeColumnValueFilter.LogicOperator.AND)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(5, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + + // test OR + { + try { + criteria.setFilter(makeFilterWithMaxDepth(6, CompositeColumnValueFilter.LogicOperator.OR)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(5, CompositeColumnValueFilter.LogicOperator.OR)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterWithMaxDepth(11, CompositeColumnValueFilter.LogicOperator.NOT)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxDepth(10, CompositeColumnValueFilter.LogicOperator.NOT)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + } + + /** + * 构造一个广度优先的超过Filter个数限制的单层composite filter,测试GetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_ExceedMaxBreadth_GetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + // test OR + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个广度优先的超过Filter个数限制的单层composite filter,测试GetRange操作。 + */ + @Test + public void testCompositeColumnValueFilter_ExceedMaxBreadth_GetRange() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + + + // test OR + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个广度优先的超过Filter个数限制的单层composite filter,测试BatchGetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_ExceedMaxBreadth_BatchGetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey); + + // test OR + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个超过Filter个数限制的二叉树composite filter,测试GetRow操作。 + */ + @Test + public void testCompositeColumnValueFilterInBinaryTree_ExceedMaxCount_GetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + + // test OR + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个超过Filter个数限制的二叉树composite filter,测试GetRange操作。 + */ + @Test + public void testCompositeColumnValueFilterInBinaryTree_ExceedMaxCount_GetRange() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + + + // test OR + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个超过Filter个数限制的二叉树composite filter,测试BatchGetRow操作。 + */ + @Test + public void testCompositeColumnValueFilterInBinaryTreeExceedMaxCount_BatchGetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey); + + // test OR + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test AND + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // test NOT + try { + criteria.setFilter(makeFilterInBinaryForm(1000, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + + /** + * 构造一个广度优先的恰好超过和恰好不超过Filter个数限制的composite filter,测试GetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_NotExceedMaxBreadth_GetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + + // test OR + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + // 广度优先无法使用NOT,NOT只允许一个Filter + } + + // test AND + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.AND)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + } + + /** + * 构造一个广度优先的恰好超过和恰好不超过Filter个数限制的composite filter,测试GetRange操作。 + */ + @Test + public void testCompositeColumnValueFilter_NotExceedMaxBreadth_GetRange() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + + + // test OR + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + + } + + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + + // test AND + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + } + + /** + * 构造一个广度优先的恰好超过和恰好不超过Filter个数限制的composite filter,测试BatchGetRow操作。 + */ + @Test + public void testCompositeColumnValueFilter_NotExceedMaxBreadth_BatchGetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey); + + // test OR + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.AND)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + + // test AND + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.AND)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.AND)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + } + + /** + * 构造一个恰好超过和恰好不超过Filter个数上限的二叉树的composite filter,测试GetRow操作。 + */ + @Test + public void testCompositeColumnValueFilterInBinaryTree_NotExceedMaxCount_GetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + + // test OR + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + + // test AND + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.NOT)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + ots.getRow(request); + } + } + + /** + * 构造一个恰好超过和恰好不超过Filter个数上限的二叉树的composite filter,测试GetRange操作。 + */ + @Test + public void testCompositeColumnValueFilterInBinaryTree_NotExceedMaxCount_GetRange() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + + + // test OR + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterInBinaryForm(10, CompositeColumnValueFilter.LogicOperator.OR)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + + // test AND + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterInBinaryForm(10, CompositeColumnValueFilter.LogicOperator.AND)); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + } + } + + /** + * 构造一个恰好超过和恰好不超过Filter个数上限的二叉树的composite filter,测试BatchGetRow操作。 + */ + @Test + public void testCompositeColumnValueFilterInBinaryTree_NotExceedMaxCount_BatchGetRow() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey); + + // test OR + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.OR)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterInBinaryForm(10, CompositeColumnValueFilter.LogicOperator.OR)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + // test AND + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.AND)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + criteria.setFilter(makeFilterInBinaryForm(10, CompositeColumnValueFilter.LogicOperator.AND)); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + assertEquals(Response.getFailedRows().size(), 0); + } + + // test NOT + { + try { + criteria.setFilter(makeFilterInBinaryForm(11, CompositeColumnValueFilter.LogicOperator.NOT)); + criteria.setMaxVersions(1); + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + ots.batchGetRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(ErrorCode.INVALID_PARAMETER, "The count of filter exceeds the max: 10.", 400, e); + } + } + } + + /** + * 构造一个长度超过BINARY/STRING列值最大长度的filter,类型分别是BINARY/STRING,期望被拒绝。分别测试单个relation filter,以及一个小的composite filter。 + */ + @Test + public void testValueExceedMaxLength() { + // STRING + { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + criteria.setMaxVersions(1); + + ColumnValue v = ColumnValue.fromString(NewString(2 * 1024 * 1024 + 1, 'a')); + SingleColumnValueFilter singleFilter = new SingleColumnValueFilter("Column", SingleColumnValueFilter.CompareOperator.EQUAL, v); + CompositeColumnValueFilter compositeFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + compositeFilter.addFilter(singleFilter); + compositeFilter.addFilter(new SingleColumnValueFilter("Column1", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); + + TableStoreException lengthExceedExp = new TableStoreException( + "The length of attribute column: 'Column' exceeds the MaxLength:2097152 with CurrentLength:2097153.", + null, "OTSParameterInvalid", "", 400); + runAndExpectFail(singleFilter, lengthExceedExp); + runAndExpectFail(compositeFilter, lengthExceedExp); + } + + // BINARY + { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setMaxVersions(1); + criteria.setPrimaryKey(primaryKey); + + ColumnValue v = ColumnValue.fromBinary(new byte[2 * 1024 * 1024 + 1]); + SingleColumnValueFilter singleFilter = new SingleColumnValueFilter("Column", SingleColumnValueFilter.CompareOperator.EQUAL, v); + CompositeColumnValueFilter compositeFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + compositeFilter.addFilter(singleFilter); + compositeFilter.addFilter(new SingleColumnValueFilter("Column1", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); + + TableStoreException lengthExceedExp = new TableStoreException( + "The length of attribute column: 'Column' exceeds the MaxLength:2097152 with CurrentLength:2097153.", + null, "OTSParameterInvalid", "", 400); + runAndExpectFail(singleFilter, lengthExceedExp); + runAndExpectFail(compositeFilter, lengthExceedExp); + } + } + + /** + * 构造一个column类型与cell类型不同的filter,交叉测试cell类型和filter类型分别是BINARY/STRING/INTEGER/DOUBLE/BOOLEAN。分别测试当个relation filter以及一个小的composite filter。 + */ + @Test + public void testCompareWithDifferentType() { + PutRowRequest pr = new PutRowRequest(); + + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + RowPutChange rowChange = new RowPutChange(tableName); + rowChange.setPrimaryKey(primaryKey); + String[] names = new String[]{"col_int", "col_string", "col_double", "col_boolean", "col_byte"}; + ColumnValue[] values = new ColumnValue[] {ColumnValue.fromLong(0), ColumnValue.fromString("a"), + ColumnValue.fromDouble(1.0), ColumnValue.fromBoolean(true), ColumnValue.fromBinary(new byte[]{0})}; + + for (int i = 0; i < names.length; i++) { + rowChange.addColumn(names[i], values[i]); + } + pr.setRowChange(rowChange); + ots.putRow(pr); + + for (int i = 0; i < names.length; i++) { + for (int j = 0; j < values.length; j++) { + if (i == j) { + continue; + } + + SingleColumnValueFilter singleFilter = new SingleColumnValueFilter(names[i], SingleColumnValueFilter.CompareOperator.EQUAL, values[j]); + CompositeColumnValueFilter compositeFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.AND); + compositeFilter.addFilter(singleFilter); + compositeFilter.addFilter(new SingleColumnValueFilter("CC", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); + + SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); + rowQueryCriteria.setPrimaryKey(primaryKey); + rowQueryCriteria.setFilter(singleFilter); + rowQueryCriteria.setMaxVersions(1); + GetRowRequest getRowRequest = new GetRowRequest(rowQueryCriteria); + GetRowResponse result = ots.getRow(getRowRequest); + Row resultRow = result.getRow(); + assertEquals(resultRow, null); + } + } + } + + /** + * 构造 CompositeColumnValueFilter 类型为 NOT,并且sub filter数量为2或9,期望出错。 + * 构造 CompositeColumnValueFilter 类型为 AND/OR,并且sub filter数量为1,期望出错。 + */ + @Test + public void testLogicOperatorRestriction() { + CompositeColumnValueFilter orFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + CompositeColumnValueFilter andFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.AND); + CompositeColumnValueFilter notFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.NOT); + + SingleColumnValueFilter singleFilter = new SingleColumnValueFilter("Column", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false)); + orFilter.addFilter(singleFilter); + andFilter.addFilter(singleFilter); + + TableStoreException binaryExp = new TableStoreException("Invalid AND/OR operator: the number of sub-filters must be more than 1.", null, "OTSParameterInvalid", "", 400); + TableStoreException notExp = new TableStoreException("Invalid NOT operator: the number of sub-filters must be 1.", null, "OTSParameterInvalid", "", 400); + runAndExpectFail(orFilter, binaryExp); + runAndExpectFail(andFilter, binaryExp); + + for (int i = 0; i < 2; i++) { + notFilter.addFilter(singleFilter); + } + runAndExpectFail(notFilter, notExp); + + notFilter.clear(); + for (int i = 0; i < 9; i++) { + notFilter.addFilter(singleFilter); + } + runAndExpectFail(notFilter, notExp); + } + + private void runAndExpectFail(Filter filter, TableStoreException exp) { + // GetRow + { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + criteria.setFilter(filter); + criteria.setMaxVersions(1); + GetRowRequest request = new GetRowRequest(); + request.setRowQueryCriteria(criteria); + + try { + ots.getRow(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(exp.getErrorCode(), exp.getMessage(), exp.getHttpStatus(), e); + } + } + + // GetRange + { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + criteria.setFilter(filter); + criteria.setMaxVersions(1); + + + try { + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + ots.getRange(request); + fail(); + } catch (TableStoreException e) { + assertTableStoreException(exp.getErrorCode(), exp.getMessage(), exp.getHttpStatus(), e); + } + } + + // BatchGetRow + { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey); + criteria.setFilter(filter); + criteria.setMaxVersions(1); + + try { + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse Response = ots.batchGetRow(request); + if (!Response.isAllSucceed()) { + assertEquals(Response.getFailedRows().size(), 1); + assertEquals(Response.getFailedRows().get(0).getError().getCode(), exp.getErrorCode()); + assertEquals(Response.getFailedRows().get(0).getError().getMessage(), exp.getMessage()); + } else { + fail(); + } + } catch (TableStoreException e) { + assertTableStoreException(exp.getErrorCode(), exp.getMessage(), exp.getHttpStatus(), e); + } + } + } + + /** + * 构造一个一层的composite filter,里面包含AND或者OR,含有9个relation filter,每个relational filter的列名不一样,分别为[C1, C2 ... C9], + * 分别测试GetRow/BatchGetRow/GetRange 3种请求,包含128列,列名长度255,列名分别为[C1, C2, ... C128], 类型为STRING或者BINARY, + * Column大小为2K,使该行总大小为256KB。期望正常返回。 + * + * Public模型下单行的数据量最大为256KB。 + */ + @Test + public void testColumnNameMaxLength() { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + ColumnValue columnValue = ColumnValue.fromString(NewString(2 * 896, 'c')); + + for (int i = 0; i < 16; i++) { + UpdateRowRequest pr = new UpdateRowRequest(); + RowUpdateChange rowChange = new RowUpdateChange(tableName); + rowChange.setPrimaryKey(primaryKey); + for (int j = 0; j < 8; j++) { + rowChange.put(String.format("C%0254d", i * 8 + j), columnValue); + } + + pr.setRowChange(rowChange); + ots.updateRow(pr); + } + + { + CompositeColumnValueFilter compositeFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + for (int i = 0; i < 9; i++) { + compositeFilter.addFilter(new SingleColumnValueFilter(String.format("C%0254d", i), SingleColumnValueFilter.CompareOperator.EQUAL, columnValue)); + } + testFilterWithMaxNameLength(compositeFilter); + } + { + CompositeColumnValueFilter compositeFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.AND); + for (int i = 0; i < 9; i++) { + compositeFilter.addFilter(new SingleColumnValueFilter(String.format("C%0254d", i), SingleColumnValueFilter.CompareOperator.EQUAL, columnValue)); + } + testFilterWithMaxNameLength(compositeFilter); + } + } + + private void testFilterWithMaxNameLength(CompositeColumnValueFilter compositeFilter) { + ArrayList pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey primaryKey = new PrimaryKey(pks); + ColumnValue columnValue = ColumnValue.fromString(NewString(2 * 896, 'c')); + + List rows = new ArrayList(); + + // get row + { + + GetRowRequest request = new GetRowRequest(); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); + criteria.setPrimaryKey(primaryKey); + + criteria.setFilter(compositeFilter); + criteria.setMaxVersions(1); + request.setRowQueryCriteria(criteria); + + GetRowResponse Response = ots.getRow(request); + rows.add(Response.getRow()); + } + + // get range + { + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey begin = new PrimaryKey(pks); + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10))); + PrimaryKey end = new PrimaryKey(pks); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(begin); + criteria.setExclusiveEndPrimaryKey(end); + + criteria.setFilter(compositeFilter); + criteria.setMaxVersions(1); + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + GetRangeResponse Response = ots.getRange(request); + assertEquals(Response.getRows().size(), 1); + rows.add(Response.getRows().get(0)); + } + + // batch get row + { + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); + + criteria.addRow(primaryKey); + criteria.setFilter(compositeFilter); + criteria.setMaxVersions(1); + + BatchGetRowRequest request = new BatchGetRowRequest(); + request.addMultiRowQueryCriteria(criteria); + + BatchGetRowResponse Response = ots.batchGetRow(request); + assertTrue(Response.isAllSucceed()); + assertEquals(Response.getSucceedRows().size(), 1); + rows.add(Response.getSucceedRows().get(0).getRow()); + } + + for (Row row : rows) { + pks.clear(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0))); + PrimaryKey pk = new PrimaryKey(pks); + Column[] cols = new Column[128]; + for (int j = 0; j < 128; j++) { + cols[j] = new Column(String.format("C%0254d", j), ColumnValue.fromString(NewString(2 * 896, 'c'))); + } + Row expect = new Row(pk, cols); + checkRowNoTimestamp(expect, row); + } + } + + private String NewString(int length, char a) { + char[] cs = new char[length]; + for (int i = 0; i < cs.length; i++) { + cs[i] = a; + } + return new String(cs); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/UpdateRowTest.java b/src/test/java/com/alicloud/openservices/tablestore/model/UpdateRowTest.java new file mode 100644 index 0000000..c3d53cd --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/UpdateRowTest.java @@ -0,0 +1,252 @@ +package com.alicloud.openservices.tablestore.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Logger; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.alicloud.openservices.tablestore.SyncClientInterface; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.common.OTSHelper; +import com.alicloud.openservices.tablestore.common.Utils; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.google.gson.JsonSyntaxException; + +public class UpdateRowTest { + private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; + + private static final String tableName = "UpdateRowTest"; + private static SyncClientInterface client; + private static Logger LOG = Logger.getLogger(BatchWriteTest.class.getName()); + + @BeforeClass + public static void classBefore() throws JsonSyntaxException, IOException { + client = Utils.getOTSInstance(); + } + + @AfterClass + public static void classAfter() { + client.shutdown(); + } + + @Before + public void setup() throws Exception { + ListTableResponse r = client.listTable(); + for (String table: r.getTableNames()) { + DeleteTableRequest deleteTableRequest = new DeleteTableRequest(table); + client.deleteTable(deleteTableRequest); + LOG.info("Delete table: " + table); + + Thread.sleep(1000); + } + } + + private void CreateTable(SyncClientInterface ots, String tableName, Map pk) throws Exception { + OTSHelper.createTable(ots, tableName, pk); + LOG.info("Create table: " + tableName); + Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); + } + + /** + * 插入不存在的行,期望行存在性:IGNORE + * @throws Exception + */ + @Test + public void testUpdateNonExistRowWithIGnoreForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + columns.add(new Column("attr1", ColumnValue.fromString("hello world"))); + List deletes = new ArrayList(); + deletes.add("attr"); + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.IGNORE); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr1").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入不存在的行,期望行存在性:存在,抛错 + * @throws Exception + */ + @Test + public void testUpdateNonExistRowWithExpectExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + columns.add(new Column("attr1", ColumnValue.fromString("hello world"))); + List deletes = new ArrayList(); + deletes.add("attr"); + try { + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.EXPECT_EXIST); + assertTrue(false); + } catch (TableStoreException e) { + LOG.info(e.toString()); + assertEquals(ErrorCode.CONDITION_CHECK_FAIL, e.getErrorCode()); + } + } + + /** + * 插入不存在的行,期望行存在性:不存在 + * @throws Exception + */ + @Test + public void testUpdateExistRowWithExpectNonExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + columns.add(new Column("attr1", ColumnValue.fromString("hello world"))); + List deletes = new ArrayList(); + deletes.add("attr"); + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.EXPECT_NOT_EXIST); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr1").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入存在的行,期望行存在性:IGNORE + * @throws Exception + */ + @Test + public void testUpdateExistRowWithIGnoreForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + columns.add(new Column("attr1", ColumnValue.fromString("hello world"))); + List deletes = new ArrayList(); + deletes.add("attr"); + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.IGNORE); + + // 写入相同行 + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.IGNORE); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr1").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入存在的行,期望行存在性:存在 + * @throws Exception + */ + @Test + public void testUpdateExistRowWithExpectExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + columns.add(new Column("attr1", ColumnValue.fromString("hello world"))); + List deletes = new ArrayList(); + deletes.add("attr"); + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.IGNORE); + + // 写入相同行 + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.EXPECT_EXIST); + + SingleRowQueryCriteria query = new SingleRowQueryCriteria(tableName, pk); + query.setMaxVersions(1); + GetRowResponse response = OTSHelper.getRow(client, query); + Row row = response.getRow(); + assertEquals(row.getColumns().length, 1); + assertEquals(row.getColumn("attr1").get(0).getValue().asString(), "hello world"); + } + + /** + * 插入存在的行,期望行存在性:不存在,抛错 + * @throws Exception + */ + @Test + public void testUpdateNonExistRowWithExpectNonExistForInternal() throws Exception { + Map pks = new TreeMap(); + pks.put("PK1", PrimaryKeyType.STRING); + pks.put("PK2", PrimaryKeyType.INTEGER); + + CreateTable(client, tableName, pks); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("PK1", PrimaryKeyValue.fromString("haha")) + .addPrimaryKeyColumn("PK2", PrimaryKeyValue.fromLong(1234)) + .build(); + List columns = new ArrayList(); + columns.add(new Column("attr", ColumnValue.fromString("hello world"))); + columns.add(new Column("attr1", ColumnValue.fromString("hello world"))); + List deletes = new ArrayList(); + deletes.add("attr"); + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.IGNORE); + + // 写入相同行 + try { + OTSHelper.updateRow(client, tableName, pk, columns, deletes, null, RowExistenceExpectation.EXPECT_NOT_EXIST); + } catch (TableStoreException e) { + LOG.info(e.toString()); + assertEquals(ErrorCode.CONDITION_CHECK_FAIL, e.getErrorCode()); + } + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/filter/TestCompositeFilter.java b/src/test/java/com/alicloud/openservices/tablestore/model/filter/TestCompositeFilter.java new file mode 100644 index 0000000..7c1b85e --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/filter/TestCompositeFilter.java @@ -0,0 +1,37 @@ +package com.alicloud.openservices.tablestore.model.filter; + +import com.alicloud.openservices.tablestore.model.ColumnValue; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class TestCompositeFilter { + + @Test + public void testOperations() { + // col1 > 0 and (col2 = 1 or col3 < 2) + CompositeColumnValueFilter subFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + subFilter.addFilter(new SingleColumnValueFilter("col2", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(1))) + .addFilter(new SingleColumnValueFilter("col3", SingleColumnValueFilter.CompareOperator.LESS_THAN, ColumnValue.fromLong(2))); + + CompositeColumnValueFilter filter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.AND); + filter.addFilter(new SingleColumnValueFilter("col1", SingleColumnValueFilter.CompareOperator.GREATER_THAN, ColumnValue.fromLong(0))) + .addFilter(subFilter); + + assertEquals(filter.getOperationType(), CompositeColumnValueFilter.LogicOperator.AND); + assertEquals(filter.getFilterType(), FilterType.COMPOSITE_COLUMN_VALUE_FILTER); + assertEquals(filter.getSubFilters().size(), 2); + } + + @Test + public void testInvalidArguments() { + CompositeColumnValueFilter subFilter = new CompositeColumnValueFilter(CompositeColumnValueFilter.LogicOperator.OR); + try { + subFilter.addFilter(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/model/filter/TestSingleColumnValueFilter.java b/src/test/java/com/alicloud/openservices/tablestore/model/filter/TestSingleColumnValueFilter.java new file mode 100644 index 0000000..5794112 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/model/filter/TestSingleColumnValueFilter.java @@ -0,0 +1,92 @@ +package com.alicloud.openservices.tablestore.model.filter; + +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class TestSingleColumnValueFilter { + + @Test + public void testOperations() { + SingleColumnValueFilter filter = + new SingleColumnValueFilter("column", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false)); + assertEquals(filter.getColumnName(), "column"); + assertEquals(filter.getOperator(), SingleColumnValueFilter.CompareOperator.EQUAL); + assertEquals(filter.getColumnValue(), ColumnValue.fromBoolean(false)); + assertEquals(filter.getFilterType(), FilterType.SINGLE_COLUMN_VALUE_FILTER); + assertEquals(filter.isPassIfMissing(), true); + assertEquals(filter.isLatestVersionsOnly(), true); + + filter.setColumnName("another_column"); + assertEquals(filter.getColumnName(), "another_column"); + + filter.setColumnValue(ColumnValue.fromString("abcde")); + assertEquals(filter.getColumnValue(), ColumnValue.fromString("abcde")); + + filter.setOperator(SingleColumnValueFilter.CompareOperator.GREATER_EQUAL); + assertEquals(filter.getOperator(), SingleColumnValueFilter.CompareOperator.GREATER_EQUAL); + + filter.setPassIfMissing(true); + assertEquals(filter.isPassIfMissing(), true); + + filter.setLatestVersionsOnly(false); + assertEquals(filter.isLatestVersionsOnly(), false); + } + + @Test + public void testInvalidArguments() { + try { + new SingleColumnValueFilter("", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromString("a")); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new SingleColumnValueFilter("c", null, ColumnValue.fromString("a")); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + new SingleColumnValueFilter("c", SingleColumnValueFilter.CompareOperator.EQUAL, null); + fail(); + } catch (IllegalArgumentException e) { + + } + + SingleColumnValueFilter filter = + new SingleColumnValueFilter("column", SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromBoolean(false)); + try { + filter.setColumnName(""); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + filter.setColumnName(null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + filter.setColumnValue(null); + fail(); + } catch (IllegalArgumentException e) { + + } + + try { + filter.setOperator(null); + fail(); + } catch (IllegalArgumentException e) { + + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/smoketest/SmokeTest.java b/src/test/java/com/alicloud/openservices/tablestore/smoketest/SmokeTest.java new file mode 100644 index 0000000..acf7007 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/smoketest/SmokeTest.java @@ -0,0 +1,250 @@ +package com.alicloud.openservices.tablestore.smoketest; + +import java.util.ArrayList; +import java.util.List; + +import com.alicloud.openservices.tablestore.core.utils.DateUtil; +import com.alicloud.openservices.tablestore.ClientConfiguration; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; + +public class SmokeTest { + + static class Test { + private final Exception e; + + public Test(Exception e) { + this.e = e; + } + + public void a() throws Exception { + e.fillInStackTrace(); + throw e; + } + } + + public static void main(String[] args) throws Exception { + + Test t = new Test(new IllegalArgumentException("hello")); + //t.a(); + SyncClient ots = new SyncClient("endpoint", "access_key_id", "access_key_secret", "instance_name"); + + ClientConfiguration config = new ClientConfiguration(); + config.setRetryThreadCount(3); + config.setRetryStrategy(new RetryStrategy() { + @Override + public RetryStrategy clone() { + return this; + } + + @Override + public int getRetries() { + return 0; + } + + @Override + public long nextPause(String action, Exception ex) { + return 0; + } + }); + + try { + createTable(ots); + try { + listTable(ots); + describeTable(ots); + updateTable(ots); + + Thread.sleep(3000); + putRow(ots); + updateRow(ots); + getRow(ots); + deleteRow(ots); + getRange(ots); + batchWriteRow(ots); + batchGetRow(ots); + + //streamOperations(ots); + } finally { + deleteTable(ots); + } + } finally { + ots.shutdown(); + } + + } + + private static void batchGetRow(SyncClient ots) { + BatchGetRowRequest request = new BatchGetRowRequest(); + MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("HelloWorld"); + for (int i = 1; i < 20; i++) { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(i)).build(); + criteria.addRow(primaryKey); + } + criteria.setMaxVersions(1); + request.addMultiRowQueryCriteria(criteria); + BatchGetRowResponse response = ots.batchGetRow(request); + + System.out.println(response.getFailedRows().size()); + log(response.jsonize()); + } + + private static void listTable(SyncClient ots) { + log("ListTable"); + ListTableResponse response = ots.listTable(); + log(response.jsonize()); + } + + private static void describeTable(SyncClient ots) { + log("DescribeTable HelloWorld"); + DescribeTableRequest request = new DescribeTableRequest("HelloWorld"); + DescribeTableResponse response = ots.describeTable(request); + log(response.jsonize()); + } + + private static void updateTable(SyncClient ots) { + log("UpdateTable HelloWorld"); + UpdateTableRequest request = new UpdateTableRequest("HelloWorld"); + request.setTableOptionsForUpdate( + new TableOptions(86401, 3)); + UpdateTableResponse response = ots.updateTable(request); + log(response.jsonize()); + } + + private static void deleteRow(SyncClient ots) { + log("DeleteRow"); + DeleteRowRequest request = new DeleteRowRequest(); + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder(). + addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(100)).build(); + RowDeleteChange rowChange = new RowDeleteChange("HelloWorld", primaryKey); + request.setRowChange(rowChange); + DeleteRowResponse response = ots.deleteRow(request); + log(response.jsonize()); + } + + private static void createTable(SyncClient ots) { + log("CreateTable HelloWorld"); + TableMeta meta = new TableMeta("HelloWorld"); + meta.addPrimaryKeyColumn("PK0", PrimaryKeyType.INTEGER); + TableOptions opts = new TableOptions(); + opts.setMaxVersions(1); + opts.setTimeToLive(Integer.MAX_VALUE); + CreateTableRequest ct = new CreateTableRequest(meta, opts); + ct.setReservedThroughput(new ReservedThroughput(new CapacityUnit(0, 0))); + ots.createTable(ct); + } + + private static void deleteTable(SyncClient ots) { + log("DeleteTable HelloWorld"); + DeleteTableRequest dt = new DeleteTableRequest("HelloWorld"); + ots.deleteTable(dt); + } + + private static void batchWriteRow(SyncClient ots) { + String sv = "Hangzhou"; + BatchWriteRowRequest request = new BatchWriteRowRequest(); + for (int i = 1; i < 20; i++) { + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(i)).build(); + RowUpdateChange rowChange = new RowUpdateChange("HelloWorld", primaryKey); + rowChange.put(new Column("Column0", ColumnValue.fromString(sv))); + rowChange.put(new Column("Column1", ColumnValue.fromString(sv))); + rowChange.put(new Column("Column2", ColumnValue.fromString(sv))); + rowChange.put(new Column("Column3", ColumnValue.fromString(sv))); + rowChange.put(new Column("Column4", ColumnValue.fromString(sv))); + request.addRowChange(rowChange); + } + + BatchWriteRowResponse result = ots.batchWriteRow(request); + System.out.println(result.getFailedRows().size()); + System.out.println(result.getRequestId()); + } + + private static void getRange(SyncClient ots) { + GetRangeRequest request = new GetRangeRequest(); + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria("HelloWorld"); + + PrimaryKeyColumn[] pks = new PrimaryKeyColumn[1]; + pks[0] = new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); + PrimaryKey startKey = new PrimaryKey(pks); + criteria.setInclusiveStartPrimaryKey(startKey); + criteria.setMaxVersions(1000); + + pks = new PrimaryKeyColumn[1]; + pks[0] = new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(20)); + PrimaryKey endKey = new PrimaryKey(pks); + criteria.setExclusiveEndPrimaryKey(endKey); + SingleColumnValueFilter filter = new SingleColumnValueFilter("Hello", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(1)); + criteria.setFilter(filter); + criteria.setLimit(10); + request.setRangeRowQueryCriteria(criteria); + + GetRangeResponse result = ots.getRange(request); + for (Row row : result.getRows()) { + System.out.println(row); + } + + System.out.println("NextKey: " + result.getNextStartPrimaryKey()); + System.out.println("RowsCount: " + result.getRows().size()); + } + + private static void putRow(SyncClient ots) { + log("PutRow"); + for (int i = 0; i < 1; i++) { + PutRowRequest request = new PutRowRequest(); + List pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(i))); + PrimaryKey primaryKey = new PrimaryKey(pks); + RowPutChange rowChange = new RowPutChange("HelloWorld", primaryKey); + rowChange.addColumn("Hello", ColumnValue.fromLong(0), System.currentTimeMillis()); + rowChange.addColumn("Hello", ColumnValue.fromLong(0), System.currentTimeMillis() + 1); + rowChange.addColumn("World", ColumnValue.fromLong(0)); + request.setRowChange(rowChange); + + PutRowResponse response = ots.putRow(request); + log("PutRow" + i + " " + response.jsonize()); + } + } + + private static void updateRow(SyncClient ots) { + log("UpdateRow"); + UpdateRowRequest request = new UpdateRowRequest(); + List pks = new ArrayList(); + pks.add(new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(3))); + PrimaryKey primaryKey = new PrimaryKey(pks); + RowUpdateChange rowChange = new RowUpdateChange("HelloWorld", primaryKey); + rowChange.put("Hello", ColumnValue.fromLong(1)); + request.setRowChange(rowChange); + + UpdateRowResponse response = ots.updateRow(request); + log("UpdateRow " + response.jsonize()); + } + + private static void getRow(SyncClient ots) { + GetRowRequest request = new GetRowRequest(); + PrimaryKeyColumn[] pks = new PrimaryKeyColumn[1]; + pks[0] = new PrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(3)); + PrimaryKey primaryKey = new PrimaryKey(pks); + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria("HelloWorld", primaryKey); + //criteria.addColumnsToGet("PK0"); + criteria.setMaxVersions(10); + /* + SingleColumnValueCondition filter = new SingleColumnValueCondition("Hello", + SingleColumnValueCondition.CompareOperator.EQUAL, ColumnValue.fromLong(1)); + criteria.setFilter(filter); + */ + + request.setRowQueryCriteria(criteria); + GetRowResponse response = ots.getRow(request); + System.out.println(response.getRow()); + log("GetRow " + response.jsonize()); + } + + private static void log(String msg) { + System.out.println( + String.format("%s - %s", + DateUtil.getCurrentIso8601Date(), + msg)); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnel.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnel.java new file mode 100644 index 0000000..546a49a --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnel.java @@ -0,0 +1,113 @@ +package com.alicloud.openservices.tablestore.tunnel.functiontest; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.TunnelClient; +import com.alicloud.openservices.tablestore.model.tunnel.ChannelInfo; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelInfo; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelType; + +public class TestTunnel { + private static final String Endpoint = ""; + private static final String AccessId = ""; + private static final String AccessKey = ""; + private static final String InstanceName = ""; + + private static final String TableName = ""; + + public static void main(String[] args) { + TunnelClient client = new TunnelClient(Endpoint, AccessId, AccessKey, InstanceName); + try { + String tunnelName = "test_zr" + System.currentTimeMillis(); + + // create tunnel + System.out.println("Begin CreateTunnel"); + createTunnel(client, tunnelName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // list tunnel + System.out.println("Begin ListTunnel"); + listTunnel(client); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // smoke describe tunnel + System.out.println("Begin DescribeTunnel"); + describeTunnel(client, tunnelName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // delete tunnel + System.out.println("Begin DeleteTunnel"); + deleteTunnel(client, tunnelName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + } catch (TableStoreException e) { + e.printStackTrace(); + } catch (ClientException e) { + e.printStackTrace(); + } finally { + client.shutdown(); + } + } + + static void createTunnel(TunnelClient client, String tunnelName) { + CreateTunnelRequest request = new CreateTunnelRequest(TableName, tunnelName, TunnelType.BaseData); + CreateTunnelResponse resp = client.createTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + System.out.println("TunnelId: " + resp.getTunnelId()); + } + + static void listTunnel(TunnelClient client) { + ListTunnelRequest request = new ListTunnelRequest(TableName); + ListTunnelResponse resp = client.listTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + for (TunnelInfo info : resp.getTunnelInfos()) { + System.out.println("TunnelInfo::::::"); + System.out.println("\tTunnelName: " + info.getTunnelName()); + System.out.println("\tTunnelId: " + info.getTunnelId()); + System.out.println("\tTunnelType: " + info.getTunnelType()); + System.out.println("\tTableName: " + info.getTableName()); + System.out.println("\tInstanceName: " + info.getInstanceName()); + System.out.println("\tStage: " + info.getStage()); + System.out.println("\tExpired: " + info.isExpired()); + } + } + + static void describeTunnel(TunnelClient client, String tunnelName) { + DescribeTunnelRequest request = new DescribeTunnelRequest(TableName, tunnelName); + DescribeTunnelResponse resp = client.describeTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + System.out.println("TunnelRpo: " + resp.getTunnelRpo() + "ms"); + System.out.println("TunnelConsumePoint: " + resp.getTunnelConsumePoint()); + System.out.println("TunnelInfo::::::"); + TunnelInfo ti = resp.getTunnelInfo(); + System.out.println("\tTunnelName: " + ti.getTunnelName()); + System.out.println("\tTunnelId: " + ti.getTunnelId()); + System.out.println("\tTunnelType: " + ti.getTunnelType()); + System.out.println("\tTableName: " + ti.getTableName()); + System.out.println("\tInstanceName: " + ti.getInstanceName()); + System.out.println("\tStage: " + ti.getStage()); + System.out.println("\tExpired: " + ti.isExpired()); + for (ChannelInfo ci : resp.getChannelInfos()) { + System.out.println("ChannelInfo::::::"); + System.out.println("\tChannelId: " + ci.getChannelId()); + System.out.println("\tChannelType: " + ci.getChannelType()); + System.out.println("\tClientId: " + ci.getClientId()); + System.out.println("\tChannelRpo: " + ci.getChannelRpo() + "ms"); + System.out.println("\tChannelConsumePoint: " + ci.getChannelConsumePoint()); + } + + } + + static void deleteTunnel(TunnelClient client, String tunnelName) { + DeleteTunnelRequest request = new DeleteTunnelRequest(TableName, tunnelName); + DeleteTunnelResponse resp = client.deleteTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelLiveTail.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelLiveTail.java new file mode 100644 index 0000000..b60885f --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelLiveTail.java @@ -0,0 +1,242 @@ +package com.alicloud.openservices.tablestore.tunnel.functiontest; + +import java.util.ArrayList; +import java.util.List; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.TunnelClient; +import com.alicloud.openservices.tablestore.model.Column; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.CreateTableRequest; +import com.alicloud.openservices.tablestore.model.DeleteTableRequest; +import com.alicloud.openservices.tablestore.model.PrimaryKey; +import com.alicloud.openservices.tablestore.model.PrimaryKeyBuilder; +import com.alicloud.openservices.tablestore.model.PrimaryKeyType; +import com.alicloud.openservices.tablestore.model.PrimaryKeyValue; +import com.alicloud.openservices.tablestore.model.PutRowRequest; +import com.alicloud.openservices.tablestore.model.RecordColumn.ColumnType; +import com.alicloud.openservices.tablestore.model.RowPutChange; +import com.alicloud.openservices.tablestore.model.StreamRecord; +import com.alicloud.openservices.tablestore.model.TableMeta; +import com.alicloud.openservices.tablestore.model.TableOptions; +import com.alicloud.openservices.tablestore.model.tunnel.ChannelInfo; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelInfo; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelType; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; + +import static org.junit.Assert.assertEquals; + +public class TestTunnelLiveTail { + private static final String Endpoint = ""; + private static final String AccessId = ""; + private static final String AccessKey = ""; + private static final String InstanceName = ""; + + public static void main(String[] args) { + TunnelClient tunnelClient = new TunnelClient(Endpoint, AccessId, AccessKey, InstanceName); + SyncClient syncClient = new SyncClient(Endpoint, AccessId, AccessKey, InstanceName); + + String tableName = "test_zr" + System.currentTimeMillis(); + String tunnelName = "test_zr" + System.currentTimeMillis(); + + try { + // 1. create table + System.out.println("Begin Create Table: " + tableName); + createTable(syncClient, tableName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // 2. create tunnel + System.out.println("Begin Create Tunnel: " + tunnelName); + createTunnel(tunnelClient, tableName, tunnelName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // 3. put data + System.out.println("Begin Put Data"); + List expectChanges = putRows(syncClient, tableName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + System.out.println("Waiting............................"); + Thread.sleep(5000); + + // 4. describe tunnel + System.out.println("Begin Describe Tunnel: " + tunnelName); + DescribeTunnelResponse describeTunnelResponse = describeTunnel(tunnelClient, tableName, tunnelName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // 5. get checkpoint + System.out.println("Begin GetCheckpoint"); + TunnelInfo tunnelInfo = describeTunnelResponse.getTunnelInfo(); + for (ChannelInfo channelInfo : describeTunnelResponse.getChannelInfos()) { + GetCheckpointResponse getCheckpointResponse = + getcheckpoint(tunnelClient, tunnelInfo.getTunnelId(), channelInfo.getClientId(), + channelInfo.getChannelId()); + // 6. read some records + System.out.println("Begin Read Records"); + ReadRecordsRequest request = new ReadRecordsRequest(tunnelInfo.getTunnelId(), channelInfo.getClientId(), + channelInfo.getChannelId(), getCheckpointResponse.getCheckpoint()); + ReadRecordsResponse resp = tunnelClient.readRecords(request); + for (int count = 1; count < 5; count++) { + for (int i = 0; i < resp.getRecords().size(); i++) { + // check primarykey + StreamRecord record = resp.getRecords().get(i); + RowPutChange expectChange = expectChanges.get(i); + PrimaryKey pk = record.getPrimaryKey(); + assertEquals(expectChange.getPrimaryKey().size(), pk.size()); + assertEquals(expectChange.getPrimaryKey().getPrimaryKeyColumn(0), pk.getPrimaryKeyColumn(0)); + assertEquals(expectChange.getPrimaryKey().getPrimaryKeyColumn(1), pk.getPrimaryKeyColumn(1)); + // check column + assertEquals(expectChange.getColumnsToPut().size(), record.getColumns().size()); + for (int j = 0; j < record.getColumns().size(); j++) { + assertEquals(ColumnType.PUT, record.getColumns().get(j).getColumnType()); + assertEquals(expectChange.getColumnsToPut().get(j).getName(), record.getColumns().get(j) + .getColumn().getName()); + assertEquals(expectChange.getColumnsToPut().get(j).getValue(), record.getColumns().get(j) + .getColumn().getValue()); + } + } + System.out.println(resp.getRecords()); + System.out.println(resp.getNextToken()); + System.out.println("++++++++++++++++++++++++++++++++++++"); + if (resp.getNextToken() == null) { + break; + } + request.setToken(resp.getNextToken()); + Thread.sleep(2000); + resp = tunnelClient.readRecords(request); + System.out.println("Continue Read Records, Round: " + count); + } + + } + System.out.println("++++++++++++++++++++++++++++++++++++"); + + } catch (TableStoreException e) { + e.printStackTrace(); + } catch (ClientException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + // 7. delete tunnel + System.out.println("Begin Delete Tunnel: " + tunnelName); + deleteTunnel(tunnelClient, tableName, tunnelName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // 8. delete table + System.out.println("Begin Delete Table: " + tableName); + deleteTable(syncClient, tableName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + syncClient.shutdown(); + tunnelClient.shutdown(); + } + } + + static void createTunnel(TunnelClient client, String tableName, String tunnelName) { + CreateTunnelRequest request = new CreateTunnelRequest(tableName, tunnelName, TunnelType.Stream); + CreateTunnelResponse resp = client.createTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + System.out.println("TunnelId: " + resp.getTunnelId()); + } + + static void createTable(SyncClient client, String tableName) { + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumn("int", PrimaryKeyType.INTEGER); + meta.addPrimaryKeyColumn("str", PrimaryKeyType.STRING); + CreateTableRequest request = new CreateTableRequest(meta, new TableOptions(-1, 1)); + client.createTable(request); + + } + + static void deleteTable(SyncClient client, String tableName) { + DeleteTableRequest request = new DeleteTableRequest(tableName); + client.deleteTable(request); + } + + static List putRows(SyncClient client, String tableName) { + List changes = new ArrayList(); + for (int i = 0; i < 1000; i++) { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("int", PrimaryKeyValue.fromLong(i)); + primaryKeyBuilder.addPrimaryKeyColumn("str", PrimaryKeyValue.fromString("string" + i)); + RowPutChange rowPutChange = new RowPutChange(tableName, primaryKeyBuilder.build()); + + for (int j = 0; j < 10; j++) { + rowPutChange.addColumn(new Column("test" + j, ColumnValue.fromLong(i))); + } + client.putRow(new PutRowRequest(rowPutChange)); + changes.add(rowPutChange); + } + System.out.println("Put 1000 rows succeed."); + return changes; + } + + static void listTunnel(TunnelClient client, String tableName) { + ListTunnelRequest request = new ListTunnelRequest(tableName); + ListTunnelResponse resp = client.listTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + for (TunnelInfo info : resp.getTunnelInfos()) { + System.out.println("TunnelInfo::::::"); + System.out.println("\tTunnelName: " + info.getTunnelName()); + System.out.println("\tTunnelId: " + info.getTunnelId()); + System.out.println("\tTunnelType: " + info.getTunnelType()); + System.out.println("\tTableName: " + info.getTableName()); + System.out.println("\tInstanceName: " + info.getInstanceName()); + System.out.println("\tStage: " + info.getStage()); + System.out.println("\tExpired: " + info.isExpired()); + } + } + + static DescribeTunnelResponse describeTunnel(TunnelClient client, String tableName, String tunnelName) { + DescribeTunnelRequest request = new DescribeTunnelRequest(tableName, tunnelName); + DescribeTunnelResponse resp = client.describeTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + System.out.println("TunnelRpo: " + resp.getTunnelRpo() + "ms"); + System.out.println("TunnelConsumePoint: " + resp.getTunnelConsumePoint()); + System.out.println("TunnelInfo::::::"); + TunnelInfo ti = resp.getTunnelInfo(); + System.out.println("\tTunnelName: " + ti.getTunnelName()); + System.out.println("\tTunnelId: " + ti.getTunnelId()); + System.out.println("\tTunnelType: " + ti.getTunnelType()); + System.out.println("\tTableName: " + ti.getTableName()); + System.out.println("\tInstanceName: " + ti.getInstanceName()); + System.out.println("\tStage: " + ti.getStage()); + System.out.println("\tExpired: " + ti.isExpired()); + System.out.println("ChannelInfos::::::"); + for (ChannelInfo ci : resp.getChannelInfos()) { + System.out.println("\tChannelId: " + ci.getChannelId()); + System.out.println("\tChannelType: " + ci.getChannelType()); + System.out.println("\tClientId: " + ci.getClientId()); + System.out.println("\tChannelRpo: " + ci.getChannelRpo() + "ms"); + System.out.println("\tChannelConsumePoint: " + ci.getChannelConsumePoint()); + System.out.println("\tChannelCount: " + ci.getChannelCount()); + } + return resp; + } + + static void deleteTunnel(TunnelClient client, String tableName, String tunnelName) { + DeleteTunnelRequest request = new DeleteTunnelRequest(tableName, tunnelName); + DeleteTunnelResponse resp = client.deleteTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + } + + static GetCheckpointResponse getcheckpoint(TunnelClient client, String tunnelId, String clientId, + String channelId) { + GetCheckpointRequest request = new GetCheckpointRequest(tunnelId, clientId, channelId); + GetCheckpointResponse resp = client.getCheckpoint(request); + System.out.println("Checkpoint: " + resp.getCheckpoint()); + System.out.println("SequenceNumber: " + resp.getSequenceNumber()); + return resp; + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorker.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorker.java new file mode 100644 index 0000000..0f0d1ca --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorker.java @@ -0,0 +1,61 @@ +package com.alicloud.openservices.tablestore.tunnel.functiontest; + +import com.alicloud.openservices.tablestore.TunnelClient; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.ProcessRecordsInput; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorker; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorkerConfig; + +public class TestTunnelWorker { + private static final String Endpoint = ""; + private static final String AccessId = ""; + private static final String AccessKey = ""; + private static final String InstanceName = ""; + + static class SimpleProcessor implements IChannelProcessor { + @Override + public void process(ProcessRecordsInput input) { + System.out.println("Default record processor, would print records count"); + System.out.println( + String.format("Process %d records, NextToken: %s", input.getRecords().size(), input.getNextToken())); + try { + // Mock Record Process. + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + public void shutdown() { + System.out.println("Mock shutdown"); + } + } + + public static void main(String[] args) { + TunnelClient client = new TunnelClient(Endpoint, AccessId, AccessKey, InstanceName); + TunnelWorkerConfig config = new TunnelWorkerConfig(new SimpleProcessor()); + TunnelWorker worker = new TunnelWorker("480e3a3b-6672-46b1-b970-e611232dcd53", client, config); + try { + System.out.println("worker running...."); + worker.connectAndWorking(); + Thread.sleep(50000); + worker.shutdown(); + System.out.println("worker shutdown...."); + } catch (Exception e) { + e.printStackTrace(); + worker.shutdown(); + } + + // Reconstruct and connect. + TunnelWorker worker2 = new TunnelWorker("480e3a3b-6672-46b1-b970-e611232dcd53", client, config); + try { + System.out.println("worker2 running..."); + worker2.connectAndWorking(); + } catch (Exception e) { + e.printStackTrace(); + worker2.shutdown(); + client.shutdown(); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerReconnect.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerReconnect.java new file mode 100644 index 0000000..d504fa4 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerReconnect.java @@ -0,0 +1,172 @@ +package com.alicloud.openservices.tablestore.tunnel.functiontest; + +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TunnelClient; +import com.alicloud.openservices.tablestore.model.Column; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.CreateTableRequest; +import com.alicloud.openservices.tablestore.model.DeleteTableRequest; +import com.alicloud.openservices.tablestore.model.PrimaryKeyBuilder; +import com.alicloud.openservices.tablestore.model.PrimaryKeyType; +import com.alicloud.openservices.tablestore.model.PrimaryKeyValue; +import com.alicloud.openservices.tablestore.model.PutRowRequest; +import com.alicloud.openservices.tablestore.model.RowPutChange; +import com.alicloud.openservices.tablestore.model.TableMeta; +import com.alicloud.openservices.tablestore.model.TableOptions; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelType; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.ProcessRecordsInput; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorker; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorkerConfig; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestTunnelWorkerReconnect { + private static final String CONF_PATH = "tunnel.config"; + private static String endpoint = ""; + private static String accessId = ""; + private static String accessKey = ""; + private static String instanceName = ""; + + @BeforeClass + public static void loadConfig() { + System.out.println("here"); + try { + Properties properties = new Properties(); + properties.load(new FileInputStream(CONF_PATH)); + endpoint = properties.getProperty("OtsEndpoint"); + accessId = properties.getProperty("AccessId"); + accessKey = properties.getProperty("AccessKey"); + instanceName = properties.getProperty("InstanceName"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + class SimpleProcessor implements IChannelProcessor { + @Override + public void process(ProcessRecordsInput input) { + System.out.println("Default record processor, would print records count"); + System.out.println( + String.format("Process %d records, NextToken: %s", input.getRecords().size(), input.getNextToken())); + try { + // Mock Record Process. + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + public void shutdown() { + System.out.println("Mock shutdown"); + } + } + + static void createTunnel(TunnelClient client, String tableName, String tunnelName) { + CreateTunnelRequest request = new CreateTunnelRequest(tableName, tunnelName, TunnelType.Stream); + CreateTunnelResponse resp = client.createTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + System.out.println("TunnelId: " + resp.getTunnelId()); + } + + static void createTable(SyncClient client, String tableName) { + TableMeta meta = new TableMeta(tableName); + meta.addPrimaryKeyColumn("int", PrimaryKeyType.INTEGER); + meta.addPrimaryKeyColumn("str", PrimaryKeyType.STRING); + CreateTableRequest request = new CreateTableRequest(meta, new TableOptions(-1, 1)); + client.createTable(request); + + } + + static void deleteTable(SyncClient client, String tableName) { + DeleteTableRequest request = new DeleteTableRequest(tableName); + client.deleteTable(request); + } + + static List putRows(SyncClient client, String tableName, int rowCount) { + List changes = new ArrayList(); + for (int i = 0; i < rowCount; i++) { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn("int", PrimaryKeyValue.fromLong(i)); + primaryKeyBuilder.addPrimaryKeyColumn("str", PrimaryKeyValue.fromString("string" + i)); + RowPutChange rowPutChange = new RowPutChange(tableName, primaryKeyBuilder.build()); + + for (int j = 0; j < 10; j++) { + rowPutChange.addColumn(new Column("test" + j, ColumnValue.fromLong(i))); + } + client.putRow(new PutRowRequest(rowPutChange)); + changes.add(rowPutChange); + } + System.out.println(String.format("Put %d rows succeed.", rowCount)); + return changes; + } + + static void deleteTunnel(TunnelClient client, String tableName, String tunnelName) { + DeleteTunnelRequest request = new DeleteTunnelRequest(tableName, tunnelName); + DeleteTunnelResponse resp = client.deleteTunnel(request); + System.out.println("RequestId: " + resp.getRequestId()); + } + + @Test + public void testTunnelWorkerReconnect_WithTunnelInvalid() { + TunnelClient tunnelClient = new TunnelClient(endpoint, accessId, accessKey, instanceName); + SyncClient syncClient = new SyncClient(endpoint, accessId, accessKey, instanceName); + + String tableName = "test_zr" + System.currentTimeMillis(); + String tunnelName = "test_zr" + System.currentTimeMillis(); + // 1. create table + System.out.println("Begin Create Table: " + tableName); + createTable(syncClient, tableName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // 2. create tunnel + System.out.println("Begin Create Tunnel: " + tunnelName); + CreateTunnelResponse resp = tunnelClient.createTunnel( + new CreateTunnelRequest(tableName, tunnelName, TunnelType.Stream)); + String tunnelId = resp.getTunnelId(); + System.out.println("Create Tunnel, Id: " + tunnelId); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // 3. put data + System.out.println("Begin Put Data in backend."); + putRows(syncClient, tableName, 5000); + System.out.println("++++++++++++++++++++++++++++++++++++"); + + // 4. new tunnel worker and consume. + TunnelWorkerConfig config = new TunnelWorkerConfig(new SimpleProcessor()); + TunnelWorker worker = new TunnelWorker(tunnelId, tunnelClient, config); + try { + worker.connectAndWorking(); + Thread.sleep(50000); + System.out.println("Begin Delete Tunnel: " + tunnelName); + deleteTunnel(tunnelClient, tableName, tunnelName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + Thread.sleep(50000); + // cannot achieve here. + Assert.fail(); + } catch (Exception e) { + e.printStackTrace(); + worker.shutdown(); + } finally { + // delete table + System.out.println("Begin Delete Table: " + tableName); + deleteTable(syncClient, tableName); + System.out.println("++++++++++++++++++++++++++++++++++++"); + worker.shutdown(); + syncClient.shutdown(); + tunnelClient.shutdown(); + } + } + +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerSimplePerf.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerSimplePerf.java new file mode 100644 index 0000000..062fa47 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/functiontest/TestTunnelWorkerSimplePerf.java @@ -0,0 +1,74 @@ +package com.alicloud.openservices.tablestore.tunnel.functiontest; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; + +import com.alicloud.openservices.tablestore.TunnelClient; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.ProcessRecordsInput; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorker; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorkerConfig; +import com.google.gson.Gson; + +public class TestTunnelWorkerSimplePerf { + private static final String Endpoint = ""; + private static final String AccessId = ""; + private static final String AccessKey = ""; + private static final String InstanceName = ""; + + private static class PerfElement { + long timestamp; + long speed; + long totalCount; + + public PerfElement(long timestamp, long speed, long totalCount) { + this.timestamp = timestamp; + this.speed = speed; + this.totalCount = totalCount; + } + } + + private static final Gson GSON = new Gson(); + private static final int CAL_INTERVAL_MILLIS = 5000; + static class PerfProcessor implements IChannelProcessor { + private static final AtomicLong counter = new AtomicLong(0); + private static final AtomicLong latestTs = new AtomicLong(0); + private static final AtomicLong allCount = new AtomicLong(0); + + @Override + public void process(ProcessRecordsInput input) { + counter.addAndGet(input.getRecords().size()); + allCount.addAndGet(input.getRecords().size()); + if (System.currentTimeMillis() - latestTs.get() > CAL_INTERVAL_MILLIS) { + synchronized (PerfProcessor.class) { + if (System.currentTimeMillis() - latestTs.get() > CAL_INTERVAL_MILLIS) { + long seconds = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - latestTs.get()); + PerfElement element = new PerfElement(System.currentTimeMillis(), counter.get() / seconds, allCount.get()); + System.out.println(GSON.toJson(element)); + counter.set(0); + latestTs.set(System.currentTimeMillis()); + } + } + } + } + + @Override + public void shutdown() { + System.out.println("Mock shutdown"); + } + } + + public static void main(String[] args) { + TunnelClient client = new TunnelClient(Endpoint, AccessId, AccessKey, InstanceName); + TunnelWorkerConfig config = new TunnelWorkerConfig(new PerfProcessor()); + config.setHeartbeatIntervalInSec(15); + TunnelWorker worker = new TunnelWorker("265c97a9-2c41-4cb5-abdf-8b9966c4f0b8", client, config); + try { + worker.connectAndWorking(); + } catch (Exception e) { + e.printStackTrace(); + worker.shutdown(); + client.shutdown(); + } + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockBadChannelProcessor.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockBadChannelProcessor.java new file mode 100644 index 0000000..0493d93 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockBadChannelProcessor.java @@ -0,0 +1,22 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.ProcessRecordsInput; + +public class MockBadChannelProcessor implements IChannelProcessor { + @Override + public void process(ProcessRecordsInput input) { + System.out.println("Mock bad process"); + try { + Thread.sleep(200); + } catch (Exception e) { + System.out.println(e.getCause() + ":" + e.getMessage()); + } + throw new RuntimeException("mock bad process"); + } + + @Override + public void shutdown() { + System.out.println("Mock shutdown"); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelDialer.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelDialer.java new file mode 100644 index 0000000..0ba1f08 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelDialer.java @@ -0,0 +1,19 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelConnect; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelDialer; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelStateMachine; + +public class MockChannelDialer implements IChannelDialer { + @Override + public IChannelConnect channelDial(String tunnelId, String clientId, String channelId, String token, + IChannelProcessor processor, TunnelStateMachine state) { + return null; + } + + @Override + public void shutdown() { + + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessor.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessor.java new file mode 100644 index 0000000..3d81c01 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessor.java @@ -0,0 +1,21 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.ProcessRecordsInput; + +public class MockChannelProcessor implements IChannelProcessor { + @Override + public void process(ProcessRecordsInput input) { + System.out.println("Mock process"); + try { + Thread.sleep(200); + } catch (Exception e) { + System.out.println(e.getCause() + ":" + e.getMessage()); + } + } + + @Override + public void shutdown() { + System.out.println("Mock shutdown"); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessorFactory.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessorFactory.java new file mode 100644 index 0000000..5f7601b --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockChannelProcessorFactory.java @@ -0,0 +1,19 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessorFactory; +import com.alicloud.openservices.tablestore.tunnel.worker.ICheckpointer; + + +public class MockChannelProcessorFactory implements IChannelProcessorFactory { + public static final String BAD_CHANNEL_ID = "cid-bad"; + + @Override + public IChannelProcessor createProcessor(String tunnelId, String clientId, String channelId, + ICheckpointer checkpointer) { + if (BAD_CHANNEL_ID.equals(channelId)) { + return new MockBadChannelProcessor(); + } + return new MockChannelProcessor(); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockTunnelClient.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockTunnelClient.java new file mode 100644 index 0000000..7a6d4b5 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/MockTunnelClient.java @@ -0,0 +1,127 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.TunnelClientInterface; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.model.Column; +import com.alicloud.openservices.tablestore.model.ColumnValue; +import com.alicloud.openservices.tablestore.model.PrimaryKey; +import com.alicloud.openservices.tablestore.model.PrimaryKeyColumn; +import com.alicloud.openservices.tablestore.model.PrimaryKeyValue; +import com.alicloud.openservices.tablestore.model.RecordColumn; +import com.alicloud.openservices.tablestore.model.StreamRecord; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DeleteTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.DescribeTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.ListTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.CheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ConnectTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.GetCheckpointResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.HeartbeatResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ReadRecordsResponse; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.internal.ShutdownTunnelResponse; +import com.google.gson.Gson; + +import static com.alicloud.openservices.tablestore.core.protocol.ResponseFactory.FINISH_TAG; + +public class MockTunnelClient implements TunnelClientInterface { + @Override + public CreateTunnelResponse createTunnel(CreateTunnelRequest request) throws TableStoreException, ClientException { + return null; + } + + @Override + public ListTunnelResponse listTunnel(ListTunnelRequest request) throws TableStoreException, ClientException { + return null; + } + + @Override + public DescribeTunnelResponse describeTunnel(DescribeTunnelRequest request) + throws TableStoreException, ClientException { + return null; + } + + @Override + public DeleteTunnelResponse deleteTunnel(DeleteTunnelRequest request) throws TableStoreException, ClientException { + return null; + } + + @Override + public ConnectTunnelResponse connectTunnel(ConnectTunnelRequest request) + throws TableStoreException, ClientException { + return null; + } + + @Override + public HeartbeatResponse heartbeat(HeartbeatRequest request) throws TableStoreException, ClientException { + return null; + } + + @Override + public ShutdownTunnelResponse shutdownTunnel(ShutdownTunnelRequest request) + throws TableStoreException, ClientException { + return null; + } + + @Override + public GetCheckpointResponse getCheckpoint(GetCheckpointRequest request) + throws TableStoreException, ClientException { + if (request.getChannelId().contains("getCheckpointFailed")) { + throw new TableStoreException("get checkpoint failed", ErrorCode.INVALID_PARAMETER); + } + GetCheckpointResponse resp = new GetCheckpointResponse(); + resp.setCheckpoint("token"); + resp.setSequenceNumber(1); + return resp; + } + + public static volatile List finishedChannels = new ArrayList(); + @Override + public ReadRecordsResponse readRecords(ReadRecordsRequest request) throws TableStoreException, ClientException { + ReadRecordsResponse resp = new ReadRecordsResponse(); + List recordList = new ArrayList(); + for (int i = 0; i < 100; i++) { + StreamRecord record = new StreamRecord(); + record.setRecordType(StreamRecord.RecordType.PUT); + record.setPrimaryKey(new PrimaryKey(Arrays.asList(new PrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(i))))); + record.setColumns(Arrays.asList(new RecordColumn(new Column("col", ColumnValue.fromLong(i), i), RecordColumn.ColumnType.PUT))); + recordList.add(record); + } + resp.setRecords(recordList); + if (finishedChannels.contains(request.getChannelId())) { + resp.setNextToken(FINISH_TAG); + } else { + resp.setNextToken("token"); + } + resp.setMemoizedSerializedSize(102400); + return resp; + } + + @Override + public CheckpointResponse checkpoint(CheckpointRequest request) throws TableStoreException, ClientException { + return null; + } + + @Override + public void shutdown() { + + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestChannelConnect.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestChannelConnect.java new file mode 100644 index 0000000..371b658 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestChannelConnect.java @@ -0,0 +1,359 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; + +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelConnect; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelConnectStatus; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelDialer; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelStateMachine; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorkerConfig; +import junit.framework.TestCase; +import org.junit.Assert; + +public class TestChannelConnect extends TestCase { + private static final String TUNNEL_ID = "test-tunnel-id-zr"; + private static final String CLIENT_ID = "test-client-id-zr"; + + private static final String CHANNEL_ID = "test-channel-id-zr"; + private static final int SLEEP_MILLIS = 2000; + + private ChannelConnect channelConnect; + private TunnelWorkerConfig config; + private ChannelDialer channelDialer; + + @Override + protected void setUp() throws Exception { + config = new TunnelWorkerConfig(new MockChannelProcessor()); + config.setReadRecordsExecutor((ThreadPoolExecutor)Executors.newFixedThreadPool(1)); + config.setProcessRecordsExecutor((ThreadPoolExecutor)Executors.newFixedThreadPool(1)); + channelDialer = new ChannelDialer(new MockTunnelClient(), config); + channelConnect = (ChannelConnect)channelDialer.channelDial(TUNNEL_ID, CLIENT_ID, CHANNEL_ID, "token", + config.getChannelProcessor(), new TunnelStateMachine(TUNNEL_ID, CLIENT_ID, channelDialer, + new MockChannelProcessorFactory(), new MockTunnelClient())); + } + + @Override + protected void tearDown() throws Exception { + config.shutdown(); + config = null; + channelConnect.close(); + channelConnect = null; + channelDialer.shutdown(); + } + + private void sleepGrace() { + try { + Thread.sleep(SLEEP_MILLIS); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void testChannelConnect_NotifyStatus_NilWithOpen() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.OPEN); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.OPEN, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.RUNNING, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_NilWithClose() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_NilWithClosing() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_NilWithTerminated() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.TERMINATED); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosedWithClosed() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosedWithClosing() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosedWithOpen() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosedWithTerminated() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosingWithClose() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 0, ChannelStatus.OPEN)); + sleepGrace(); + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosingWithClosing() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 0, ChannelStatus.OPEN)); + sleepGrace(); + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosingWithOpen() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 0, ChannelStatus.OPEN)); + sleepGrace(); + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING)); + System.out.println(channelConnect); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN); + channelConnect.notifyStatus(channel); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosingWithTerminated() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 0, ChannelStatus.OPEN)); + sleepGrace(); + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED); + channelConnect.notifyStatus(channel); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_ClosingWithClosingOld() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 0, ChannelStatus.OPEN)); + sleepGrace(); + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING)); + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(2, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_OpenWithClose() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_OpenWithClosing() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSING, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSING, channelConnect.getStatus()); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_OpenWithOpen() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.OPEN, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.RUNNING, channelConnect.getStatus()); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.OPEN, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.RUNNING, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_OpenWithTerminated() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_OpenWithClosingOld() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN)); + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.OPEN, retChannel.getStatus()); + Assert.assertEquals(1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.RUNNING, channelConnect.getStatus()); + sleepGrace(); + channelConnect.checkAndUpdateChannelStatus(); + retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.OPEN, retChannel.getStatus()); + Assert.assertEquals(1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.RUNNING, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_TerminatedWithClose() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_TerminatedWithClosing() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_TerminatedWithOpen() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_TerminatedWithTerminated() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } + + public void testChannelConnect_NotifyStatus_TerminatedWithClosingOld() { + channelConnect.notifyStatus(new Channel(CHANNEL_ID, 1, ChannelStatus.TERMINATED)); + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertEquals(ChannelConnectStatus.CLOSED, channelConnect.getStatus()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestFailedChannelConnect.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestFailedChannelConnect.java new file mode 100644 index 0000000..1849279 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestFailedChannelConnect.java @@ -0,0 +1,149 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; + +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelDialer; +import com.alicloud.openservices.tablestore.tunnel.worker.FailedChannelConnect; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelStateMachine; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorkerConfig; +import junit.framework.TestCase; +import org.junit.Assert; + +public class TestFailedChannelConnect extends TestCase { + private static final String TUNNEL_ID = "test-tunnel-id-zr"; + private static final String CLIENT_ID = "test-client-id-zr"; + + private static final String CHANNEL_ID = "test-channel-id-zr"; + + private FailedChannelConnect channelConnect; + private TunnelWorkerConfig config; + private ChannelDialer channelDialer; + + @Override + protected void setUp() throws Exception { + config = new TunnelWorkerConfig(new MockChannelProcessor()); + config.setReadRecordsExecutor((ThreadPoolExecutor)Executors.newFixedThreadPool(1)); + config.setProcessRecordsExecutor((ThreadPoolExecutor)Executors.newFixedThreadPool(1)); + channelDialer = new ChannelDialer(new MockTunnelClient(), config); + channelConnect = new FailedChannelConnect(new TunnelStateMachine(TUNNEL_ID, CLIENT_ID, channelDialer, + new MockChannelProcessorFactory(), new MockTunnelClient())); + } + + @Override + protected void tearDown() throws Exception { + config.shutdown(); + config = null; + channelConnect.close(); + channelConnect = null; + channelDialer.shutdown(); + } + + public void testFailConn_NotifyStatus_NilWithOpen() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.OPEN); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_NilWithClosing() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_NilWithClosed() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_NilWithTerminated() { + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.TERMINATED); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_CloseWithClosing() { + channelConnect.setCurrentChannel(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSING); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_CloseWithOpen() { + channelConnect.setCurrentChannel(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.OPEN); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion() + 1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_CloseWithCloseNewVersion() { + channelConnect.setCurrentChannel(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 2, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_CloseWithCloseSameVersion() { + channelConnect.setCurrentChannel(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_CloseWithTerminated() { + channelConnect.setCurrentChannel(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 2, ChannelStatus.TERMINATED); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.TERMINATED, retChannel.getStatus()); + Assert.assertEquals(channel.getVersion(), retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } + + public void testFailConn_NotifyStatus_CloseWithCloseOldVersion() { + channelConnect.setCurrentChannel(new Channel(CHANNEL_ID, 1, ChannelStatus.CLOSE)); + Channel channel = new Channel(CHANNEL_ID, 0, ChannelStatus.CLOSE); + channelConnect.notifyStatus(channel); + Channel retChannel = channelConnect.getCurrentChannel(); + Assert.assertEquals(ChannelStatus.CLOSE, retChannel.getStatus()); + Assert.assertEquals(1, retChannel.getVersion()); + Assert.assertEquals(channel.getChannelId(), retChannel.getChannelId()); + Assert.assertTrue(channelConnect.closed()); + } +} diff --git a/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestTunnelStateMachine.java b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestTunnelStateMachine.java new file mode 100644 index 0000000..1b4c2fd --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/tunnel/unittest/TestTunnelStateMachine.java @@ -0,0 +1,231 @@ +package com.alicloud.openservices.tablestore.tunnel.unittest; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; + +import com.alicloud.openservices.tablestore.model.tunnel.ChannelStatus; +import com.alicloud.openservices.tablestore.model.tunnel.internal.Channel; +import com.alicloud.openservices.tablestore.tunnel.worker.ChannelDialer; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelConnect; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelStateMachine; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorkerConfig; +import junit.framework.TestCase; + + +public class TestTunnelStateMachine extends TestCase { + private static final String TUNNEL_ID = "test-tunnel-id-zr"; + private static final String CLIENT_ID = "test-client-id-zr"; + + private static final String CHANNEL_ID = "test-channel-id-zr"; + private static final int SLEEP_MILLIS = 2000; + + private TunnelWorkerConfig config; + private TunnelStateMachine stateMachine; + private ChannelDialer channelDialer; + + @Override + protected void setUp() throws Exception { + System.out.println("begin setup"); + MockTunnelClient.finishedChannels = new ArrayList(); + config = new TunnelWorkerConfig(new MockChannelProcessor()); + config.setReadRecordsExecutor((ThreadPoolExecutor)Executors.newFixedThreadPool(1)); + config.setProcessRecordsExecutor((ThreadPoolExecutor)Executors.newFixedThreadPool(1)); + channelDialer = new ChannelDialer(new MockTunnelClient(), config); + stateMachine = new TunnelStateMachine(TUNNEL_ID, CLIENT_ID, channelDialer, new MockChannelProcessorFactory(), + new MockTunnelClient()); + } + + @Override + protected void tearDown() throws Exception { + System.out.println("begin teardown"); + config.shutdown(); + config = null; + stateMachine.close(); + channelDialer.shutdown(); + } + + private HashMap toMap(List channels) { + HashMap channelHashMap = new HashMap(); + for (Channel channel : channels) { + channelHashMap.put(channel.getChannelId(), channel); + } + return channelHashMap; + } + + private int getOpenChannelCount(List connects) { + int count = 0; + for (IChannelConnect connect : connects) { + if (!connect.closed()) { + count++; + } + } + return count; + } + + private boolean channelEquals(Channel lc, Channel rc) { + assertEquals(lc.getChannelId(), rc.getChannelId()); + assertEquals(lc.getVersion(), rc.getVersion()); + assertEquals(lc.getStatus(), rc.getStatus()); + return true; + } + + private void sleepGrace() { + try { + Thread.sleep(SLEEP_MILLIS); + } catch (Exception e) { + System.out.println(e.getCause() + ":" + e.getMessage()); + } + } + + public void testBatchUpdateStatus() { + // step1: two open, two closing + List heartbeatChannels = Arrays.asList( + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-2", 0, ChannelStatus.OPEN), + new Channel("cid-3", 1, ChannelStatus.CLOSING), + new Channel("cid-4", 1, ChannelStatus.CLOSING)); + stateMachine.batchUpdateChannels(heartbeatChannels); + Map targetChannelMap = toMap(stateMachine.batchGetChannels()); + assertTrue(channelEquals(new Channel("cid-1", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-1"))); + assertTrue(channelEquals(new Channel("cid-2", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-2"))); + assertTrue(channelEquals(new Channel("cid-3", 2, ChannelStatus.CLOSE), targetChannelMap.get("cid-3"))); + assertTrue(channelEquals(new Channel("cid-4", 2, ChannelStatus.CLOSE), targetChannelMap.get("cid-4"))); + assertEquals(2, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + + // step2: one open, one closing, two new + heartbeatChannels = Arrays.asList( + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-2", 1, ChannelStatus.CLOSING), + new Channel("cid-4", 2, ChannelStatus.OPEN), + new Channel("cid-5", 0, ChannelStatus.OPEN)); + stateMachine.batchUpdateChannels(heartbeatChannels); + sleepGrace(); + stateMachine.batchUpdateChannels(heartbeatChannels); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + assertTrue(channelEquals(new Channel("cid-1", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-1"))); + assertTrue(channelEquals(new Channel("cid-2", 2, ChannelStatus.CLOSE), targetChannelMap.get("cid-2"))); + assertTrue(channelEquals(new Channel("cid-4", 2, ChannelStatus.OPEN), targetChannelMap.get("cid-4"))); + assertTrue(channelEquals(new Channel("cid-5", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-5"))); + assertEquals(3, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + + // step3: three open, one bad new, one new + heartbeatChannels = Arrays.asList( + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-4", 2, ChannelStatus.OPEN), + new Channel("cid-5", 0, ChannelStatus.OPEN), + new Channel("cid-bad", 0, ChannelStatus.OPEN), + new Channel("cid-6", 0, ChannelStatus.OPEN)); + stateMachine.batchUpdateChannels(heartbeatChannels); + sleepGrace(); + stateMachine.batchUpdateChannels(heartbeatChannels); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + assertTrue(channelEquals(new Channel("cid-1", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-1"))); + assertTrue(channelEquals(new Channel("cid-4", 2, ChannelStatus.OPEN), targetChannelMap.get("cid-4"))); + assertTrue(channelEquals(new Channel("cid-5", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-5"))); + assertTrue(channelEquals(new Channel("cid-bad", 1, ChannelStatus.CLOSE), targetChannelMap.get("cid-bad"))); + assertTrue(channelEquals(new Channel("cid-6", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-6"))); + assertEquals(4, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + + // step4: four open, one old version. + heartbeatChannels = Arrays.asList( + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-4", 1, ChannelStatus.CLOSING), + new Channel("cid-5", 0, ChannelStatus.OPEN), + new Channel("cid-6", 0, ChannelStatus.OPEN)); + stateMachine.batchUpdateChannels(heartbeatChannels); + sleepGrace(); + stateMachine.batchUpdateChannels(heartbeatChannels); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + assertTrue(channelEquals(new Channel("cid-1", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-1"))); + assertTrue(channelEquals(new Channel("cid-4", 2, ChannelStatus.OPEN), targetChannelMap.get("cid-4"))); + assertTrue(channelEquals(new Channel("cid-5", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-5"))); + assertTrue(channelEquals(new Channel("cid-6", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-6"))); + assertEquals(4, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + + // step5: four open, one finished + heartbeatChannels = Arrays.asList( + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-4", 2, ChannelStatus.OPEN), + new Channel("cid-5", 0, ChannelStatus.OPEN), + new Channel("cid-6", 0, ChannelStatus.OPEN)); + stateMachine.batchUpdateChannels(heartbeatChannels); + MockTunnelClient.finishedChannels = Arrays.asList("cid-6"); + sleepGrace(); + stateMachine.batchUpdateChannels(heartbeatChannels); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + assertTrue(channelEquals(new Channel("cid-1", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-1"))); + assertTrue(channelEquals(new Channel("cid-4", 2, ChannelStatus.OPEN), targetChannelMap.get("cid-4"))); + assertTrue(channelEquals(new Channel("cid-5", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-5"))); + assertTrue(channelEquals(new Channel("cid-6", 1, ChannelStatus.TERMINATED), targetChannelMap.get("cid-6"))); + assertEquals(3, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + MockTunnelClient.finishedChannels = new ArrayList(); + + // step6: three open, somehow one missing(cid-5), one failconn + heartbeatChannels = Arrays.asList( + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-4", 2, ChannelStatus.OPEN), + new Channel("cid-getCheckpointFailed", 1, ChannelStatus.OPEN)); + stateMachine.batchUpdateChannels(heartbeatChannels); + sleepGrace(); + stateMachine.batchUpdateChannels(heartbeatChannels); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + assertTrue(channelEquals(new Channel("cid-1", 0, ChannelStatus.OPEN), targetChannelMap.get("cid-1"))); + assertTrue(channelEquals(new Channel("cid-4", 2, ChannelStatus.OPEN), targetChannelMap.get("cid-4"))); + assertTrue(channelEquals(new Channel("cid-getCheckpointFailed", 2, ChannelStatus.CLOSE), + targetChannelMap.get("cid-getCheckpointFailed"))); + assertEquals(2, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + + // step7: all finished. + heartbeatChannels = Arrays.asList( + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-4", 2, ChannelStatus.OPEN)); + stateMachine.batchUpdateChannels(heartbeatChannels); + MockTunnelClient.finishedChannels = Arrays.asList("cid-1", "cid-4"); + sleepGrace(); + stateMachine.batchUpdateChannels(heartbeatChannels); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + assertTrue(channelEquals(new Channel("cid-1", 1, ChannelStatus.TERMINATED), targetChannelMap.get("cid-1"))); + assertTrue(channelEquals(new Channel("cid-4", 3, ChannelStatus.TERMINATED), targetChannelMap.get("cid-4"))); + assertEquals(0, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + MockTunnelClient.finishedChannels = new ArrayList(); + } + + public void testUpdateStatus() { + List heartbeatChannels = Arrays.asList( + new Channel("cid-0", 0, ChannelStatus.OPEN), + new Channel("cid-1", 0, ChannelStatus.OPEN), + new Channel("cid-2", 0, ChannelStatus.OPEN), + new Channel("cid-3", 0, ChannelStatus.OPEN)); + stateMachine.batchUpdateChannels(heartbeatChannels); + sleepGrace(); + HashMap targetChannelMap; + + // 1. update redundant channel + System.out.println(stateMachine.batchGetChannelConnects()); + stateMachine.updateStatus(new Channel("cidNotExist", 1, ChannelStatus.OPEN)); + assertEquals(4, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + + // 2. update channel to high version + stateMachine.updateStatus(new Channel("cid-1", 1, ChannelStatus.OPEN)); + assertEquals(4, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + channelEquals(new Channel("cid-1", 1, ChannelStatus.OPEN), targetChannelMap.get("cid-1")); + + // 3. update channel to low version. + stateMachine.updateStatus(new Channel("cid-1", 0, ChannelStatus.OPEN)); + assertEquals(4, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + channelEquals(new Channel("cid-1", 1, ChannelStatus.OPEN), targetChannelMap.get("cid-1")); + + // 4. update channel with closed conn + stateMachine.updateStatus(new Channel("cid-1", 2, ChannelStatus.CLOSE)); + assertEquals(4, getOpenChannelCount(stateMachine.batchGetChannelConnects())); + targetChannelMap = toMap(stateMachine.batchGetChannels()); + channelEquals(new Channel("cid-1", 2, ChannelStatus.CLOSE), targetChannelMap.get("cid-1")); + } +} diff --git a/src/test/java/com/aliyun/openservices/ots/writer/MultiPMultiC.java b/src/test/java/com/alicloud/openservices/tablestore/writer/MultiPMultiC.java similarity index 97% rename from src/test/java/com/aliyun/openservices/ots/writer/MultiPMultiC.java rename to src/test/java/com/alicloud/openservices/tablestore/writer/MultiPMultiC.java index 8729056..36cc615 100644 --- a/src/test/java/com/aliyun/openservices/ots/writer/MultiPMultiC.java +++ b/src/test/java/com/alicloud/openservices/tablestore/writer/MultiPMultiC.java @@ -1,15 +1,13 @@ -package com.aliyun.openservices.ots.writer; +package com.alicloud.openservices.tablestore.writer; import com.lmax.disruptor.*; import com.lmax.disruptor.dsl.Disruptor; -import com.lmax.disruptor.dsl.ProducerType; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; public class MultiPMultiC { private static int threadCount = 1; diff --git a/src/test/java/com/aliyun/openservices/ots/writer/OnePOneC.java b/src/test/java/com/alicloud/openservices/tablestore/writer/OnePOneC.java similarity index 95% rename from src/test/java/com/aliyun/openservices/ots/writer/OnePOneC.java rename to src/test/java/com/alicloud/openservices/tablestore/writer/OnePOneC.java index dfd9ac2..229d1df 100644 --- a/src/test/java/com/aliyun/openservices/ots/writer/OnePOneC.java +++ b/src/test/java/com/alicloud/openservices/tablestore/writer/OnePOneC.java @@ -1,6 +1,9 @@ -package com.aliyun.openservices.ots.writer; +package com.alicloud.openservices.tablestore.writer; -import com.lmax.disruptor.*; +import com.lmax.disruptor.EventFactory; +import com.lmax.disruptor.EventHandler; +import com.lmax.disruptor.InsufficientCapacityException; +import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.dsl.Disruptor; import java.util.ArrayList; diff --git a/src/test/java/com/aliyun/openservices/ots/writer/RingBufferPerf.java b/src/test/java/com/alicloud/openservices/tablestore/writer/RingBufferPerf.java similarity index 95% rename from src/test/java/com/aliyun/openservices/ots/writer/RingBufferPerf.java rename to src/test/java/com/alicloud/openservices/tablestore/writer/RingBufferPerf.java index b44b3bf..72cedd8 100644 --- a/src/test/java/com/aliyun/openservices/ots/writer/RingBufferPerf.java +++ b/src/test/java/com/alicloud/openservices/tablestore/writer/RingBufferPerf.java @@ -1,6 +1,9 @@ -package com.aliyun.openservices.ots.writer; +package com.alicloud.openservices.tablestore.writer; -import com.lmax.disruptor.*; +import com.lmax.disruptor.EventFactory; +import com.lmax.disruptor.EventHandler; +import com.lmax.disruptor.RingBuffer; +import com.lmax.disruptor.WorkHandler; import com.lmax.disruptor.dsl.Disruptor; import java.util.ArrayList; diff --git a/src/test/java/com/alicloud/openservices/tablestore/writer/TestWriter.java b/src/test/java/com/alicloud/openservices/tablestore/writer/TestWriter.java new file mode 100644 index 0000000..aca5567 --- /dev/null +++ b/src/test/java/com/alicloud/openservices/tablestore/writer/TestWriter.java @@ -0,0 +1,556 @@ +package com.alicloud.openservices.tablestore.writer; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.common.ServiceSettings; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicLong; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TestWriter { + private static final String tableName = "WriterTest"; + private static final String tableNameAI = "WriterTestAI"; + private static ServiceSettings serviceSettings = ServiceSettings.load(); + private static AtomicLong succeedRows = new AtomicLong(); + private static AtomicLong failedRows = new AtomicLong(); + private static long rowsCount = 100000; + private static long columnsCount = 10; + private static int concurrency = 100; + private static int queueSize = 4096; + private AsyncClientInterface ots; + final String strValue = "0123456789"; + private static AtomicLong retryCount = new AtomicLong(); + + public void createTable(AsyncClientInterface ots) throws Exception { + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); + tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.INTEGER); + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(-1); + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + request.setReservedThroughput(new ReservedThroughput(new CapacityUnit(0, 0))); + request.setTableOptions(tableOptions); + + Future future = ots.createTable(request, null); + future.get(); + } + + public void createTable2(AsyncClientInterface ots) throws Exception { + TableMeta tableMeta = new TableMeta(tableNameAI); + tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); + tableMeta.addAutoIncrementPrimaryKeyColumn("pk1"); + tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.INTEGER); + TableOptions tableOptions = new TableOptions(); + tableOptions.setMaxVersions(1); + tableOptions.setTimeToLive(-1); + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + request.setReservedThroughput(new ReservedThroughput(new CapacityUnit(0, 0))); + request.setTableOptions(tableOptions); + + Future future = ots.createTable(request, null); + future.get(); + } + + @Before + public void setUp() throws Exception { + succeedRows.getAndSet(0); + failedRows.getAndSet(0); + + ClientConfiguration cc = new ClientConfiguration(); + cc.setMaxConnections(1000); + cc.setRetryStrategy(new RetryStrategy() { + private int retries = 0; + + @Override + public RetryStrategy clone() { + return this; + } + + @Override + public int getRetries() { + return ++retries; + } + + @Override + public long nextPause(String action, Exception ex) { + if (action.equals("DeleteTable")) { + return 0; + } + + if (ex instanceof TableStoreException) { + TableStoreException otsException = (TableStoreException) ex; + if (otsException.getErrorCode().equals(ErrorCode.INVALID_PARAMETER)) { + return 0; + } + } + + retryCount.incrementAndGet(); + return 10; + } + }); + ots = new AsyncClient(serviceSettings.getOTSEndpoint(), + serviceSettings.getOTSAccessKeyId(), serviceSettings.getOTSAccessKeySecret(), + serviceSettings.getOTSInstanceName(), cc); + + try { + DeleteTableRequest request = new DeleteTableRequest(tableName); + Future future = ots.deleteTable(request, null); + future.get(); + } catch (Exception e) { + // pass + } + + try { + DeleteTableRequest request = new DeleteTableRequest(tableNameAI); + Future future = ots.deleteTable(request, null); + future.get(); + } catch (Exception e) { + // pass + } + createTable(ots); + createTable2(ots); + Thread.sleep(3000); + } + + @After + public void after() { + ots.shutdown(); + } + + public static DefaultTableStoreWriter createWriter(AsyncClientInterface ots, WriterConfig config, Executor executor) { + TableStoreCallback callback = new TableStoreCallback() { + @Override + public void onCompleted(RowChange rowChange, ConsumedCapacity cc) { + succeedRows.incrementAndGet(); + } + + @Override + public void onFailed(RowChange rowChange, Exception ex) { + ex.printStackTrace(); + failedRows.incrementAndGet(); + } + }; + DefaultTableStoreWriter writer = new DefaultTableStoreWriter(ots, tableName, config, callback, executor); + + return writer; + } + + @Test + public void testWriteCallback() throws Exception { + final WriterConfig config = new WriterConfig(); + config.setConcurrency(concurrency); + config.setBufferSize(queueSize); + config.setFlushInterval(1000000); + final ExecutorService executor = Executors.newFixedThreadPool(10); + + DefaultTableStoreWriter writer = new DefaultTableStoreWriter(ots, tableNameAI, config, null, executor); + + final AtomicLong gotRowCount = new AtomicLong(0); + writer.setResultCallback(new TableStoreCallback() { + @Override + public void onCompleted(RowChange req, RowWriteResult res) { + if (res.getRow() != null) { + gotRowCount.incrementAndGet(); + } + succeedRows.incrementAndGet(); + } + + @Override + public void onFailed(RowChange req, Exception ex) { + failedRows.incrementAndGet(); + } + }); + + try { + for (int i = 0; i < 100; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.AUTO_INCREMENT) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(0)).build(); + + RowPutChange rowChange = new RowPutChange(tableNameAI, pk); + for (int j = 0; j < columnsCount; j++) { + rowChange.addColumn("column_" + j, ColumnValue.fromString(strValue)); + } + rowChange.setReturnType(ReturnType.RT_PK); + + writer.addRowChange(rowChange); + } + + writer.flush(); + + } finally { + writer.close(); + executor.shutdown(); + executor.awaitTermination(10, TimeUnit.SECONDS); + } + + assertEquals(succeedRows.get(), 100); + assertEquals(writer.getWriterStatistics().getTotalSucceedRowsCount(), 100); + assertEquals(writer.getWriterStatistics().getTotalFailedRowsCount(), 0); + assertEquals(writer.getWriterStatistics().getTotalRequestCount(), 1); + assertEquals(writer.getWriterStatistics().getTotalRowsCount(), 100); + assertEquals(writer.getWriterStatistics().getTotalSingleRowRequestCount(), 0); + assertEquals(gotRowCount.get(), 100); + } + + @Test + public void testWriteSameRow() throws Exception { + final WriterConfig config = new WriterConfig(); + config.setConcurrency(concurrency); + config.setBufferSize(queueSize); + config.setFlushInterval(1000000); + final ExecutorService executor = Executors.newFixedThreadPool(10); + + DefaultTableStoreWriter writer = createWriter(ots, config, executor); + + try { + for (int i = 0; i < 100; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + 0)) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(0)).build(); + + RowUpdateChange rowChange = new RowUpdateChange(tableName, pk); + for (int j = 0; j < columnsCount; j++) { + rowChange.put("column_" + j, ColumnValue.fromString(strValue)); + } + + writer.addRowChange(rowChange); + } + + writer.flush(); + + } finally { + writer.close(); + executor.shutdown(); + executor.awaitTermination(10, TimeUnit.SECONDS); + } + + assertEquals(succeedRows.get(), 100); + assertEquals(writer.getWriterStatistics().getTotalSucceedRowsCount(), 100); + assertEquals(writer.getWriterStatistics().getTotalFailedRowsCount(), 0); + assertEquals(writer.getWriterStatistics().getTotalRequestCount(), 1); + assertEquals(writer.getWriterStatistics().getTotalRowsCount(), 100); + assertEquals(writer.getWriterStatistics().getTotalSingleRowRequestCount(), 0); + } + + @Test + public void testCloseWriter() throws Exception { + final WriterConfig config = new WriterConfig(); + config.setConcurrency(concurrency); + config.setBufferSize(queueSize); + config.setFlushInterval(1000000); + final ExecutorService executor = Executors.newFixedThreadPool(10); + + DefaultTableStoreWriter writer = createWriter(ots, config, executor); + + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + 0)) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(0)).build(); + + RowUpdateChange rowChange = new RowUpdateChange(tableName, pk); + for (int j = 0; j < columnsCount; j++) { + rowChange.put("column_" + j, ColumnValue.fromString(strValue)); + } + + writer.addRowChange(rowChange); + writer.close(); + + try { + writer.addRowChange(rowChange); + assertTrue(false); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The writer has been closed."); + } + + try { + writer.close(); + assertTrue(false); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The writer has already been closed."); + } + + try { + writer.flush(); + assertTrue(false); + } catch (ClientException e) { + assertEquals(e.getMessage(), "The writer has been closed."); + } + + + executor.shutdown(); + executor.awaitTermination(10, TimeUnit.SECONDS); + } + + @Test + public void testMixOperation() throws Exception { + final WriterConfig config = new WriterConfig(); + config.setConcurrency(concurrency); + config.setBufferSize(queueSize); + config.setFlushInterval(1000000); + final ExecutorService executor = Executors.newFixedThreadPool(10); + + final DefaultTableStoreWriter writer = createWriter(ots, config, executor); + + final int threadsCount = 5; + List threads = new ArrayList(); + try { + for (int i = 0; i < threadsCount; i++) { + final int finalI = i; + Thread th = new Thread(new Runnable() { + public void run() { + Random random = new Random(System.currentTimeMillis() + finalI * 1000); + for (int i = 0; i < rowsCount; i++) { + int id = Math.abs(random.nextInt()) % 2; + if (id == 0) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(i)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + i)) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(i)) + .build(); + + RowUpdateChange rowChange = new RowUpdateChange(tableName, pk); + for (int j = 0; j < columnsCount; j++) { + rowChange.put("update_" + j, ColumnValue.fromString(strValue)); + } + + writer.addRowChange(rowChange); + } else { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(i)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + i)) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(i)) + .build(); + + RowPutChange rowChange = new RowPutChange(tableName, pk); + for (int j = 0; j < columnsCount; j++) { + rowChange.addColumn("put_" + j, ColumnValue.fromString(strValue)); + } + + writer.addRowChange(rowChange); + } + } + System.out.println("Write thread finished."); + } + }); + threads.add(th); + } + + for (Thread thread : threads) { + thread.start(); + } + + for (Thread thread : threads) { + thread.join(); + } + + writer.flush(); + Thread.sleep(1000); + + assertEquals(failedRows.get(), 0); + assertEquals(succeedRows.get(), threadsCount * rowsCount); + assertEquals(writer.getWriterStatistics().getTotalRowsCount(), succeedRows.get()); + assertEquals(writer.getWriterStatistics().getTotalSucceedRowsCount(), succeedRows.get()); + assertEquals(writer.getWriterStatistics().getTotalFailedRowsCount(), 0); + assertEquals(writer.getWriterStatistics().getTotalSingleRowRequestCount(), 0); + //scanTable(ots); + } finally { + writer.close(); + executor.shutdown(); + executor.awaitTermination(10, TimeUnit.SECONDS); + } + } + + private void scanTable(AsyncClientInterface ots) { + int rowsCountInTable = 0; + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + PrimaryKey start = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MIN) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MAX) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MAX) + .build(); + criteria.setInclusiveStartPrimaryKey(start); + criteria.setExclusiveEndPrimaryKey(end); + criteria.setMaxVersions(1); + + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + + PrimaryKey nextStart = null; + do { + Future future = ots.getRange(request, null); + GetRangeResponse result = null; + try { + result = future.get(); + } catch (Exception e) { + throw new ClientException(e); + } + for (Row row : result.getRows()) { + PrimaryKeyValue pk0 = row.getPrimaryKey().getPrimaryKeyColumn("pk0").getValue(); + PrimaryKeyValue pk1 = row.getPrimaryKey().getPrimaryKeyColumn("pk1").getValue(); + PrimaryKeyValue pk2 = row.getPrimaryKey().getPrimaryKeyColumn("pk2").getValue(); + assertEquals(pk0.asLong(), rowsCountInTable); + assertEquals(pk1.asString(), "pk_" + rowsCountInTable); + assertEquals(pk2.asLong(), rowsCountInTable); + + if (row.contains("put_0")) { + for (int i = 0; i < columnsCount; i++) { + ColumnValue c = row.getLatestColumn("put_" + i).getValue(); + assertTrue(c != null); + assertEquals(c.asString(), strValue); + } + } else if (row.contains("update_0")) { + for (int i = 0; i < columnsCount; i++) { + ColumnValue c = row.getLatestColumn("update_" + i).getValue(); + assertTrue(c != null); + assertEquals(c.asString(), strValue); + } + } + + rowsCountInTable++; + } + + nextStart = result.getNextStartPrimaryKey(); + + if (nextStart != null) { + criteria.setInclusiveStartPrimaryKey(nextStart); + } + } while (nextStart != null); + + assertEquals(rowsCountInTable, rowsCount); + } + + @Test + public void testWriteDirtyRows() throws Exception { + final WriterConfig config = new WriterConfig(); + config.setConcurrency(concurrency); + config.setBufferSize(queueSize); + config.setFlushInterval(1000000); + config.setMaxAttrColumnSize(3 * 1024 * 1024); // max attribute length set to 3MB + config.setMaxBatchSize(4 * 1024 * 1024); + StringBuilder longStr = new StringBuilder(); + for (int i = 0; i < 2 * 1024 * 1024 + 1; i++) { + longStr.append('a'); + } + final ExecutorService executor = Executors.newFixedThreadPool(10); + + DefaultTableStoreWriter writer = createWriter(ots, config, executor); + + int dirtyRowId = 25; + try { + for (int i = 0; i < 100; i++) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(i)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + i)) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(i)) + .build(); + + RowUpdateChange rowChange = new RowUpdateChange(tableName, pk); + for (int j = 0; j < columnsCount; j++) { + rowChange.put("column_" + j, ColumnValue.fromString(strValue)); + } + + if (i == dirtyRowId) { + rowChange.put("longattr", ColumnValue.fromString(longStr.toString())); + } + + writer.addRowChange(rowChange); + } + + writer.flush(); + + } finally { + writer.close(); + executor.shutdown(); + executor.awaitTermination(10, TimeUnit.SECONDS); + } + + assertEquals(succeedRows.get(), 99); + assertEquals(failedRows.get(), 1); + assertEquals(writer.getWriterStatistics().getTotalRowsCount(), 100); + assertEquals(writer.getWriterStatistics().getTotalSucceedRowsCount(), 99); + assertEquals(writer.getWriterStatistics().getTotalFailedRowsCount(), 1); + assertEquals(writer.getWriterStatistics().getTotalSingleRowRequestCount(), 100); + assertEquals(writer.getWriterStatistics().getTotalRequestCount(), 101); + + int rowsCountInTable = 0; + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + PrimaryKey start = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MIN) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MAX) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MAX) + .build(); + + criteria.setInclusiveStartPrimaryKey(start); + criteria.setExclusiveEndPrimaryKey(end); + criteria.setMaxVersions(1); + + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + + PrimaryKey nextStart = null; + do { + Future future = ots.getRange(request, null); + GetRangeResponse result = future.get(); + for (Row row : result.getRows()) { + if (rowsCountInTable == dirtyRowId) { + rowsCountInTable++; + } + PrimaryKeyValue pk0 = row.getPrimaryKey().getPrimaryKeyColumn("pk0").getValue(); + PrimaryKeyValue pk1 = row.getPrimaryKey().getPrimaryKeyColumn("pk1").getValue(); + PrimaryKeyValue pk2 = row.getPrimaryKey().getPrimaryKeyColumn("pk2").getValue(); + assertEquals(pk0.asLong(), rowsCountInTable); + assertEquals(pk1.asString(), "pk_" + rowsCountInTable); + assertEquals(pk2.asLong(), rowsCountInTable); + + if (row.contains("put_0")) { + for (int i = 0; i < columnsCount; i++) { + ColumnValue c = row.getLatestColumn("put_" + i).getValue(); + assertTrue(c != null); + assertEquals(c.asString(), strValue); + } + } else if (row.contains("update_0")) { + for (int i = 0; i < columnsCount; i++) { + ColumnValue c = row.getLatestColumn("update_" + i).getValue(); + assertTrue(c != null); + assertEquals(c.asString(), strValue); + } + } + + rowsCountInTable++; + } + + nextStart = result.getNextStartPrimaryKey(); + + if (nextStart != null) { + criteria.setInclusiveStartPrimaryKey(nextStart); + } + } while (nextStart != null); + + assertEquals(rowsCountInTable, 100); + } +} diff --git a/src/test/java/com/aliyun/openservices/ots/writer/TestWriterPerf.java b/src/test/java/com/alicloud/openservices/tablestore/writer/TestWriterPerf.java similarity index 61% rename from src/test/java/com/aliyun/openservices/ots/writer/TestWriterPerf.java rename to src/test/java/com/alicloud/openservices/tablestore/writer/TestWriterPerf.java index f849ac8..5ccef45 100644 --- a/src/test/java/com/aliyun/openservices/ots/writer/TestWriterPerf.java +++ b/src/test/java/com/alicloud/openservices/tablestore/writer/TestWriterPerf.java @@ -1,11 +1,8 @@ -package com.aliyun.openservices.ots.writer; - -import com.aliyun.openservices.ots.*; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.internal.OTSRetryStrategy; -import com.aliyun.openservices.ots.internal.writer.WriterConfig; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.utils.ServiceSettings; +package com.alicloud.openservices.tablestore.writer; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.common.ServiceSettings; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -26,59 +23,67 @@ public class TestWriterPerf { private volatile boolean stop = false; private static AtomicLong succeedRows = new AtomicLong(); private static AtomicLong failedRows = new AtomicLong(); - private static long rowsCount = 1000000; + private static long rowsCount = 100000; + private static AtomicLong rowIndex = new AtomicLong(-1); private static long columnsCount = 10; private static int concurrency = 100; private static int queueSize = 4096; private static int sendThreads = 1; private static int writerCount = 1; - private OTSAsync ots; + private AsyncClientInterface ots; final String strValue = "0123456789"; private static AtomicLong retryCount = new AtomicLong(); - public void createTable(OTSAsync ots) { - CreateTableRequest request = new CreateTableRequest(); + public void createTable(AsyncClientInterface ots) { TableMeta tableMeta = new TableMeta(tableName); tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.INTEGER); - request.setTableMeta(tableMeta); - request.setReservedThroughput(new CapacityUnit(5000000, 5000000)); + TableOptions tableOptions = new TableOptions(-1, 3600); + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions, new ReservedThroughput(new CapacityUnit(0, 0))); + request.setReservedThroughput(new ReservedThroughput(new CapacityUnit(0, 0))); - OTSFuture future = ots.createTable(request); - future.get(); + Future future = ots.createTable(request, null); + try { + future.get(); + } catch (Exception e) { + throw new ClientException(e); + } } @Before public void setUp() throws Exception { ClientConfiguration cc = new ClientConfiguration(); cc.setMaxConnections(1000); - OTSServiceConfiguration ss = new OTSServiceConfiguration(); - ss.setRetryStrategy(new OTSRetryStrategy() { + cc.setRetryStrategy(new RetryStrategy() { @Override - public boolean shouldRetry(String action, Exception ex, int retries) { - if (action.equals(OTSActionNames.ACTION_DELETE_TABLE)) { - return false; - } - retryCount.incrementAndGet(); - return true; + public RetryStrategy clone() { + return this; } @Override - public long getPauseDelay(String action, Exception ex, int retries) { + public int getRetries() { + return 1; + } + + @Override + public long nextPause(String action, Exception ex) { + if (action.equals("DeleteTable")) { + return 0; + } return 10; } }); - ots = new OTSClientAsync(serviceSettings.getOTSEndpoint(), + + ots = new AsyncClient(serviceSettings.getOTSEndpoint(), serviceSettings.getOTSAccessKeyId(), serviceSettings.getOTSAccessKeySecret(), - serviceSettings.getOTSInstanceName(), cc, ss); + serviceSettings.getOTSInstanceName(), cc); try { - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - OTSFuture future = ots.deleteTable(request); + DeleteTableRequest request = new DeleteTableRequest(tableName); + Future future = ots.deleteTable(request, null); future.get(); - } catch (OTSException e) { + } catch (Exception e) { // pass } createTable(ots); @@ -90,24 +95,19 @@ public void after() { ots.shutdown(); } - public static DefaultOTSWriter createWriter(OTSAsync ots, WriterConfig config, Executor executor) { - OTSCallback callback = new OTSCallback() { + public static DefaultTableStoreWriter createWriter(AsyncClientInterface ots, WriterConfig config, Executor executor) { + TableStoreCallback callback = new TableStoreCallback() { @Override - public void onCompleted(OTSContext otsContext) { + public void onCompleted(RowChange rowChange, ConsumedCapacity cc) { succeedRows.incrementAndGet(); } @Override - public void onFailed(OTSContext otsContext, OTSException ex) { - failedRows.incrementAndGet(); - } - - @Override - public void onFailed(OTSContext otsContext, ClientException ex) { + public void onFailed(RowChange rowChange, Exception ex) { failedRows.incrementAndGet(); } }; - DefaultOTSWriter writer = new DefaultOTSWriter(ots, tableName, config, callback, executor); + DefaultTableStoreWriter writer = new DefaultTableStoreWriter(ots, tableName, config, callback, executor); return writer; } @@ -122,27 +122,28 @@ public void testSimple() throws Exception { long st = System.currentTimeMillis(); List threads = new ArrayList(); - List writers = new ArrayList(); + List writers = new ArrayList(); for (int tc = 0; tc < writerCount; tc++) { - final DefaultOTSWriter writer = createWriter(ots, config, executor); + final DefaultTableStoreWriter writer = createWriter(ots, config, executor); writers.add(writer); for (int k = 0; k < sendThreads; k++) { final int threadId = k; Thread th = new Thread(new Runnable() { public void run() { - for (int i = 0; i < rowsCount; i++) { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - RowPrimaryKey pk = new RowPrimaryKey(); - pk.addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(i)).addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + i)) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(i)); + for (long index = rowIndex.incrementAndGet(); index < rowsCount; index = rowIndex.incrementAndGet()) { + PrimaryKey pk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(index)) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + index)) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(index)) + .build(); - rowChange.setPrimaryKey(pk); + RowUpdateChange rowChange = new RowUpdateChange(tableName, pk); for (int j = 0; j < columnsCount; j++) { - rowChange.addAttributeColumn("column_" + j, ColumnValue.fromString(strValue)); + rowChange.put("column_" + j, ColumnValue.fromString(strValue)); } - rowChange.addAttributeColumn("thread_" + threadId, ColumnValue.fromLong(threadId)); + rowChange.put("thread_" + threadId, ColumnValue.fromLong(threadId)); writer.addRowChange(rowChange); } System.out.println("Write thread finished."); @@ -160,7 +161,7 @@ public void run() { th.join(); } - for (DefaultOTSWriter writer : writers) { + for (DefaultTableStoreWriter writer : writers) { writer.flush(); writer.close(); } @@ -182,50 +183,51 @@ public void run() { // check value System.out.println("Start check values..."); long totalRPCCount = succeedRows.get() + failedRows.get(); - assertEquals(totalRPCCount, sendThreads * rowsCount * writerCount); + assertEquals(totalRPCCount, rowsCount); scanTable(ots); System.out.println("PASS!"); } - private void scanTable(OTSAsync ots) { + private void scanTable(AsyncClientInterface ots) throws ExecutionException, InterruptedException { System.out.println("#################### Begin scan table ####################"); int rowsCountInTable = 0; RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - RowPrimaryKey start = new RowPrimaryKey(); - start.addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN).addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MIN) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MIN); - RowPrimaryKey end = new RowPrimaryKey(); - end.addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX).addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MAX) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MAX); + PrimaryKey start = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MIN) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MIN) + .build(); + PrimaryKey end = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX) + .addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MAX) + .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MAX) + .build(); + criteria.setInclusiveStartPrimaryKey(start); criteria.setExclusiveEndPrimaryKey(end); + criteria.setMaxVersions(1); GetRangeRequest request = new GetRangeRequest(); request.setRangeRowQueryCriteria(criteria); - RowPrimaryKey nextStart = null; + PrimaryKey nextStart = null; do { - OTSFuture future = ots.getRange(request); - GetRangeResult result = future.get(); + Future future = ots.getRange(request, null); + GetRangeResponse result = future.get(); for (Row row : result.getRows()) { - ColumnValue pk0 = row.getColumns().get("pk0"); - ColumnValue pk1 = row.getColumns().get("pk1"); - ColumnValue pk2 = row.getColumns().get("pk2"); + PrimaryKeyValue pk0 = row.getPrimaryKey().getPrimaryKeyColumn("pk0").getValue(); + PrimaryKeyValue pk1 = row.getPrimaryKey().getPrimaryKeyColumn("pk1").getValue(); + PrimaryKeyValue pk2 = row.getPrimaryKey().getPrimaryKeyColumn("pk2").getValue(); assertEquals(pk0.asLong(), rowsCountInTable); assertEquals(pk1.asString(), "pk_" + rowsCountInTable); assertEquals(pk2.asLong(), rowsCountInTable); for (int i = 0; i < columnsCount; i++) { - ColumnValue c = row.getColumns().get("column_" + i); + ColumnValue c = row.getLatestColumn("column_" + i).getValue(); assertTrue(c != null); assertEquals(c.asString(), strValue); } - for (int i = 0; i < sendThreads; i++) { - ColumnValue c = row.getColumns().get("thread_" + i); - assertTrue(c != null); - assertEquals(c.asLong(), i); - } rowsCountInTable++; } diff --git a/src/test/java/com/aliyun/openservices/ots/OTSCompressUtilTest.java b/src/test/java/com/aliyun/openservices/ots/OTSCompressUtilTest.java deleted file mode 100644 index c7a29bb..0000000 --- a/src/test/java/com/aliyun/openservices/ots/OTSCompressUtilTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.aliyun.openservices.ots; - -import static org.junit.Assert.assertEquals; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.Random; -import java.util.zip.DataFormatException; -import java.util.zip.Deflater; -import java.util.zip.Inflater; - -import org.junit.Test; - -import com.aliyun.openservices.ots.internal.OTSCompressUtil; - -public class OTSCompressUtilTest { - @Test - public void testCompressAndDecompress() throws IOException, DataFormatException{ - final int dataLength = 10 * 1024 * 1024 + 137; - byte[] bytes = new byte[dataLength]; - Random random = new Random(); - for(int i = 0; i < dataLength; i++){ - bytes[i] = (byte)random.nextInt(128); - } - Deflater compresser = new Deflater(); - Inflater decompresser = new Inflater(); - - ByteArrayInputStream input = new ByteArrayInputStream(bytes); - byte[] compressedBytes = OTSCompressUtil.compress(input, compresser); - ByteArrayInputStream compressedData = new ByteArrayInputStream(compressedBytes); - byte[] decompressedBytes = OTSCompressUtil.decompress(compressedData, bytes.length, decompresser); - assertEquals(dataLength, decompressedBytes.length); - for(int i = 0; i < dataLength; i++){ - assertEquals(bytes[i], decompressedBytes[i]); - } - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/common/BaseFT.java b/src/test/java/com/aliyun/openservices/ots/common/BaseFT.java deleted file mode 100644 index c768be2..0000000 --- a/src/test/java/com/aliyun/openservices/ots/common/BaseFT.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.aliyun.openservices.ots.common; - - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.model.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -public class BaseFT { - - private static final Logger LOG = LoggerFactory.getLogger(BaseFT.class); - - public static void assertOTSException( - OTSException expect, - OTSException actual) { - LOG.info(actual.toString()); - assertEquals(expect.getErrorCode(), actual.getErrorCode()); - assertEquals(expect.getMessage(), actual.getMessage()); - assertEquals(expect.getHttpStatus(), actual.getHttpStatus()); - } - - public static void assertOTSException( - String errorCode, - String errorMsg, - int httpCode, - OTSException actual) { - LOG.info(actual.toString()); - assertEquals(errorCode, actual.getErrorCode()); - assertEquals(errorMsg, actual.getMessage()); - assertEquals(httpCode, actual.getHttpStatus()); - } - - public static void assertClientException( - ClientException expect, - ClientException actual) { - LOG.info(actual.toString()); - assertEquals(expect.getMessage(), actual.getMessage()); - } - - public static void assertClientException( - String errorMsg, - ClientException actual) { - LOG.info(actual.toString()); - assertEquals(errorMsg, actual.getMessage()); - } - - public static void checkPrimaryKeySchemas( - Map expectPK, - Map actualPK ) { - assertEquals(expectPK.size(), actualPK.size()); - - for (int i = 0; i < expectPK.size(); i++) { - assertEquals(expectPK.get(i), actualPK.get(i)); - } - } - - public static void checkTableMeta( - TableMeta expect, - TableMeta actual) { - assertEquals(expect.getTableName(), actual.getTableName()); - - checkPrimaryKeySchemas(expect.getPrimaryKey(), actual.getPrimaryKey()); - } - - public static void checkDescribeTableResult( - DescribeTableResult expect, - DescribeTableResult actual) { - checkTableMeta(expect.getTableMeta(), actual.getTableMeta()); - } - - public static void checkColumns( - Map expect, - Map actual) { - assertEquals(expect.size(), actual.size()); - for (Map.Entry entry : expect.entrySet()) { - ColumnValue expectValue = entry.getValue(); - ColumnValue actualValue = actual.get(entry.getKey()); - assertEquals(expectValue, actualValue); - } - } - - public static void checkRow( - Row expect, - Row actual) { - checkColumns(expect.getColumns(), actual.getColumns()); - } - -} diff --git a/src/test/java/com/aliyun/openservices/ots/common/OTSHelper.java b/src/test/java/com/aliyun/openservices/ots/common/OTSHelper.java deleted file mode 100644 index ecc98fc..0000000 --- a/src/test/java/com/aliyun/openservices/ots/common/OTSHelper.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.aliyun.openservices.ots.common; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.model.*; - -public class OTSHelper { - - private static final Logger LOG = LoggerFactory.getLogger(OTSHelper.class); - - public static void deleteAllTable(OTS ots) throws Exception { - LOG.info("Begin deleteAllTable"); - ListTableResult r = ots.listTable(); - - for (String name : r.getTableNames()) { - LOG.info("delete : " + name); - deleteTable(ots, name); - } - LOG.info("End deleteAllTable"); - } - - public static TableMeta getTableMeta(String tableName, Map pk) { - TableMeta meta = new TableMeta(tableName); - for (Map.Entry entry : pk.entrySet()) { - meta.addPrimaryKeyColumn(entry.getKey(), entry.getValue()); - } - return meta; - } - - public static void createTable( - OTS ots, - String tableName, - Map pk) { - CreateTableRequest request = new CreateTableRequest(getTableMeta(tableName, pk)); - request.setReservedThroughput(new CapacityUnit(5, 4)); - ots.createTable(request); - } - - public static void createTable( - OTS ots, - TableMeta meta) { - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(meta); - request.setReservedThroughput(new CapacityUnit(5, 4)); - ots.createTable(request); - } - - public static void deleteTable(OTS ots, String tableName) { - DeleteTableRequest deleteTableRequest = new DeleteTableRequest( - tableName); - ots.deleteTable(deleteTableRequest); - } - - public static List listTable(OTS ots) { - ListTableResult r = ots.listTable(); - return r.getTableNames(); - } - - public static DescribeTableResult describeTable(OTS ots, String tableName) { - DescribeTableRequest describeTableRequest = new DescribeTableRequest( - tableName); - DescribeTableResult result = ots.describeTable(describeTableRequest); - if (!result.getTableMeta().getTableName().equals(tableName)) { - throw new RuntimeException("Wrong result."); - } - return result; - } - - public static UpdateTableResult updateTable(OTS ots, String tableName, - ReservedThroughputChange reservedThroughputChange) { - UpdateTableRequest updateTableRequest = new UpdateTableRequest( - tableName); - if (reservedThroughputChange != null) { - updateTableRequest - .setReservedThroughputChange(reservedThroughputChange); - } - return ots.updateTable(updateTableRequest); - } - - public static PutRowResult putRow(OTS ots, String tableName, RowPrimaryKey pk, - Map columns) { - RowPutChange rowChange = new RowPutChange(tableName); - rowChange.setPrimaryKey(pk); - for (Map.Entry col : columns.entrySet()) { - rowChange.addAttributeColumn(col.getKey(), col.getValue()); - } - return putRow(ots, rowChange); - } - - public static PutRowResult putRow(OTS ots, RowPutChange rowChange) { - PutRowRequest putRowRequest = new PutRowRequest(rowChange); - return ots.putRow(putRowRequest); - } - - public static GetRowResult getRow(OTS ots, String tableName, RowPrimaryKey pk) { - GetRowRequest request = new GetRowRequest(); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - request.setRowQueryCriteria(criteria); - return ots.getRow(request); - } - - public static GetRowResult getRow(OTS ots, - SingleRowQueryCriteria rowQueryCriteria) { - GetRowRequest getRowRequest = new GetRowRequest(rowQueryCriteria); - GetRowResult result = ots.getRow(getRowRequest); - return result; - } - - public static UpdateRowResult updateRow(OTS ots, String tableName, - RowPrimaryKey pk, Map puts, - List deleteColumn) { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - rowChange.setPrimaryKey(pk); - if (puts != null) { - for (Map.Entry c : puts.entrySet()) { - rowChange.addAttributeColumn(c.getKey(), c.getValue()); - } - } - if (deleteColumn != null) { - for (String s : deleteColumn) { - rowChange.deleteAttributeColumn(s); - } - } - return updateRow(ots, rowChange); - } - - public static UpdateRowResult updateRow(OTS ots, RowUpdateChange rowChange) { - UpdateRowRequest updateRowRequest = new UpdateRowRequest(rowChange); - return ots.updateRow(updateRowRequest); - } - - public static DeleteRowResult deleteRow(OTS ots, String tableName, - RowPrimaryKey pk) { - RowDeleteChange rowChange = new RowDeleteChange(tableName); - rowChange.setPrimaryKey(pk); - return deleteRow(ots, rowChange); - } - - public static DeleteRowResult deleteRow(OTS ots, RowDeleteChange rowChange) { - DeleteRowRequest deleteRowRequest = new DeleteRowRequest(rowChange); - return ots.deleteRow(deleteRowRequest); - } - - public static BatchGetRowResult batchGetRow( - OTS ots, - List criterias) { - BatchGetRowRequest batchGetRowRequest = new BatchGetRowRequest(); - for (MultiRowQueryCriteria criteria : criterias) { - batchGetRowRequest.addMultiRowQueryCriteria(criteria); - } - return ots.batchGetRow(batchGetRowRequest); - } - - public static BatchWriteRowResult batchWriteRow( - OTS ots, - List puts, - List updates, - List deletes) { - BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); - if (puts != null) { - for (RowPutChange put : puts) { - batchWriteRowRequest.addRowPutChange(put); - } - } - if (updates != null) { - for (RowUpdateChange update : updates) { - batchWriteRowRequest.addRowUpdateChange(update); - } - } - if (deletes != null) { - for (RowDeleteChange delete : deletes) { - batchWriteRowRequest.addRowDeleteChange(delete); - } - } - return ots.batchWriteRow(batchWriteRowRequest); - } - - public static GetRangeResult getRange(OTS ots, - RangeRowQueryCriteria rangeRowQueryCriteria) { - GetRangeRequest getRangeRequest = new GetRangeRequest( - rangeRowQueryCriteria); - return ots.getRange(getRangeRequest); - } - - public static List getRangeForAll(OTS ots, - RangeRowQueryCriteria rangeRowQueryCriteria) { - List result = new ArrayList(); - GetRangeRequest getRangeRequest = new GetRangeRequest( - rangeRowQueryCriteria); - GetRangeResult r = ots.getRange(getRangeRequest); - result.addAll(r.getRows()); - while (r.getNextStartPrimaryKey() != null) { - rangeRowQueryCriteria.setInclusiveStartPrimaryKey(r.getNextStartPrimaryKey()); - r = ots.getRange(getRangeRequest); - result.addAll(r.getRows()); - } - return result; - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/common/Utils.java b/src/test/java/com/aliyun/openservices/ots/common/Utils.java deleted file mode 100644 index 96fc8ad..0000000 --- a/src/test/java/com/aliyun/openservices/ots/common/Utils.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.aliyun.openservices.ots.common; - -public class Utils { - public static void sleepSeconds(int seconds) { - try { - Thread.sleep(seconds * 1000); - } catch (InterruptedException e) { - e.printStackTrace(); - System.exit(-1); - } - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/integration/ConditionalUpdateTest.java b/src/test/java/com/aliyun/openservices/ots/integration/ConditionalUpdateTest.java deleted file mode 100644 index 5509978..0000000 --- a/src/test/java/com/aliyun/openservices/ots/integration/ConditionalUpdateTest.java +++ /dev/null @@ -1,467 +0,0 @@ -package com.aliyun.openservices.ots.integration; - -import com.aliyun.openservices.ots.*; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.condition.*; -import com.aliyun.openservices.ots.utils.ServiceSettings; - -import com.aliyun.openservices.ots.utils.TestUtil; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import static org.junit.Assert.*; - - -public class ConditionalUpdateTest { - private static final int MILLISECONDS_UNTIL_TABLE_READY = 15 * 1000; - - private static String tableName = TestUtil.newTableName("conditional_update_test_table"); - private static final OTS ots = OTSClientFactory.createOTSClient(ServiceSettings.load()); - private static Logger LOG = Logger.getLogger(ConditionalUpdateTest.class.getName()); - - @AfterClass - public static void classAfter() { - TestUtil.DeleteTable(ots, tableName); - ots.shutdown(); - } - - @Before - public void setup() throws Exception { - LOG.info("Instance: " + ServiceSettings.load().getOTSInstanceName()); - - try { - DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName); - ots.deleteTable(deleteTableRequest); - } catch (Exception ex) {;} - } - - @Test - public void testSingleColumnCondition() throws Exception { - LOG.info("Start testSingleColumnCondition"); - - CreateTable(); - - // put a row first - boolean success = putRow(19, "Col1", ColumnValue.fromString("Value1"), null); - assertTrue(success); - - // put row with condition: col1 != value1 - success = putRow(19, "Col2", ColumnValue.fromString("Value2"), - new RelationalCondition("Col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("Value1"))); - assertTrue(!success); - - // put row with condition: col1 == value1 - success = putRow(19, "Col2", ColumnValue.fromString("Value2"), - new RelationalCondition("Col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("Value1"))); - assertTrue(success); - - // update row with condition: col2 < value1 - success = putRow(19, "Col3", ColumnValue.fromString("Value3"), - new RelationalCondition("Col2", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromString("Value1"))); - assertTrue(!success); - - // update row with condition: col2 >= value2 - success = putRow(19, "Col3", ColumnValue.fromString("Value3"), - new RelationalCondition("Col2", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromString("Value2"))); - assertTrue(success); - - // delete row with condition: col3 <= value2 - success = deleteRow(19, "Col3", ColumnValue.fromString("Value3"), - new RelationalCondition("Col3", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromString("Value2"))); - assertTrue(!success); - - // delete row with condition: col3 > value2 - success = deleteRow(19, "Col3", ColumnValue.fromString("Value3"), - new RelationalCondition("Col3", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromString("Value2"))); - assertTrue(success); - } - - @Test - public void testColumnMissing() throws Exception { - LOG.info("Start testColumnMissing"); - - CreateTable(); - - // put a row first - boolean success = putRow(19, "Col1", ColumnValue.fromString("Value1"), null); - assertTrue(success); - - // put row with condition: colX != valueY - // with passIfMissing == true, this should succeed - success = putRow(19, "Col2", ColumnValue.fromString("Value2"), - new RelationalCondition("ColX", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("ValueY"))); - assertTrue(success); - - // put row with condition: colX != valueY - // with passIfMissing == false, this should fail - RelationalCondition cond = new RelationalCondition("ColX", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("ValueY")); - cond.setPassIfMissing(false); - success = putRow(19, "Col2", ColumnValue.fromString("Value2"), cond); - assertTrue(!success); - } - - @Test - public void testCompositeCondition() throws Exception { - LOG.info("Start testCompositeCondition"); - - CreateTable(); - - // put a row first - boolean success = putRow(19, "Col1", ColumnValue.fromString("Value1"), null); - assertTrue(success); - success = updateRow(19, "Col2", ColumnValue.fromString("Value2"), null); - assertTrue(success); - - // update with condition: - // col1 == value2 OR col2 == value1 - CompositeCondition cond = new CompositeCondition(CompositeCondition.LogicOperator.OR); - cond.addCondition(new RelationalCondition( - "Col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("Value2"))) - .addCondition(new RelationalCondition( - "Col2", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("Value1"))); - success = updateRow(19, "Col3", ColumnValue.fromString("Value3"), cond); - assertTrue(!success); - - // update with condition: - // Not col1 == value2 - cond = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - cond.addCondition(new RelationalCondition( - "Col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("Value2"))); - success = updateRow(19, "Col3", ColumnValue.fromString("Value3"), cond); - assertTrue(success); - - // delete with condition: - // col1 == valueX OR (col2 == value2 AND col3 == value3) - cond = new CompositeCondition(CompositeCondition.LogicOperator.OR); - cond.addCondition(new RelationalCondition( - "Col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))); - CompositeCondition cond2 = new CompositeCondition(CompositeCondition.LogicOperator.AND); - cond2.addCondition(new RelationalCondition( - "Col2", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("Value2"))) - .addCondition(new RelationalCondition( - "Col3", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("Value3"))); - cond.addCondition(cond2); - - success = deleteRow(19, "Col3", ColumnValue.fromString("Value3"), cond); - assertTrue(success); - } - - // Txn: - // oldV = read - // newV = oldV + 1 - // update v = newV if v == oldV - public class DoTxn implements Runnable { - private volatile int count = 0; - private int round = 100; - - @Override - public void run() { - for (int i = 0; i < round; ++i) { - Row r = readRow(tableName, 23); - ColumnValue oldValue = r.getColumns().get("Col1"); - - ColumnValue newValue = ColumnValue.fromLong(oldValue.asLong() + 1); - RelationalCondition cond = new RelationalCondition( - "Col1", RelationalCondition.CompareOperator.EQUAL, oldValue); - boolean success = updateRow(23, "Col1", newValue, cond); - if (success) { - ++count; - } - } - } - - public int getValue() { - return count; - } - } - - @Test - public void testTransactionalUpdate() throws Exception { - LOG.info("Start testTransactionalUpdate"); - - CreateTable(); - - boolean success = putRow(23, "Col1", ColumnValue.fromLong(0), null); - assertTrue(success); - - int threadNum = 20; - List runnables = new ArrayList(); - List threads = new ArrayList(); - - for (int i = 0; i < threadNum; ++i) { - runnables.add(new DoTxn()); - threads.add(new Thread(runnables.get(i))); - threads.get(i).start(); - } - - for (Thread t: threads) { - t.join(); - } - - int total = 0; - for (DoTxn t: runnables) { - total += t.getValue(); - } - - ColumnValue v = readRow(tableName, 23).getColumns().get("Col1"); - assertEquals(total, v.asLong()); - } - - @Test - public void testLimits() throws Exception { - LOG.info("Start testLimits"); - - CreateTable(); - - // column condition count <= 10 - CompositeCondition cond = new CompositeCondition(CompositeCondition.LogicOperator.OR); - cond.addCondition(new RelationalCondition( - "ColX1", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX2", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX3", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX4", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX5", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX6", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX7", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX8", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX9", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))); - - boolean success = putRow(23, "Col1", ColumnValue.fromString("Value1"), cond); - assertTrue(success); - - cond.addCondition(new RelationalCondition( - "ColX10", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))); - success = putRow(23, "Col1", ColumnValue.fromString("Value1"), cond); - assertTrue(!success); - - // invalid column name in column condition - cond = new CompositeCondition(CompositeCondition.LogicOperator.AND); - cond.addCondition(new RelationalCondition( - "9Col", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))) - .addCondition(new RelationalCondition( - "ColX9", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("ValueX"))); - success = putRow(23, "Col1", ColumnValue.fromString("Value1"), cond); - assertTrue(success); - } - - @Test - public void testBatchWriteRow() throws Exception { - LOG.info("Start testBatchWriteRow"); - - CreateTable(); - - boolean success = putRow(20, "Col1", ColumnValue.fromString("Value20"), null); - assertTrue(success); - - success = putRow(21, "Col1", ColumnValue.fromString("Value21"), null); - assertTrue(success); - - success = putRow(22, "Col1", ColumnValue.fromString("Value22"), null); - - RowPutChange putChange = new RowPutChange(tableName); - putChange.setPrimaryKey(getRowPrimaryKeys(20)); - putChange.addAttributeColumn("Col2", ColumnValue.fromString("Value2")); - Condition cond = new Condition(RowExistenceExpectation.IGNORE); - cond.setColumnCondition(new RelationalCondition( - "Col1", RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("Value20"))); - putChange.setCondition(cond); - - RowUpdateChange updateChange = new RowUpdateChange(tableName); - updateChange.setPrimaryKey(getRowPrimaryKeys(21)); - updateChange.addAttributeColumn("Col3", ColumnValue.fromString("Value3")); - cond = new Condition(RowExistenceExpectation.IGNORE); - cond.setColumnCondition(new RelationalCondition( - "Col1", RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("Value21"))); - updateChange.setCondition(cond); - - RowDeleteChange deleteChange = new RowDeleteChange(tableName); - deleteChange.setPrimaryKey(getRowPrimaryKeys(22)); - cond = new Condition(RowExistenceExpectation.IGNORE); - cond.setColumnCondition(new RelationalCondition( - "Col1", RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromString("Value22"))); - deleteChange.setCondition(cond); - - BatchWriteRowRequest request = new BatchWriteRowRequest(); - request.addRowPutChange(putChange); - request.addRowUpdateChange(updateChange); - request.addRowDeleteChange(deleteChange); - - BatchWriteRowResult result = ots.batchWriteRow(request); - List putStatus = result.getPutRowStatus(tableName); - assertEquals(1, putStatus.size()); - assertTrue(!putStatus.get(0).isSucceed()); - - List updateStatus = result.getUpdateRowStatus(tableName); - assertEquals(1, updateStatus.size()); - assertTrue(updateStatus.get(0).isSucceed()); - - List deleteStatus = result.getDeleteRowStatus(tableName); - assertEquals(1, deleteStatus.size()); - assertTrue(!deleteStatus.get(0).isSucceed()); - } - - private void CreateTable() throws Exception{ - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(tableCU); - ots.createTable(request); - - LOG.info("Create table: " + tableName); - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - } - - private boolean putRow(int row, String colName, ColumnValue colValue, ColumnCondition cond) - { - RowPutChange change = new RowPutChange(tableName); - change.setPrimaryKey(getRowPrimaryKeys(row)); - change.addAttributeColumn(colName, colValue); - Condition c = new Condition(RowExistenceExpectation.IGNORE); - c.setColumnCondition(cond); - change.setCondition(c); - PutRowRequest request = new PutRowRequest(); - request.setRowChange(change); - - boolean success = true; - try { - ots.putRow(request); - } catch (ServiceException e) { - LOG.warning("PutRow fails: " + e.toString()); - success = false; - } - - return success; - } - - private boolean updateRow(int row, String colName, ColumnValue colValue, ColumnCondition cond) - { - RowUpdateChange change = new RowUpdateChange(tableName); - change.setPrimaryKey(getRowPrimaryKeys(row)); - change.addAttributeColumn(colName, colValue); - Condition c = new Condition(RowExistenceExpectation.IGNORE); - c.setColumnCondition(cond); - change.setCondition(c); - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(change); - - boolean success = true; - try { - ots.updateRow(request); - } catch (ServiceException e) { - LOG.warning("UpdateRow fails: " + e.toString()); - success = false; - } - - return success; - } - - private boolean deleteRow(int row, String colName, ColumnValue colValue, ColumnCondition cond) - { - RowDeleteChange change = new RowDeleteChange(tableName); - change.setPrimaryKey(getRowPrimaryKeys(row)); - Condition c = new Condition(RowExistenceExpectation.IGNORE); - c.setColumnCondition(cond); - change.setCondition(c); - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(change); - - boolean success = true; - try { - ots.deleteRow(request); - } catch (ServiceException e) { - LOG.warning("DeleteRow fails: " + e.toString()); - success = false; - } - - return success; - } - - private TableMeta getTestTableMeta() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("uid", PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn("name", PrimaryKeyType.STRING); - tableMeta.addPrimaryKeyColumn("flag", PrimaryKeyType.INTEGER); - return tableMeta; - } - - private CapacityUnit getTestCapacityUnit() { - CapacityUnit capacityUnit = new CapacityUnit(); - capacityUnit.setReadCapacityUnit(1); - capacityUnit.setWriteCapacityUnit(1); - return capacityUnit; - } - - private Row readRow(String tableName, int i) { - SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); - rowQueryCriteria.setPrimaryKey(getRowPrimaryKeys(i)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(rowQueryCriteria); - GetRowResult result = ots.getRow(request); - return result.getRow(); - } - - private RowPrimaryKey getRowPrimaryKeys(int i) { - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(i)); - primaryKeys.addPrimaryKeyColumn("name", PrimaryKeyValue.fromString(String.format("%05d", i))); - primaryKeys.addPrimaryKeyColumn("flag", PrimaryKeyValue.fromLong(i * i)); - return primaryKeys; - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/integration/FilterRestrictionAndParamCheckingTest.java b/src/test/java/com/aliyun/openservices/ots/integration/FilterRestrictionAndParamCheckingTest.java deleted file mode 100644 index 6808fad..0000000 --- a/src/test/java/com/aliyun/openservices/ots/integration/FilterRestrictionAndParamCheckingTest.java +++ /dev/null @@ -1,1446 +0,0 @@ -package com.aliyun.openservices.ots.integration; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.OTSErrorCode; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.common.BaseFT; -import com.aliyun.openservices.ots.common.OTSHelper; -import com.aliyun.openservices.ots.common.Utils; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.condition.ColumnCondition; -import com.aliyun.openservices.ots.model.condition.CompositeCondition; -import com.aliyun.openservices.ots.model.condition.RelationalCondition; -import com.aliyun.openservices.ots.utils.ServiceSettings; -import com.aliyun.openservices.ots.utils.TestUtil; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class FilterRestrictionAndParamCheckingTest extends BaseFT { - private static Logger LOG = Logger.getLogger(FilterAdvanceTest.class.getName()); - - private static String tableName = TestUtil.newTableName("FilterRestrictionTest"); - - private static final OTS ots = OTSClientFactory.createOTSClient(ServiceSettings.load()); - - private static final int SECONDS_UNTIL_TABLE_READY = 10; - - private static final int MAX_FILTER_COUNT = 10; - - @AfterClass - public static void classAfter() { - TestUtil.DeleteTable(ots, tableName); - ots.shutdown(); - } - - @Before - public void setup() throws Exception { - LOG.info("Instance: " + ServiceSettings.load().getOTSInstanceName()); - - try { - DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName); - ots.deleteTable(deleteTableRequest); - Thread.sleep(5000); - } catch (Exception ex) {;} - - - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("PK0", PrimaryKeyType.INTEGER); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - } - - public ColumnCondition makeFilterWithMaxDepth(int depth, CompositeCondition.LogicOperator operator) { - CompositeCondition rootFilter = new CompositeCondition(operator); - CompositeCondition lastFilter = rootFilter; - int filterCount = 1; - - for (int i = 2; i < depth; i++) { - if (operator != CompositeCondition.LogicOperator.NOT) { - lastFilter.addCondition(new RelationalCondition("ColumnA", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("A"))); - filterCount++; - } - - CompositeCondition tmp = new CompositeCondition(operator); - filterCount++; - lastFilter.addCondition(tmp); - lastFilter = tmp; - } - - lastFilter.addCondition(new RelationalCondition("ColumnB", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("B"))); - filterCount++; - - if (operator != CompositeCondition.LogicOperator.NOT) { - lastFilter.addCondition(new RelationalCondition("ColumnC", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("C"))); - filterCount++; - } - - for (int i = filterCount; i < MAX_FILTER_COUNT; i++) { - lastFilter.addCondition(new RelationalCondition("ColumnD", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); - } - return rootFilter; - } - - public ColumnCondition makeFilterWithMaxBreadth(int maxCount, CompositeCondition.LogicOperator operator) { - CompositeCondition rootFilter = new CompositeCondition(operator); - - for (int i = 1; i < maxCount; i++) { - rootFilter.addCondition(new RelationalCondition("Column_" + i, RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromString("A"))); - } - - return rootFilter; - } - - public ColumnCondition createFilter(int filterNumber, int maxCount, CompositeCondition.LogicOperator operator) { - boolean hasLeftNode = (2 * filterNumber) <= maxCount; - boolean hasRightNode = (2 * filterNumber + 1) <= maxCount; - - //System.out.println(filterNumber + " " + hasLeftNode + " " + hasRightNode + " " + maxCount); - if (hasLeftNode || hasRightNode) { - if (hasRightNode) { - return new CompositeCondition(operator); - } else { - // if only has left node, the operator should only be NOT - return new CompositeCondition(CompositeCondition.LogicOperator.NOT); - } - } else { - return new RelationalCondition("Column1_" + filterNumber, RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("A")); - } - } - - public ColumnCondition makeFilterInBinaryForm(int maxCount, CompositeCondition.LogicOperator operator) { - if (maxCount <= 0) { - throw new IllegalArgumentException("There must be at least one filter."); - } - - if (maxCount == 1) { - return new RelationalCondition("Column1", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("A")); - } - - List filters = new ArrayList(); - filters.add(new CompositeCondition(operator)); - - for (int index = 0; index < maxCount; index++) { - int filterNumber = index + 1; - int leftFilterNumber = 2 * filterNumber; - int rightFilterNumber = leftFilterNumber + 1; - - if (!(filters.get(index) instanceof CompositeCondition)) { - continue; - } - - CompositeCondition rootFilter = (CompositeCondition)filters.get(index); - // add left node - if (leftFilterNumber <= maxCount) { - ColumnCondition leftFilter = createFilter(leftFilterNumber, maxCount, operator); - rootFilter.addCondition(leftFilter); - filters.add(leftFilter); - } - - // add right node - if (rightFilterNumber <= maxCount) { - ColumnCondition rightFilter = createFilter(rightFilterNumber, maxCount, operator); - rootFilter.addCondition(rightFilter); - filters.add(rightFilter); - } - } - - //printFilter(filters); - - return filters.get(0); - } - - private void printFilter(List filters) { - for (ColumnCondition filter : filters) { - if (filter instanceof CompositeCondition) { - System.out.println("CompositeCondition " + ((CompositeCondition) filter).getOperationType()); - } else { - System.out.println("RelationalCondition"); - } - } - } - - /** - * 构造一个深度为1000的composite filter,测试GetRow操作。 - */ - @Test - public void testCompositeCondition_ExceedMaxDepth_GetRow() { - LOG.info("Start testCompositeCondition_ExceedMaxDepth_GetRow"); - - RowPrimaryKey primaryKey = - new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - // test OR - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.NOT)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - - /** - * 构造一个深度为1000的composite filter,测试GetRange操作。 - */ - @Test - public void testCompositeCondition_ExceedMaxDepth_GetRange() { - LOG.info("Start testCompositeCondition_ExceedMaxDepth_GetRange"); - - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - - - // test OR - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.NOT)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个深度为1000的composite filter,测试BatchGetRow操作。 - */ - @Test - public void testCompositeCondition_ExceedMaxDepth_BatchGetRow() { - LOG.info("Start testCompositeCondition_ExceedMaxDepth_BatchGetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey); - - // test OR - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterWithMaxDepth(1000, CompositeCondition.LogicOperator.NOT)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个深度优先刚好超过和刚好不超过Filter个数限制的composite filter,测试GetRow操作。 - */ - @Test - public void testCompositeCondition_NotExceedMaxDepth_GetRow() { - LOG.info("Start testCompositeCondition_NotExceedMaxDepth_GetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - - // test OR - { - try { - criteria.setFilter(makeFilterWithMaxDepth(6, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(5, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - - // test AND - { - try { - criteria.setFilter(makeFilterWithMaxDepth(6, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(5, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterWithMaxDepth(11, CompositeCondition.LogicOperator.NOT)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(10, CompositeCondition.LogicOperator.NOT)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - } - - /** - * 构造一个深度优先刚好超过和刚好不超过Filter个数限制的composite filter,测试GetRange操作。 - */ - @Test - public void testCompositeCondition_NotExceedMaxDepth_GetRange() { - LOG.info("Start testCompositeCondition_NotExceedMaxDepth_GetRange"); - - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - - - // test OR - { - try { - criteria.setFilter(makeFilterWithMaxDepth(6, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(5, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - - // test AND - { - try { - criteria.setFilter(makeFilterWithMaxDepth(6, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(5, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterWithMaxDepth(11, CompositeCondition.LogicOperator.NOT)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(10, CompositeCondition.LogicOperator.NOT)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - } - - /** - * 构造一个深度优先刚好超过和刚好不超过Filter个数限制的composite filter,测试BatchGetRow操作。 - */ - @Test - public void testCompositeCondition_NotExceedMaxDepth_BatchGetRow() { - LOG.info("Start testCompositeCondition_NotExceedMaxDepth_BatchGetRow"); - - RowPrimaryKey primaryKey1 = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey primaryKey2 = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey1); - criteria.addRow(primaryKey2); - // test AND - { - try { - criteria.setFilter(makeFilterWithMaxDepth(6, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(5, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - - // test OR - { - try { - criteria.setFilter(makeFilterWithMaxDepth(6, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(5, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterWithMaxDepth(11, CompositeCondition.LogicOperator.NOT)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxDepth(10, CompositeCondition.LogicOperator.NOT)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - } - - /** - * 构造一个广度优先的超过Filter个数限制的单层composite filter,测试GetRow操作。 - */ - @Test - public void testCompositeCondition_ExceedMaxBreadth_GetRow() { - LOG.info("Start testCompositeCondition_ExceedMaxBreadth_GetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - // test OR - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.NOT)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个广度优先的超过Filter个数限制的单层composite filter,测试GetRange操作。 - */ - @Test - public void testCompositeCondition_ExceedMaxBreadth_GetRange() { - LOG.info("Start testCompositeCondition_ExceedMaxBreadth_GetRange"); - - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - - - // test OR - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.NOT)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个广度优先的超过Filter个数限制的单层composite filter,测试BatchGetRow操作。 - */ - @Test - public void testCompositeCondition_ExceedMaxBreadth_BatchGetRow() { - LOG.info("Start testCompositeCondition_ExceedMaxBreadth_BatchGetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey); - - // test OR - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterWithMaxBreadth(1000, CompositeCondition.LogicOperator.NOT)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个超过Filter个数限制的二叉树composite filter,测试GetRow操作。 - */ - @Test - public void testCompositeConditionInBinaryTree_ExceedMaxCount_GetRow() { - LOG.info("Start testCompositeConditionInBinaryTree_ExceedMaxCount_GetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - - // test OR - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.NOT)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个超过Filter个数限制的二叉树composite filter,测试GetRange操作。 - */ - @Test - public void testCompositeConditionInBinaryTree_ExceedMaxCount_GetRange() { - LOG.info("Start testCompositeConditionInBinaryTree_ExceedMaxCount_GetRange"); - - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - - - // test OR - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.NOT)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个超过Filter个数限制的二叉树composite filter,测试BatchGetRow操作。 - */ - @Test - public void testCompositeConditionInBinaryTreeExceedMaxCount_BatchGetRow() { - LOG.info("Start testCompositeConditionInBinaryTreeExceedMaxCount_BatchGetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey); - - // test OR - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test AND - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // test NOT - try { - criteria.setFilter(makeFilterInBinaryForm(1000, CompositeCondition.LogicOperator.NOT)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - - /** - * 构造一个广度优先的恰好超过和恰好不超过Filter个数限制的composite filter,测试GetRow操作。 - */ - @Test - public void testCompositeCondition_NotExceedMaxBreadth_GetRow() { - LOG.info("Start testCompositeCondition_NotExceedMaxBreadth_GetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - - // test OR - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.NOT)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - // 广度优先无法使用NOT,NOT只允许一个Filter - } - - // test AND - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - } - - /** - * 构造一个广度优先的恰好超过和恰好不超过Filter个数限制的composite filter,测试GetRange操作。 - */ - @Test - public void testCompositeCondition_NotExceedMaxBreadth_GetRange() { - LOG.info("Start testCompositeCondition_NotExceedMaxBreadth_GetRange"); - - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - - - // test OR - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - - } - - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - - // test AND - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.NOT)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - } - - /** - * 构造一个广度优先的恰好超过和恰好不超过Filter个数限制的composite filter,测试BatchGetRow操作。 - */ - @Test - public void testCompositeCondition_NotExceedMaxBreadth_BatchGetRow() { - LOG.info("Start testCompositeCondition_NotExceedMaxBreadth_BatchGetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey); - - // test OR - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - - // test AND - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterWithMaxBreadth(11, CompositeCondition.LogicOperator.NOT)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - } - - /** - * 构造一个恰好超过和恰好不超过Filter个数上限的二叉树的composite filter,测试GetRow操作。 - */ - @Test - public void testCompositeConditionInBinaryTree_NotExceedMaxCount_GetRow() { - LOG.info("Start testCompositeConditionInBinaryTree_NotExceedMaxCount_GetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - - // test OR - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - - // test AND - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.AND)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.NOT)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterWithMaxBreadth(10, CompositeCondition.LogicOperator.OR)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - ots.getRow(request); - } - } - - /** - * 构造一个恰好超过和恰好不超过Filter个数上限的二叉树的composite filter,测试GetRange操作。 - */ - @Test - public void testCompositeConditionInBinaryTree_NotExceedMaxCount_GetRange() { - LOG.info("Start testCompositeConditionInBinaryTree_NotExceedMaxCount_GetRange"); - - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - - - // test OR - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterInBinaryForm(10, CompositeCondition.LogicOperator.OR)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - - // test AND - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterInBinaryForm(10, CompositeCondition.LogicOperator.AND)); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - } - } - - /** - * 构造一个恰好超过和恰好不超过Filter个数上限的二叉树的composite filter,测试BatchGetRow操作。 - */ - @Test - public void testCompositeConditionInBinaryTree_NotExceedMaxCount_BatchGetRow() { - LOG.info("Start testCompositeConditionInBinaryTree_NotExceedMaxCount_BatchGetRow"); - - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey); - - // test OR - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterInBinaryForm(10, CompositeCondition.LogicOperator.OR)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - // test AND - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - criteria.setFilter(makeFilterInBinaryForm(10, CompositeCondition.LogicOperator.AND)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - assertEquals(result.getFailedRows().size(), 0); - } - - // test NOT - { - try { - criteria.setFilter(makeFilterInBinaryForm(11, CompositeCondition.LogicOperator.NOT)); - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - ots.batchGetRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(OTSErrorCode.INVALID_PARAMETER, "The number of column conditions exceeds the limit: 10.", 400, e); - } - } - } - - /** - * 构造一个长度超过BINARY/STRING列值最大长度的filter,类型分别是BINARY/STRING,期望被拒绝。分别测试单个relation filter,以及一个小的composite filter。 - */ - @Test - public void testValueExceedMaxLength() { - LOG.info("Start testValueExceedMaxLength"); - - // STRING - { - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - ColumnValue v = ColumnValue.fromString(NewString(2 * 1024 * 1024 + 1, 'a')); - RelationalCondition singleFilter = new RelationalCondition("Column", RelationalCondition.CompareOperator.EQUAL, v); - CompositeCondition compositeFilter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - compositeFilter.addCondition(singleFilter); - compositeFilter.addCondition(new RelationalCondition("Column1", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); - - OTSException lengthExceedExp = new OTSException( - "The length of attribute column: 'Column' exceeded the MaxLength:2097152 with CurrentLength:2097153.", - null, "OTSParameterInvalid", "", 400); - runAndExpectFail(singleFilter, lengthExceedExp); - runAndExpectFail(compositeFilter, lengthExceedExp); - } - - // BINARY - { - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - ColumnValue v = ColumnValue.fromBinary(new byte[2 * 1024 * 1024 + 1]); - RelationalCondition singleFilter = new RelationalCondition("Column", RelationalCondition.CompareOperator.EQUAL, v); - CompositeCondition compositeFilter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - compositeFilter.addCondition(singleFilter); - compositeFilter.addCondition(new RelationalCondition("Column1", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); - - OTSException lengthExceedExp = new OTSException( - "The length of attribute column: 'Column' exceeded the MaxLength:2097152 with CurrentLength:2097153.", - null, "OTSParameterInvalid", "", 400); - runAndExpectFail(singleFilter, lengthExceedExp); - runAndExpectFail(compositeFilter, lengthExceedExp); - } - } - - /** - * 构造 CompositeCondition 类型为 NOT,并且sub filter数量为2或9,期望出错。 - * 构造 CompositeCondition 类型为 AND/OR,并且sub filter数量为1,期望出错。 - */ - @Test - public void testLogicOperatorRestriction() { - LOG.info("Start testLogicOperatorRestriction"); - - CompositeCondition orFilter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - CompositeCondition andFilter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - CompositeCondition notFilter = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - - RelationalCondition singleFilter = new RelationalCondition("Column", RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(false)); - orFilter.addCondition(singleFilter); - andFilter.addCondition(singleFilter); - - OTSException exp = new OTSException("The input parameter is invalid.", null, "OTSParameterInvalid", "", 400); - runAndExpectFail(orFilter, exp); - runAndExpectFail(andFilter, exp); - - for (int i = 0; i < 2; i++) { - notFilter.addCondition(singleFilter); - } - runAndExpectFail(notFilter, exp); - - notFilter.clear(); - for (int i = 0; i < 9; i++) { - notFilter.addCondition(singleFilter); - } - runAndExpectFail(notFilter, exp); - } - - private void runAndExpectFail(ColumnCondition filter, OTSException exp) { - // GetRow - { - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - criteria.setFilter(filter); - - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - - try { - ots.getRow(request); - fail(); - } catch (OTSException e) { - assertOTSException(exp.getErrorCode(), exp.getMessage(), exp.getHttpStatus(), e); - } - } - - // GetRange - { - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - criteria.setFilter(filter); - - - try { - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - ots.getRange(request); - fail(); - } catch (OTSException e) { - assertOTSException(exp.getErrorCode(), exp.getMessage(), exp.getHttpStatus(), e); - } - } - - // BatchGetRow - { - RowPrimaryKey primaryKey = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey); - criteria.setFilter(filter); - - try { - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - BatchGetRowResult result = ots.batchGetRow(request); - if (!result.isAllSucceed()) { - assertEquals(result.getFailedRows().size(), 1); - assertEquals(result.getFailedRows().get(0).getError().getCode(), exp.getErrorCode()); - assertEquals(result.getFailedRows().get(0).getError().getMessage(), exp.getMessage()); - } else { - fail(); - } - } catch (OTSException e) { - assertOTSException(exp.getErrorCode(), exp.getMessage(), exp.getHttpStatus(), e); - } - } - } - - /** - * 构造一个一层的composite filter,里面包含AND或者OR,含有9个relation filter,每个relational filter的列名不一样,分别为[C1, C2 ... C9], - * 分别测试GetRow/BatchGetRow/GetRange 3种请求,包含128列,列名长度255,列名分别为[C1, C2, ... C128], 类型为STRING或者BINARY, - * Column大小为2K,使该行总大小为256KB。期望正常返回。 - * - * Public模型下单行的数据量最大为256KB。 - */ - @Test - public void testColumnNameMaxLength() { - LOG.info("Start testColumnNameMaxLength"); - - RowPrimaryKey primaryKey = - new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - ColumnValue columnValue = ColumnValue.fromString(NewString(2 * 896, 'c')); - - for (int i = 0; i < 16; i++) { - UpdateRowRequest pr = new UpdateRowRequest(); - RowUpdateChange rowChange = new RowUpdateChange(tableName); - rowChange.setPrimaryKey(primaryKey); - for (int j = 0; j < 8; j++) { - rowChange.addAttributeColumn(String.format("C%0254d", i * 8 + j), columnValue); - } - - pr.setRowChange(rowChange); - ots.updateRow(pr); - } - - { - CompositeCondition compositeFilter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - for (int i = 0; i < 9; i++) { - compositeFilter.addCondition(new RelationalCondition(String.format("C%0254d", i), RelationalCondition.CompareOperator.EQUAL, columnValue)); - } - testFilterWithMaxNameLength(compositeFilter); - } - { - CompositeCondition compositeFilter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - for (int i = 0; i < 9; i++) { - compositeFilter.addCondition(new RelationalCondition(String.format("C%0254d", i), RelationalCondition.CompareOperator.EQUAL, columnValue)); - } - testFilterWithMaxNameLength(compositeFilter); - } - } - - private void testFilterWithMaxNameLength(CompositeCondition compositeFilter) { - LOG.info("Start testFilterWithMaxNameLength"); - - RowPrimaryKey primaryKey = - new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - ColumnValue columnValue = ColumnValue.fromString(NewString(2 * 896, 'c')); - - List rows = new ArrayList(); - - LOG.info("get row"); - { - - GetRowRequest request = new GetRowRequest(); - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(primaryKey); - - criteria.setFilter(compositeFilter); - request.setRowQueryCriteria(criteria); - - GetRowResult result = ots.getRow(request); - rows.add(result.getRow()); - } - - LOG.info("get range"); - { - RowPrimaryKey begin = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(0)); - RowPrimaryKey end = new RowPrimaryKey().addPrimaryKeyColumn("PK0", PrimaryKeyValue.fromLong(10)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(begin); - criteria.setExclusiveEndPrimaryKey(end); - - criteria.setFilter(compositeFilter); - - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - GetRangeResult result = ots.getRange(request); - assertEquals(result.getRows().size(), 1); - rows.add(result.getRows().get(0)); - } - - LOG.info("batch get row"); - { - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName); - - criteria.addRow(primaryKey); - criteria.setFilter(compositeFilter); - - BatchGetRowRequest request = new BatchGetRowRequest(); - request.addMultiRowQueryCriteria(criteria); - - BatchGetRowResult result = ots.batchGetRow(request); - assertTrue(result.isAllSucceed()); - assertEquals(result.getSucceedRows().size(), 1); - rows.add(result.getSucceedRows().get(0).getRow()); - } - - LOG.info("check result"); - for (Row row : rows) { - Row expect = new Row(); - expect.addColumn("PK0", ColumnValue.fromLong(0)); - for (int i = 0; i < 128; i++) { - expect.addColumn(String.format("C%0254d", i), ColumnValue.fromString(NewString(2 * 896, 'c'))); - } - checkRow(expect, row); - } - } - - private String NewString(int length, char a) { - char[] cs = new char[length]; - for (int i = 0; i < cs.length; i++) { - cs[i] = a; - } - return new String(cs); - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/integration/OTSClientFactory.java b/src/test/java/com/aliyun/openservices/ots/integration/OTSClientFactory.java deleted file mode 100644 index 656100f..0000000 --- a/src/test/java/com/aliyun/openservices/ots/integration/OTSClientFactory.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.aliyun.openservices.ots.integration; - -import static com.aliyun.openservices.ots.utils.CodingUtils.isNullOrEmpty; - -import java.util.concurrent.ExecutorService; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.OTSAsync; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.OTSClientAsync; -import com.aliyun.openservices.ots.OTSServiceConfiguration; -import com.aliyun.openservices.ots.utils.ServiceSettings; - -public class OTSClientFactory { - - public static OTS createOTSClient() { - return createOTSClient(ServiceSettings.load()); - } - - public static OTS createOTSClient(ServiceSettings ss){ - ClientConfiguration config = new ClientConfiguration(); - config.setConnectionTimeoutInMillisecond(30 * 1000); - config.setSocketTimeoutInMillisecond(30 * 1000); - - return createOTSClient(ss, config); - } - - public static OTS createOTSClient(ServiceSettings ss, ClientConfiguration config){ - String otsEndpoint = ss.getOTSEndpoint(); - String accessKeyId = ss.getOTSAccessKeyId(); - String accessKeySecret = ss.getOTSAccessKeySecret(); - String instanceName = ss.getOTSInstanceName(); - OTSServiceConfiguration osc = new OTSServiceConfiguration(); - osc.setEnableResponseContentMD5Checking(true); - - return new OTSClient(otsEndpoint, accessKeyId, accessKeySecret, instanceName, config, osc); - } - - public static OTS createOTSClient(ServiceSettings ss, ClientConfiguration config, OTSServiceConfiguration serviceConfig){ - String otsEndpoint = ss.getOTSEndpoint(); - String accessKeyId = ss.getOTSAccessKeyId(); - String accessKeySecret = ss.getOTSAccessKeySecret(); - String instanceName = ss.getOTSInstanceName(); - - return new OTSClient(otsEndpoint, accessKeyId, accessKeySecret, instanceName, config, serviceConfig); - } - - public static OTSAsync createOTSClientAsync() { - return createOTSClientAsync(ServiceSettings.load()); - } - - public static OTSAsync createOTSClientAsync(ServiceSettings ss){ - ClientConfiguration config = new ClientConfiguration(); - if (!isNullOrEmpty(ss.getProxyHost())) { - config.setProxyHost(ss.getProxyHost()); - config.setProxyPort(ss.getProxyPort()); - } - return createOTSClientAsync(ss, config); - } - - public static OTSAsync createOTSClientAsync(ServiceSettings ss, ClientConfiguration config){ - String otsEndpoint = ss.getOTSEndpoint(); - String accessKeyId = ss.getOTSAccessKeyId(); - String accessKeySecret = ss.getOTSAccessKeySecret(); - String instanceName = ss.getOTSInstanceName(); - OTSServiceConfiguration osc = new OTSServiceConfiguration(); - osc.setEnableResponseContentMD5Checking(true); - return new OTSClientAsync(otsEndpoint, accessKeyId, accessKeySecret, instanceName, config, osc, null); - } - - public static OTSAsync createOTSClientAsync(ServiceSettings ss, ClientConfiguration config, ExecutorService pool){ - String otsEndpoint = ss.getOTSEndpoint(); - String accessKeyId = ss.getOTSAccessKeyId(); - String accessKeySecret = ss.getOTSAccessKeySecret(); - String instanceName = ss.getOTSInstanceName(); - OTSServiceConfiguration osc = new OTSServiceConfiguration(); - osc.setEnableResponseContentMD5Checking(true); - return new OTSClientAsync(otsEndpoint, accessKeyId, accessKeySecret, instanceName, config, osc, pool); - } - - public static OTSAsync createOTSClientAsync(ServiceSettings ss, ClientConfiguration config, OTSServiceConfiguration serviceConfig){ - String otsEndpoint = ss.getOTSEndpoint(); - String accessKeyId = ss.getOTSAccessKeyId(); - String accessKeySecret = ss.getOTSAccessKeySecret(); - String instanceName = ss.getOTSInstanceName(); - return new OTSClientAsync(otsEndpoint, accessKeyId, accessKeySecret, instanceName, config, serviceConfig, null); - } - - public static OTSAsync createOTSClientAsync(ServiceSettings ss, ClientConfiguration config, OTSServiceConfiguration serviceConfig, ExecutorService pool){ - String otsEndpoint = ss.getOTSEndpoint(); - String accessKeyId = ss.getOTSAccessKeyId(); - String accessKeySecret = ss.getOTSAccessKeySecret(); - String instanceName = ss.getOTSInstanceName(); - return new OTSClientAsync(otsEndpoint, accessKeyId, accessKeySecret, instanceName, config, serviceConfig, pool); - } - -} diff --git a/src/test/java/com/aliyun/openservices/ots/integration/OTSClientTest.java b/src/test/java/com/aliyun/openservices/ots/integration/OTSClientTest.java deleted file mode 100644 index c59f252..0000000 --- a/src/test/java/com/aliyun/openservices/ots/integration/OTSClientTest.java +++ /dev/null @@ -1,1542 +0,0 @@ -package com.aliyun.openservices.ots.integration; - -import static com.aliyun.openservices.ots.OTSErrorCode.*; -import static org.junit.Assert.*; - -import java.util.*; -import java.util.Map.Entry; -import java.util.logging.Logger; - -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.utils.TestUtil; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.utils.ServiceSettings; - - -public class OTSClientTest { - private static final int MILLISECONDS_UNTIL_TABLE_READY = 10 * 1000; - private static final int TABLE_OPERATION_INTERVAL_IN_MSEC = 1 * 1000; - - private static String tableName = TestUtil.newTableName("ots_client_test_table"); - private static final OTS ots = OTSClientFactory.createOTSClient(ServiceSettings.load()); - - private static final Logger LOG = Logger.getLogger(OTSClientTest.class.getName()); - - @AfterClass - public static void classAfter() { - TestUtil.DeleteTable(ots, tableName); - ots.shutdown(); - } - - @Before - public void setup() throws Exception { - LOG.info("Instance: " + ServiceSettings.load().getOTSInstanceName()); - - TestUtil.DeleteTable(ots, tableName); - } - - @Test - public void testTableOperation() throws Exception { - LOG.info("Start testTableOperation"); - - LOG.info("create table"); - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(tableCU); - ots.createTable(request); - - LOG.info("list table to check table is exist"); - List tableNames = ots.listTable().getTableNames(); - assertTrue(tableNames.contains(tableName)); - - LOG.info("get table meta and check table meta"); - DescribeTableRequest dtRequest = new DescribeTableRequest(tableName); - DescribeTableResult dtResult = ots.describeTable(dtRequest); - TableMeta meta = dtResult.getTableMeta(); - compareTableMeta(meta, tableMeta); - assertTrue(dtResult.getReservedThroughputDetails().getLastIncreaseTime() != 0); - assertEquals(dtResult.getReservedThroughputDetails().getLastDecreaseTime(), 0); - assertEquals(dtResult.getReservedThroughputDetails().getNumberOfDecreasesToday(), 0); - - LOG.info("update table"); - LOG.info("decrease read capacity"); - Thread.sleep(70 * 1000 + 10); // sleep more than 70 seconds - UpdateTableRequest utRequest = new UpdateTableRequest(tableName); - ReservedThroughputChange capacityChange = new ReservedThroughputChange(); - capacityChange.setReadCapacityUnit(1); - utRequest.setReservedThroughputChange(capacityChange); - UpdateTableResult utResponse = ots.updateTable(utRequest); - assertTrue(utResponse.getReservedThroughputDetails().getLastDecreaseTime() != 0); - assertTrue(utResponse.getReservedThroughputDetails().getLastIncreaseTime() != 0); - assertEquals(utResponse.getReservedThroughputDetails().getNumberOfDecreasesToday(), 1); - assertEquals(utResponse.getReservedThroughputDetails().getCapacityUnit().getReadCapacityUnit(), 1); - assertEquals(utResponse.getReservedThroughputDetails().getCapacityUnit().getWriteCapacityUnit(), 3); - - LOG.info("get table meta and check table is updated"); - dtResult = ots.describeTable(dtRequest); - compareTableMeta(tableMeta,dtResult.getTableMeta()); - assertTrue(dtResult.getReservedThroughputDetails().getLastDecreaseTime() != 0); - assertTrue(dtResult.getReservedThroughputDetails().getLastIncreaseTime() != 0); - assertEquals(dtResult.getReservedThroughputDetails().getNumberOfDecreasesToday(), 1); - assertEquals(dtResult.getReservedThroughputDetails().getCapacityUnit().getReadCapacityUnit(), 1); - assertEquals(dtResult.getReservedThroughputDetails().getCapacityUnit().getWriteCapacityUnit(), 3); - - LOG.info("decrease write capacity"); - Thread.sleep(70 * 1000 + 10); // sleep more than 70 seconds - capacityChange = new ReservedThroughputChange(); - capacityChange.setWriteCapacityUnit(2); - utRequest.setReservedThroughputChange(capacityChange); - utResponse = ots.updateTable(utRequest); - assertTrue(utResponse.getReservedThroughputDetails().getLastDecreaseTime() != 0); - assertTrue(utResponse.getReservedThroughputDetails().getLastIncreaseTime() != 0); - assertEquals(utResponse.getReservedThroughputDetails().getNumberOfDecreasesToday(), 2); - assertEquals(utResponse.getReservedThroughputDetails().getCapacityUnit().getReadCapacityUnit(), 1); - assertEquals(utResponse.getReservedThroughputDetails().getCapacityUnit().getWriteCapacityUnit(), 2); - - LOG.info("get table meta and check table is updated"); - dtResult = ots.describeTable(dtRequest); - compareTableMeta(tableMeta,dtResult.getTableMeta()); - assertTrue(dtResult.getReservedThroughputDetails().getLastDecreaseTime() != 0); - assertTrue(dtResult.getReservedThroughputDetails().getLastIncreaseTime() != 0); - assertEquals(dtResult.getReservedThroughputDetails().getNumberOfDecreasesToday(), 2); - assertEquals(dtResult.getReservedThroughputDetails().getCapacityUnit().getReadCapacityUnit(), 1); - assertEquals(dtResult.getReservedThroughputDetails().getCapacityUnit().getWriteCapacityUnit(), 2); - - LOG.info("delete table"); - DeleteTableRequest delRequest = new DeleteTableRequest(tableName); - ots.deleteTable(delRequest); - Thread.sleep(5000); - - LOG.info("list table to check table is not exist"); - tableNames = ots.listTable().getTableNames(); - assertTrue(!tableNames.contains(tableName)); - } - - private void compareTableMeta(TableMeta meta, TableMeta tableMeta) { - assertEquals(meta.getTableName(), tableMeta.getTableName()); - Map pks1 = meta.getPrimaryKey(); - Map pks2 = tableMeta.getPrimaryKey(); - assertEquals(pks1.size(), pks2.size()); - for (Entry entry : pks1.entrySet()) { - assertTrue(pks2.containsKey(entry.getKey())); - assertEquals(pks2.get(entry.getKey()), entry.getValue()); - } - } - - @Test - public void testGetRowOperation() throws Exception { - LOG.info("Start testGetRowOperation"); - - // create table - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest ctRequest = new CreateTableRequest(); - ctRequest.setTableMeta(tableMeta); - ctRequest.setReservedThroughput(tableCU); - ots.createTable(ctRequest); - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - // put some rows for test - generateDataForTest(tableName, 1, 10); - - // get an exist row and all columns - SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); - rowQueryCriteria.setPrimaryKey(getRowPrimaryKeys(3)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(rowQueryCriteria); - GetRowResult result = ots.getRow(request); - compareRow(result.getRow(), 3, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_boolean", "col_double", "col_binary"}); - - // get an exist row and specific columns (some columns are not exist) - rowQueryCriteria = new SingleRowQueryCriteria(tableName); - rowQueryCriteria.setPrimaryKey(getRowPrimaryKeys(5)); - rowQueryCriteria.addColumnsToGet(new String[]{"name", "flag", "col_integer", "col_string", "non_exist_row", "col_boolean", "non_exist_row1", "non_exist_row2"}); - request = new GetRowRequest(); - request.setRowQueryCriteria(rowQueryCriteria); - result = ots.getRow(request); - compareRow(result.getRow(), 5, new String[]{"name", "flag", "col_integer", "col_string", "col_boolean"}); - - // get an non-exist row - rowQueryCriteria = new SingleRowQueryCriteria(tableName); - rowQueryCriteria.setPrimaryKey(getRowPrimaryKeys(99)); - request = new GetRowRequest(); - request.setRowQueryCriteria(rowQueryCriteria); - result = ots.getRow(request); - compareRow(result.getRow(), 99, new String[]{}); - - // get row with invalid meta, expect exception - rowQueryCriteria = new SingleRowQueryCriteria(tableName); - RowPrimaryKey pks = getRowPrimaryKeys(3); - pks.addPrimaryKeyColumn("non_exist_pk", PrimaryKeyValue.fromLong(1)); - rowQueryCriteria.setPrimaryKey(pks); - request = new GetRowRequest(); - request.setRowQueryCriteria(rowQueryCriteria); - try { - result = ots.getRow(request); - fail("Expect exception: get row with invalid meta."); - } catch (OTSException e) { - } - } - - @Test - public void testPutRowOperation() throws Exception { - LOG.info("Start testPutRowOperation"); - - // create table - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest ctRequest = new CreateTableRequest(); - ctRequest.setTableMeta(tableMeta); - ctRequest.setReservedThroughput(tableCU); - ots.createTable(ctRequest); - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - - /* put an row, get it and check all columns, also check consumed capacity unit */ - // put some rows for test - generateDataForTest(tableName, 1, 10); - - // put an non-exist row with IGNORE - { - RowPutChange rowChange = new RowPutChange(tableName); - int i = 99; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("col_string", getColString(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - PutRowResult result = ots.putRow(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string"}); - } - // put an non-exist row with EXPECT_EXIST, expect exception - { - RowPutChange rowChange = new RowPutChange(tableName); - int i = 98; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("col_string", getColString(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - try { - ots.putRow(request); - fail("Expect exception: put a non-exist row but expect exist."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), CONDITION_CHECK_FAIL); - } - } - - // put an non-exist row with EXPECT_NOT_EXIST - { - RowPutChange rowChange = new RowPutChange(tableName); - int i = 97; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("col_binary", getColBinary(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST); - rowChange.setCondition(condition); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - PutRowResult result = ots.putRow(request); - assertEquals(1, result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_binary"}); - } - - // put an exist row with IGNORE, with some new columns - { - RowPutChange rowChange = new RowPutChange(tableName); - int i = 3; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("col_boolean", getColBoolean(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_double", getColDouble(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - PutRowResult result = ots.putRow(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_boolean", "newrow_integer", "newrow_double"}); - } - - // put an exist row with EXPECT_EXIST, with some new columns - { - RowPutChange rowChange = new RowPutChange(tableName); - int i = 5; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("col_binary", getColBinary(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_boolean", getColBoolean(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - PutRowResult result = ots.putRow(request); - assertEquals(1, result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_binary", "newrow_integer", "newrow_boolean"}); - } - - // put an exist row with EXPECT_NOT_EXIST, expect exception - { - RowPutChange rowChange = new RowPutChange(tableName); - int i = 7; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("col_string", getColString(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST); - rowChange.setCondition(condition); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - try { - ots.putRow(request); - fail("Expect exception: put an exist row but expect not exist."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), CONDITION_CHECK_FAIL); - } - } - } - - @Test - public void testUpdateRowOperation() throws Exception { - LOG.info("Start testUpdateRowOperation"); - - // create table - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest ctRequest = new CreateTableRequest(); - ctRequest.setTableMeta(tableMeta); - ctRequest.setReservedThroughput(tableCU); - ots.createTable(ctRequest); - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - - // put some rows for test - generateDataForTest(tableName, 1, 10); - - /* update an row, get it and check all columns, also check consumed capacity unit */ - // update an non-exist row with IGNORE - { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - int i = 88; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.deleteAttributeColumn("col_integer"); - rowChange.deleteAttributeColumn("newrow_string"); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - UpdateRowResult result = ots.updateRow(request); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(0, result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); - - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{"uid", "name", "sid", "flag", "newrow_integer"}); - } - - // update an non-exist row with EXPECT_EXIST, expect exception - { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - int i = 87; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.deleteAttributeColumn("col_integer"); - rowChange.deleteAttributeColumn("newrow_string"); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - try { - ots.updateRow(request); - fail("Expect exception: update a non-exist row but expect exist."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), CONDITION_CHECK_FAIL); - } - } - - // update an non-exist row with EXPECT_NOT_EXIST, expect exception - { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - int i = 86; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST); - rowChange.setCondition(condition); - - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.deleteAttributeColumn("col_integer"); - rowChange.deleteAttributeColumn("newrow_string"); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - try { - ots.updateRow(request); - fail("Expect exception: update row and expect row not exist."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), "OTSParameterInvalid"); - } - } - - // update an exist row with IGNORE, add some new columns and delete some columns - { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - int i = 3; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.deleteAttributeColumn("col_integer"); - rowChange.deleteAttributeColumn("col_string"); - rowChange.deleteAttributeColumn("newrow_string"); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - UpdateRowResult result = ots.updateRow(request); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{"uid", "name", "sid", "flag", "newrow_integer", "col_double", "col_boolean", "col_binary"}); - } - - // update an exist-row, modify some old columns - { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - int i = 88; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - - rowChange.addAttributeColumn("col_integer", ColumnValue.fromString("hello world")); - rowChange.addAttributeColumn("col_boolean", ColumnValue.fromString("hello world")); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.deleteAttributeColumn("col_integer"); - rowChange.deleteAttributeColumn("newrow_string"); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - UpdateRowResult result = ots.updateRow(request); - - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - - CheckSpecificColumn(tableName, i, "col_boolean", ColumnValue.fromString("hello world")); - } - - // update an exist row with EXPECT_EXIST - { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - int i = 5; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.deleteAttributeColumn("col_integer"); - rowChange.deleteAttributeColumn("col_string"); - rowChange.deleteAttributeColumn("newrow_string"); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - UpdateRowResult result = ots.updateRow(request); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(1, result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); - - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{"uid", "name", "sid", "flag", "newrow_integer", "col_double", "col_boolean", "col_binary"}); - } - - // update an exist row with EXPECT_NOT_EXIST, expect exception - { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - int i = 1; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST); - rowChange.setCondition(condition); - - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("newrow_integer", getColInteger(i)); - rowChange.deleteAttributeColumn("col_integer"); - rowChange.deleteAttributeColumn("newrow_string"); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - try { - ots.updateRow(request); - fail("Expect exception: update row and expect row not exist."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), "OTSParameterInvalid"); - } - } - } - - @Test - public void testDeleteRowOperation() throws Exception { - LOG.info("Start testDeleteRowOperation"); - - // create table - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest ctRequest = new CreateTableRequest(); - ctRequest.setTableMeta(tableMeta); - ctRequest.setReservedThroughput(tableCU); - ots.createTable(ctRequest); - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - - // put some rows for test - generateDataForTest(tableName, 1, 10); - - /* delete an row, get it and check if the row is deleted, also check consumed capacity unit */ - // delete an non-exist row with IGNORE - { - RowDeleteChange rowChange = new RowDeleteChange(tableName); - int i = 99; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - DeleteRowResult result = ots.deleteRow(request); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{}); - } - - // delete an non-exist row with EXPECT_EXIST, expect exception - { - RowDeleteChange rowChange = new RowDeleteChange(tableName); - int i = 88; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - try { - ots.deleteRow(request); - fail("Expect exception: delete a non-exist row and expect it exists."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), CONDITION_CHECK_FAIL); - } - } - - // delete an non-exist row with EXPECT_NOT_EXIST, expect exception - { - RowDeleteChange rowChange = new RowDeleteChange(tableName); - int i = 77; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST); - rowChange.setCondition(condition); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - try { - ots.deleteRow(request); - fail("Expect exception: delete a non-exist row and expect it not exists."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), "OTSParameterInvalid"); - } - } - - // delete an exist row with IGNORE - { - RowDeleteChange rowChange = new RowDeleteChange(tableName); - int i = 3; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - DeleteRowResult result = ots.deleteRow(request); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{}); - } - - // delete an exist row with EXPECT_EXIST - { - RowDeleteChange rowChange = new RowDeleteChange(tableName); - int i = 5; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - DeleteRowResult result = ots.deleteRow(request); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(1, result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); - - Row row = readRow(tableName, i); - compareRow(row, i, new String[]{}); - } - - // delete an exist row with EXPECT_NOT_EXIST, expect exception - { - RowDeleteChange rowChange = new RowDeleteChange(tableName); - int i = 7; - rowChange.setPrimaryKey(getRowPrimaryKeys(i)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST); - rowChange.setCondition(condition); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - try { - ots.deleteRow(request); - fail("Expect exception: delete a non-exist row and expect it not exists."); - } catch (OTSException e) { - assertEquals(e.getErrorCode(), "OTSParameterInvalid"); - } - } - } - - @Test - public void testGetRange() throws Exception { - LOG.info("Start testGetRange"); - - // create table - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest ctRequest = new CreateTableRequest(); - ctRequest.setTableMeta(tableMeta); - ctRequest.setReservedThroughput(tableCU); - ots.createTable(ctRequest); - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - - // put some rows for test - generateDataForTest(tableName, 0, 10000); - - // test get range each time with one primary key value range from INF_MIN to INF_MAX and other primary key in a specific value - { - LOG.info("test flag from INF_MIN to INF_MAX"); - int i = 3; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("flag", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("flag", PrimaryKeyValue.INF_MAX); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - criteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - GetRangeResult result = ots.getRange(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit() != 0); - - assertEquals(result.getNextStartPrimaryKey(), null); - assertEquals(result.getRows().size(), 1); - compareRow(result.getRows().get(0), i, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_boolean", "col_double", "col_binary"}); - } - { - LOG.info("test name from INF_MIN to INF_MAX"); - int i = 3; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("name", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("name", PrimaryKeyValue.INF_MAX); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - criteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - GetRangeResult result = ots.getRange(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit() != 0); - - assertEquals(result.getNextStartPrimaryKey(), null); - assertEquals(result.getRows().size(), 1); - compareRow(result.getRows().get(0), i, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_boolean", "col_double", "col_binary"}); - } - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - criteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - GetRangeResult result = ots.getRange(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit() != 0); - - assertTrue(result.getNextStartPrimaryKey() != null); - assertEquals(result.getRows().size(), result.getNextStartPrimaryKey().getPrimaryKey().get("uid").asLong()); - int index = 0; - for (Row row : result.getRows()) { - compareRow(row, index, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_boolean", "col_double", "col_binary"}); - index++; - } - } - - { - LOG.info("test get range in primary keys all in different value"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - // [0,'00001',2 -> 100,'00099',0), total 99 rows - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(0)); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("name", PrimaryKeyValue.fromString("00001")); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("flag", PrimaryKeyValue.fromLong(2)); - - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(100)); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("name", PrimaryKeyValue.fromString("00099")); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("flag", PrimaryKeyValue.fromLong(0)); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - criteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - criteria.addColumnsToGet(new String[]{"col_integer", "col_string", "col_binary"}); - - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - GetRangeResult result = ots.getRange(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit() != 0); - - assertTrue(result.getNextStartPrimaryKey() == null); - assertEquals(result.getRows().size(), 99); - int index = 1; - for (Row row : result.getRows()) { - compareRow(row, index, new String[]{"col_integer", "col_string", "col_binary"}); - index++; - } - } - - // test get range with limit - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - criteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - int limit = 999; - criteria.setLimit(limit); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - GetRangeResult result = ots.getRange(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit() != 0); - - assertTrue(result.getNextStartPrimaryKey() != null); - assertEquals(result.getRows().size(), limit); - int index = 0; - for (Row row : result.getRows()) { - compareRow(row, index, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_boolean", "col_double", "col_binary"}); - index++; - } - } - - // test get a large range, expect next start key is returned, and with next start key, we can read all rows in the range - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - criteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - int limit = 999; - criteria.setLimit(limit); - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - GetRangeResult result = ots.getRange(request); - assertEquals(result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(), 0); - assertTrue(result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit() != 0); - - assertTrue(result.getNextStartPrimaryKey() != null); - assertEquals(result.getRows().size(), limit); - int index = 0; - for (Row row : result.getRows()) { - compareRow(row, index, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_boolean", "col_double", "col_binary"}); - index++; - } - } - - // test get a large range with iterator, expect all rows in range is returned - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeIteratorParameter parameter = new RangeIteratorParameter(tableName); - parameter.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - parameter.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - - List allRows = new ArrayList(); - Iterator iter = ots.createRangeIterator(parameter); - while (iter.hasNext()) { - allRows.add(iter.next()); - } - assertEquals(allRows.size(), 10000); - - int index = 0; - for (Row row : allRows) { - compareRow(row, index, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_boolean", "col_double", "col_binary"}); - index++; - } - } - - // test get a large range with iterator, set limit, expect all rows in range is returned - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeIteratorParameter parameter = new RangeIteratorParameter(tableName); - parameter.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - parameter.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - int count = 4000; - parameter.setCount(count); - parameter.addColumnsToGet(new String[]{"col_integer", "col_string", "col_binary", "uid"}); - - List allRows = new ArrayList(); - Iterator iter = ots.createRangeIterator(parameter); - while (iter.hasNext()) { - allRows.add(iter.next()); - } - assertEquals(allRows.size(), count); - - int index = 0; - for (Row row : allRows) { - compareRow(row, index, new String[]{"uid", "col_integer", "col_string", "col_binary"}); - index++; - } - } - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeIteratorParameter parameter = new RangeIteratorParameter(tableName); - parameter.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - parameter.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - int count = 4000; - parameter.setCount(count); - parameter.setBufferSize(1000); - parameter.addColumnsToGet(new String[]{"col_integer", "col_string", "col_binary", "uid"}); - - List allRows = new ArrayList(); - Iterator iter = ots.createRangeIterator(parameter); - while (iter.hasNext()) { - allRows.add(iter.next()); - } - assertEquals(allRows.size(), count); - - int index = 0; - for (Row row : allRows) { - compareRow(row, index, new String[]{"uid", "col_integer", "col_string", "col_binary"}); - index++; - } - } - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeIteratorParameter parameter = new RangeIteratorParameter(tableName); - parameter.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - parameter.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - parameter.addColumnsToGet(new String[]{"col_integer", "col_string", "col_binary", "uid"}); - - List allRows = new ArrayList(); - Iterator iter = ots.createRangeIterator(parameter); - while (iter.hasNext()) { - allRows.add(iter.next()); - } - assertEquals(allRows.size(), 10000); - - int index = 0; - for (Row row : allRows) { - compareRow(row, index, new String[]{"uid", "col_integer", "col_string", "col_binary"}); - index++; - } - } - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeIteratorParameter parameter = new RangeIteratorParameter(tableName); - parameter.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - parameter.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - parameter.addColumnsToGet(new String[]{"col_integer", "col_string", "col_binary", "uid"}); - parameter.setBufferSize(1000); - - List allRows = new ArrayList(); - Iterator iter = ots.createRangeIterator(parameter); - while (iter.hasNext()) { - allRows.add(iter.next()); - } - assertEquals(allRows.size(), 10000); - - int index = 0; - for (Row row : allRows) { - compareRow(row, index, new String[]{"uid", "col_integer", "col_string", "col_binary"}); - index++; - } - } - { - LOG.info("test uid from INF_MIN to INF_MAX"); - int i = 0; - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(i); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(i); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MIN); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.INF_MAX); - - RangeIteratorParameter parameter = new RangeIteratorParameter(tableName); - parameter.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - parameter.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - int count = 4000; - parameter.setCount(count); - parameter.setBufferSize(5000); - parameter.addColumnsToGet(new String[]{"col_integer", "col_string", "col_binary", "uid"}); - - List allRows = new ArrayList(); - Iterator iter = ots.createRangeIterator(parameter); - while (iter.hasNext()) { - allRows.add(iter.next()); - } - assertEquals(allRows.size(), count); - - int index = 0; - for (Row row : allRows) { - compareRow(row, index, new String[]{"uid", "col_integer", "col_string", "col_binary"}); - index++; - } - } - - { - LOG.info("test a really large data set"); - generateDataForTest(tableName, 1000, 59999); - // test uid from 1000 to 100001 - RowPrimaryKey inclusiveStartPrimaryKey = getRowPrimaryKeys(0); - RowPrimaryKey exclusiveEndPrimaryKey = getRowPrimaryKeys(0); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(0)); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(100001)); - - RangeIteratorParameter parameter = new RangeIteratorParameter(tableName); - parameter.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - parameter.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - int count = 34567; - parameter.setCount(count); - parameter.addColumnsToGet(new String[]{"uid", "name", "col_boolean", "col_double", "col_binary"}); - - List allRows = new ArrayList(); - Iterator iter = ots.createRangeIterator(parameter); - while (iter.hasNext()) { - allRows.add(iter.next()); - } - assertEquals(allRows.size(), count); - - int index = 0; - for (Row row : allRows) { - compareRow(row, index, new String[]{"uid", "name", "col_boolean", "col_double", "col_binary"}); - index++; - } - } - } - - @Test - public void testBatchGetRow() throws Exception { - LOG.info("Start testBatchGetRow"); - - final int TABLE_COUNT = 10; - final int ROW_COUNT = 100; - // create table - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest ctRequest = new CreateTableRequest(); - ctRequest.setTableMeta(tableMeta); - ctRequest.setReservedThroughput(tableCU); - String[] tableNames = new String[TABLE_COUNT]; - for (int i = 0; i < TABLE_COUNT; i++) { - tableNames[i] = tableName + "_" + i; - TestUtil.DeleteTable(ots, tableNames[i]); - Thread.sleep(TABLE_OPERATION_INTERVAL_IN_MSEC); - - tableMeta.setTableName(tableNames[i]); - ctRequest.setTableMeta(tableMeta); - ots.createTable(ctRequest); - } - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - for (int i = 0; i < TABLE_COUNT; i++) { - generateDataForTest(tableNames[i], i * ROW_COUNT, i * ROW_COUNT + ROW_COUNT); - } - - // test batch get rows, expect all rows is returned, and all rows is in the right index - BatchGetRowRequest request = new BatchGetRowRequest(); - int rowsGet = 1; - for (int i = 0; i < TABLE_COUNT; i++) { - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableNames[i]); - for (int j = 0; j < rowsGet; j++) { - criteria.addRow(getRowPrimaryKeys(i * ROW_COUNT + j)); - request.addMultiRowQueryCriteria(criteria); - } - criteria.addColumnsToGet(new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_binary"}); - } - - BatchGetRowResult result = ots.batchGetRow(request); - for (int i = 0; i < TABLE_COUNT; i++) { - List status = result.getBatchGetRowStatus(tableNames[i]); - assertEquals(status.size(), rowsGet); - for (int j = 0; j < rowsGet; j++) { - assertTrue(status.get(j).isSucceed()); - assertTrue(status.get(j).getConsumedCapacity().getCapacityUnit().getReadCapacityUnit() != 0); - assertEquals(status.get(j).getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(), 0); - Row row = status.get(j).getRow(); - compareRow(row, i * ROW_COUNT + j, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string", "col_binary"}); - } - } - - for (int i = 0; i < TABLE_COUNT; i++) { - TestUtil.DeleteTable(ots, tableNames[i]); - } - } - - @Test - public void testBatchWriteRow() throws Exception { - LOG.info("Start testBatchWriteRow"); - - final int TABLE_COUNT = 10; - final int ROW_COUNT = 100; - - // create table - TableMeta tableMeta = getTestTableMeta(); - CapacityUnit tableCU = getTestCapacityUnit(); - CreateTableRequest ctRequest = new CreateTableRequest(); - ctRequest.setTableMeta(tableMeta); - ctRequest.setReservedThroughput(tableCU); - String[] tableNames = new String[TABLE_COUNT]; - for (int i = 0; i < TABLE_COUNT; i++) { - tableNames[i] = tableName + "_" + i; - TestUtil.DeleteTable(ots, tableNames[i]); - Thread.sleep(TABLE_OPERATION_INTERVAL_IN_MSEC); - - tableMeta.setTableName(tableNames[i]); - ctRequest.setTableMeta(tableMeta); - ots.createTable(ctRequest); - } - Thread.sleep(MILLISECONDS_UNTIL_TABLE_READY); - for (int i = 0; i < TABLE_COUNT; i++) { - generateDataForTest(tableNames[i], 0, ROW_COUNT); - } - - // test batch write rows, only with put, and some rows will with condition check fail, check result is as expected and rows in response is in the right index - { - // test batch get rows, expect all rows is returned, and all rows is in the right index - BatchWriteRowRequest request = new BatchWriteRowRequest(); - final int rowsGet = 10; - final int startIndex = 10000; - for (int i = 0; i < TABLE_COUNT; i++) { - for (int j = 0; j < rowsGet; j++) { - int id = j + startIndex; - RowPutChange rowChange = new RowPutChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(id)); - rowChange.addAttributeColumn("col_integer", getColInteger(id)); - rowChange.addAttributeColumn("col_string", getColString(id)); - Condition condition = new Condition(); - if (j % 2 == 0) { - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - } else { - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); // will condition check fail - } - rowChange.setCondition(condition); - request.addRowPutChange(rowChange); - } - } - - BatchWriteRowResult result = ots.batchWriteRow(request); - for (int i = 0; i < TABLE_COUNT; i++) { - List status = result.getPutRowStatus(tableNames[i]); - assertEquals(status.size(), rowsGet); - for (int j = 0; j < rowsGet; j++) { - if (j % 2 == 0) { - assertTrue(status.get(j).isSucceed()); - assertTrue(status.get(j).getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(status.get(j).getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - assertEquals(status.get(j).getError(), null); - - Row row = readRow(tableNames[i], j + startIndex); - compareRow(row, j + startIndex, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string"}); - } else { - assertTrue(!status.get(j).isSucceed()); - assertEquals(status.get(j).getConsumedCapacity(), null); - assertEquals(status.get(j).getError().getCode(), CONDITION_CHECK_FAIL); - } - } - } - } - - // test batch write rows, only with update, and some rows will with condition check fail, check result is as expected and rows in response is in the right index - { - BatchWriteRowRequest request = new BatchWriteRowRequest(); - final int rowsGet = 10; - for (int i = 0; i < TABLE_COUNT; i++) { - for (int j = 0; j < rowsGet; j++) { - int id = j % 2 == 0 ? j : j + 10000; // row exist when j % 2 == 0 - RowUpdateChange rowChange = new RowUpdateChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(id)); - rowChange.addAttributeColumn("col_integer", getColInteger(id)); - rowChange.addAttributeColumn("col_string", getColString(id)); - rowChange.deleteAttributeColumn("col_double"); - rowChange.deleteAttributeColumn("col_boolean"); - rowChange.deleteAttributeColumn("col_binary"); - Condition condition = new Condition(); - if (j % 2 == 0) { - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - } else { - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); // will condition check fail - } - rowChange.setCondition(condition); - request.addRowUpdateChange(rowChange); - } - } - - BatchWriteRowResult result = ots.batchWriteRow(request); - for (int i = 0; i < TABLE_COUNT; i++) { - List status = result.getUpdateRowStatus(tableNames[i]); - assertEquals(status.size(), rowsGet); - for (int j = 0; j < rowsGet; j++) { - if (j % 2 == 0) { - assertTrue(status.get(j).isSucceed()); - assertTrue(status.get(j).getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(status.get(j).getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - assertEquals(status.get(j).getError(), null); - - Row row = readRow(tableNames[i], j); - compareRow(row, j, new String[]{"uid", "name", "sid", "flag", "col_integer", "col_string"}); - } else { - assertTrue(!status.get(j).isSucceed()); - assertEquals(status.get(j).getConsumedCapacity(), null); - assertEquals(status.get(j).getError().getCode(), CONDITION_CHECK_FAIL); - } - } - } - } - - // test batch write rows, only with delete, and some rows will with condition check fail, check result is as expected and rows in response is in the right index - { - BatchWriteRowRequest request = new BatchWriteRowRequest(); - final int rowsGet = 10; - for (int i = 0; i < TABLE_COUNT; i++) { - for (int j = 0; j < rowsGet; j++) { - int id = j % 2 == 0 ? j : j + 10000; // row exist when j % 2 == 0 - RowDeleteChange rowChange = new RowDeleteChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(id)); - Condition condition = new Condition(); - if (j % 2 == 0) { - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - } else { - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); // will condition check fail - } - rowChange.setCondition(condition); - request.addRowDeleteChange(rowChange); - } - } - - BatchWriteRowResult result = ots.batchWriteRow(request); - for (int i = 0; i < TABLE_COUNT; i++) { - List status = result.getDeleteRowStatus(tableNames[i]); - assertEquals(status.size(), rowsGet); - for (int j = 0; j < rowsGet; j++) { - if (j % 2 == 0) { - assertTrue(status.get(j).isSucceed()); - assertTrue(status.get(j).getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit() != 0); - assertEquals(status.get(j).getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(), 0); - assertEquals(status.get(j).getError(), null); - - Row row = readRow(tableNames[i], j); - compareRow(row, j, new String[]{}); - } else { - assertTrue(!status.get(j).isSucceed()); - assertEquals(status.get(j).getConsumedCapacity(), null); - assertEquals(status.get(j).getError().getCode(), CONDITION_CHECK_FAIL); - } - } - } - } - - // test batch write rows with various operation, and some rows will with condition check fail, check result is as expected and rows in response is in the right index - { - BatchWriteRowRequest request = new BatchWriteRowRequest(); - for (int i = 0; i < TABLE_COUNT; i++) { - { - // put an non-exist row - RowPutChange rowChange = new RowPutChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(777)); - rowChange.addAttributeColumn("col_integer", getColInteger(777)); - rowChange.addAttributeColumn("col_string", getColString(777)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - request.addRowPutChange(rowChange); - } - { - // put an exist row and expect not exist, will fail - RowPutChange rowChange = new RowPutChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(3)); - rowChange.addAttributeColumn("col_integer", getColInteger(3)); - rowChange.addAttributeColumn("col_string", getColString(3)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST); - rowChange.setCondition(condition); - request.addRowPutChange(rowChange); - } - { - // update an exist row - RowUpdateChange rowChange = new RowUpdateChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(7)); - rowChange.addAttributeColumn("col_integer", getColInteger(7)); - rowChange.addAttributeColumn("col_string", getColString(7)); - rowChange.deleteAttributeColumn("col_double"); - rowChange.deleteAttributeColumn("col_boolean"); - rowChange.deleteAttributeColumn("col_binary"); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - request.addRowUpdateChange(rowChange); - } - { - // update an non-exist row and expect exist - RowUpdateChange rowChange = new RowUpdateChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(999)); - rowChange.addAttributeColumn("col_integer", getColInteger(7)); - rowChange.addAttributeColumn("col_string", getColString(7)); - rowChange.deleteAttributeColumn("col_double"); - rowChange.deleteAttributeColumn("col_boolean"); - rowChange.deleteAttributeColumn("col_binary"); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - request.addRowUpdateChange(rowChange); - } - { - // delete an exist row - RowDeleteChange rowChange = new RowDeleteChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(0)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.IGNORE); - rowChange.setCondition(condition); - request.addRowDeleteChange(rowChange); - } - { - // delete an non-exist row and expect exist - RowDeleteChange rowChange = new RowDeleteChange(tableNames[i]); - rowChange.setPrimaryKey(getRowPrimaryKeys(7777)); - Condition condition = new Condition(); - condition.setRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST); - rowChange.setCondition(condition); - request.addRowDeleteChange(rowChange); - } - } - - BatchWriteRowResult result = ots.batchWriteRow(request); - for (int i = 0; i < TABLE_COUNT; i++) { - { - List status = result.getPutRowStatus(tableNames[i]); - assertEquals(status.size(), 2); - assertTrue(status.get(0).isSucceed()); - Row row = readRow(tableNames[i], 777); - compareRow(row, 777, new String[]{"col_integer", "col_string", "uid", "name", "sid", "flag"}); - - assertTrue(!status.get(1).isSucceed()); - assertEquals(status.get(1).getError().getCode(), CONDITION_CHECK_FAIL); - } - { - List status = result.getUpdateRowStatus(tableNames[i]); - assertEquals(status.size(), 2); - assertTrue(status.get(0).isSucceed()); - Row row = readRow(tableNames[i], 7); - compareRow(row, 7, new String[]{"col_integer", "col_string", "uid", "name", "sid", "flag"}); - - assertTrue(!status.get(1).isSucceed()); - assertEquals(status.get(1).getError().getCode(), CONDITION_CHECK_FAIL); - } - { - List status = result.getDeleteRowStatus(tableNames[i]); - assertEquals(status.size(), 2); - assertTrue(status.get(0).isSucceed()); - Row row = readRow(tableNames[i], 0); - compareRow(row, 0, new String[]{}); - } - } - } - - for (int i = 0; i < TABLE_COUNT; i++) { - TestUtil.DeleteTable(ots, tableNames[i]); - } - } - - @Test - public void testCreateTableWithBinaryKey() { - LOG.info("Start testCreateTableWithBinaryKey"); - - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.BINARY); - tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); - tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.BINARY); - - CapacityUnit cu = new CapacityUnit(1, 1); - CreateTableRequest ctr = new CreateTableRequest(); - ctr.setTableMeta(tableMeta); - ctr.setReservedThroughput(cu); - - ots.createTable(ctr); - } - - private TableMeta getTestTableMeta() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("uid", PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn("name", PrimaryKeyType.STRING); - tableMeta.addPrimaryKeyColumn("sid", PrimaryKeyType.BINARY); - tableMeta.addPrimaryKeyColumn("flag", PrimaryKeyType.INTEGER); - return tableMeta; - } - - private CapacityUnit getTestCapacityUnit() { - CapacityUnit capacityUnit = new CapacityUnit(); - capacityUnit.setReadCapacityUnit(3); - capacityUnit.setWriteCapacityUnit(3); - return capacityUnit; - } - - private Row readRow(String tableName, int i) { - SingleRowQueryCriteria rowQueryCriteria = new SingleRowQueryCriteria(tableName); - rowQueryCriteria.setPrimaryKey(getRowPrimaryKeys(i)); - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(rowQueryCriteria); - GetRowResult result = ots.getRow(request); - return result.getRow(); - } - - private void CheckSpecificColumn(String tableName, int i, String columnName, ColumnValue columnValue) { - Row row = readRow(tableName, i); - assertTrue(row.getColumns().containsKey(columnName)); - assertEquals(row.getColumns().get(columnName), columnValue); - } - - private ColumnValue getColInteger(int i) { - return ColumnValue.fromLong(i); - } - - private ColumnValue getColString(int i) { - return ColumnValue.fromString(String.format("%05d", i)); - } - - private ColumnValue getColDouble(int i) { - return ColumnValue.fromDouble(999.99); - } - - private ColumnValue getColBoolean(int i) { - return ColumnValue.fromBoolean(i % 2 == 0); - } - - private ColumnValue getColBinary(int i) { - return ColumnValue.fromBinary(new byte[]{(byte)(i % 127), (byte)(i % 127), (byte)(i % 127)}); - } - - /** - * 每一行都包含固定的几个列: uid, name, flag, col_integer, col_string, col_double, col_boolean, col_binary。 - * 也可以添加自定义的新列,但是需要遵循一定的规则, integer类型的列必须以"integer"结尾,其他类型都遵循此规则。 - * 同一类型的列取值都固定,需要调用想用的getColXXX函数去获取值。 - * @param row - * @param i - * @param cs - */ - private void compareRow(Row row, int i, String[] cs) { - Set tmp = new HashSet(); - for (String s : cs) { - tmp.add(s); - } - String[] columns = tmp.toArray(new String[0]); - assertEquals(row.getColumns().size(), columns.length); - for (String column : columns) { - assertTrue(row.getColumns().get(column) != null); - if (column.equals("uid")) { - assertEquals(row.getColumns().get(column), ColumnValue.fromLong(i)); - } else if (column.equals("name")) { - assertEquals(row.getColumns().get(column), ColumnValue.fromString(String.format("%05d", i))); - } else if (column.equals("flag")) { - assertEquals(row.getColumns().get(column), ColumnValue.fromLong(i * i)); - } else if (column.equals("sid")) { - assertEquals(row.getColumns().get(column), ColumnValue.fromBinary(makeBinaryValue(i))); - } else if (column.equals("col_integer")) { - assertEquals(row.getColumns().get(column), getColInteger(i)); - } else if (column.equals("col_double")) { - assertEquals(row.getColumns().get(column), getColDouble(i)); - } else if (column.equals("col_boolean")) { - assertEquals(row.getColumns().get(column), getColBoolean(i)); - } else if (column.equals("col_string")) { - assertEquals(row.getColumns().get(column), getColString(i)); - } else if (column.equals("col_binary")) { - assertArrayEquals(row.getColumns().get(column).asBinary(), getColBinary(i).asBinary()); - } else if (column.endsWith("string")) { - assertEquals(row.getColumns().get(column), getColString(i)); - } else if (column.endsWith("integer")) { - assertEquals(row.getColumns().get(column), getColInteger(i)); - } else if (column.endsWith("boolean")) { - assertEquals(row.getColumns().get(column), getColBoolean(i)); - } else if (column.endsWith("double")) { - assertEquals(row.getColumns().get(column), getColDouble(i)); - } else if (column.endsWith("binary")) { - assertEquals(row.getColumns().get(column), getColBinary(i)); - } - } - } - - private RowPrimaryKey getRowPrimaryKeys(int i) { - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(i)); - primaryKeys.addPrimaryKeyColumn("name", PrimaryKeyValue.fromString(String.format("%05d", i))); - primaryKeys.addPrimaryKeyColumn("sid", PrimaryKeyValue.fromBinary(makeBinaryValue(i))); - primaryKeys.addPrimaryKeyColumn("flag", PrimaryKeyValue.fromLong(i * i)); - return primaryKeys; - } - - private byte[] makeBinaryValue(int i) { - byte[] s = new byte[13]; - for (int j = 0; j < s.length; j++) { - s[j] = (byte)(i+j); - } - return s; - } - - private void writeRows(BatchWriteRowRequest request) { - while (true) { - try { - ots.batchWriteRow(request); - break; - } catch (OTSException e) { - // just ignore - } - } - } - - private void generateDataForTest(String tableName, int from, int to) { - BatchWriteRowRequest request = new BatchWriteRowRequest(); - final int ROWS_PER_REQUEST = 10; - for (int i = from, count = 1; i < to; i++, count++) { - - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey primaryKeys = getRowPrimaryKeys(i); - - rowChange.setPrimaryKey(primaryKeys); - rowChange.addAttributeColumn("col_integer", getColInteger(i)); - rowChange.addAttributeColumn("col_string", getColString(i)); - rowChange.addAttributeColumn("col_double", getColDouble(i)); - rowChange.addAttributeColumn("col_boolean", getColBoolean(i)); - rowChange.addAttributeColumn("col_binary", getColBinary(i)); - - request.addRowPutChange(rowChange); - if (count % ROWS_PER_REQUEST == 0) { - writeRows(request); - request = new BatchWriteRowRequest(); - } - } - - if (!request.getRowPutChange().isEmpty()) { - writeRows(request); - } - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/integration/OTSRetryStrategyTest.java b/src/test/java/com/aliyun/openservices/ots/integration/OTSRetryStrategyTest.java deleted file mode 100644 index 66f42ca..0000000 --- a/src/test/java/com/aliyun/openservices/ots/integration/OTSRetryStrategyTest.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.aliyun.openservices.ots.integration; - -import static org.junit.Assert.*; - -import com.aliyun.openservices.ots.model.DeleteTableRequest; -import com.aliyun.openservices.ots.model.ListTableResult; -import org.junit.Before; -import org.junit.Test; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.OTSServiceConfiguration; -import com.aliyun.openservices.ots.internal.OTSRetryStrategy; -import com.aliyun.openservices.ots.utils.ServiceSettings; - -import java.util.logging.Logger; - -public class OTSRetryStrategyTest { - private static int retries = 0; - private static final OTS ots = OTSClientFactory.createOTSClient(ServiceSettings.load()); - private static Logger LOG = Logger.getLogger(OTSRetryStrategyTest.class.getName()); - - public static void setRetries(int retries) { - OTSRetryStrategyTest.retries = retries; - } - - @Test - public void testNoRetry() { - LOG.info("Start testNoRetry"); - - OTSRetryStrategy retryStrategy = new OTSRetryStrategy() { - @Override - public boolean shouldRetry(String action, Exception ex, int retries) { - OTSRetryStrategyTest.setRetries(retries); - return false; - } - - @Override - public long getPauseDelay(String action, Exception ex, int retries) { - return 10; - } - }; - ClientConfiguration config = new ClientConfiguration(); - config.setMaxConnections(10); - config.setIoThreadCount(10); - OTSServiceConfiguration serviceConfig = new OTSServiceConfiguration(); - serviceConfig.setRetryStrategy(retryStrategy); - OTS ots = OTSClientFactory.createOTSClient( - ServiceSettings.load(), config, serviceConfig); - OTSRetryStrategyTest.setRetries(0); - ots.listTable(); - assertEquals(0, retries); - } - - @Test - public void testRetryOTSException() { - LOG.info("Start testRetryOTSException"); - - OTSRetryStrategy retryStrategy = new OTSRetryStrategy() { - @Override - public boolean shouldRetry(String action, Exception ex, int retries) { - OTSRetryStrategyTest.setRetries(retries); - if ((ex instanceof OTSException) && (retries < 3)) { - return true; - } - return false; - } - - @Override - public long getPauseDelay(String action, Exception ex, int retries) { - return 10; - } - }; - ClientConfiguration config = new ClientConfiguration(); - config.setMaxConnections(10); - config.setIoThreadCount(10); - OTSServiceConfiguration serviceConfig = new OTSServiceConfiguration(); - serviceConfig.setRetryStrategy(retryStrategy); - ServiceSettings ss = ServiceSettings.load(); - ss.setOTSAccessKeyId("WrongAccessId"); - OTS ots = OTSClientFactory.createOTSClient( - ss, config, serviceConfig); - OTSRetryStrategyTest.setRetries(0); - try { - ots.listTable(); - } catch (OTSException ex) { - - } - assertEquals(3, retries); - } - - @Test - public void testRetryClientException() { - LOG.info("Start testRetryClientException"); - - OTSRetryStrategy retryStrategy = new OTSRetryStrategy() { - @Override - public boolean shouldRetry(String action, Exception ex, int retries) { - OTSRetryStrategyTest.setRetries(retries); - if ((ex instanceof ClientException) && (retries < 3)) { - return true; - } - return false; - } - - @Override - public long getPauseDelay(String action, Exception ex, int retries) { - return 10; - } - }; - ClientConfiguration config = new ClientConfiguration(); - config.setMaxConnections(10); - config.setIoThreadCount(10); - config.setConnectionTimeoutInMillisecond(1000); - OTSServiceConfiguration serviceConfig = new OTSServiceConfiguration(); - serviceConfig.setRetryStrategy(retryStrategy); - ServiceSettings ss = ServiceSettings.load(); - ss.setOTSEndpoint("http://1.1.1.1"); - OTS ots = OTSClientFactory.createOTSClient( - ss, config, serviceConfig); - OTSRetryStrategyTest.setRetries(0); - try { - ots.listTable(); - } catch (ClientException ex) { - - } - assertEquals(3, retries); - } - -} diff --git a/src/test/java/com/aliyun/openservices/ots/integration/RelationFilterTest.java b/src/test/java/com/aliyun/openservices/ots/integration/RelationFilterTest.java deleted file mode 100644 index fe3c141..0000000 --- a/src/test/java/com/aliyun/openservices/ots/integration/RelationFilterTest.java +++ /dev/null @@ -1,2702 +0,0 @@ -package com.aliyun.openservices.ots.integration; - -import com.aliyun.openservices.ots.ClientConfiguration; -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.common.BaseFT; -import com.aliyun.openservices.ots.common.OTSHelper; -import com.aliyun.openservices.ots.common.Utils; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.condition.CompositeCondition; -import com.aliyun.openservices.ots.model.condition.RelationalCondition; -import com.aliyun.openservices.ots.utils.ServiceSettings; -import com.aliyun.openservices.ots.utils.TestUtil; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; - -import java.io.UnsupportedEncodingException; -import java.util.*; -import java.util.logging.Logger; - -import static org.junit.Assert.assertEquals; - -public class RelationFilterTest extends BaseFT { - private static Logger LOG = Logger.getLogger(RelationFilterTest.class.getName()); - - private static String tableName = TestUtil.newTableName("RelationFilterFunctionTest"); - - private static final OTS ots = OTSClientFactory.createOTSClient(ServiceSettings.load()); - - private static final int SECONDS_UNTIL_TABLE_READY = 10; - - @AfterClass - public static void classAfter() { - TestUtil.DeleteTable(ots, tableName); - ots.shutdown(); - } - - @Before - public void setup() throws Exception { - LOG.info("Instance: " + ServiceSettings.load().getOTSInstanceName()); - - try { - DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName); - ots.deleteTable(deleteTableRequest); - } catch (Exception ex) {;} - } - - private void VerifyRow(Row testRow, Row goldRow) { - checkRow(goldRow, testRow); - } - - /** - * | pk | col1 | col2 | - * |------+------+------------| - * | row1 | ABC | DON'T CARE | - * | row2 | ABC | DON'T CARE | - * | row3 | ABC | DON'T CARE | - * | row4 | ABB | DON'T CARE | - * | row5 | ABD | DON'T CARE | - */ - private HashMap WriteFixture4Case1() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 5; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - String value = "Uninitialized"; - if (i <= 3) { - value = "ABC"; - } else if (i == 4) { - value = "ABB"; - } else if (i == 5) { - value = "ABD"; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromString(value)); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromString(value)); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test relation filter with STRING type - * Test filters with the following combinations: - * ["col1"] x [=, !=, >, >=, <, <=] x ["ABC", "ABB", "ABD"] - * for GetRow/BatchGetRow/GetRange - */ - @Test - public void testCase1() throws UnsupportedEncodingException { - LOG.info("Start testCase1"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case1(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // = "ABC" => PASS - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // != "ABC" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromString("ABC"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // > "ABC" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromString("ABC"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // >= "ABC" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromString("ABC"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // < "ABC" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromString("ABC"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // <= "ABC" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromString("ABC"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // > "AB" AND < "ABCD" => PASS - CompositeCondition compositeFilter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - compositeFilter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromString("AB"))); - compositeFilter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromString("ABCD"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // BatchGetRow (Get row1, row4, row5) - // = "ABC" => row1 - List criterias = new ArrayList(); - MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); - - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - criterias.add(c); - List< BatchGetRowResult.RowStatus> result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // != "ABC" => row4, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromString("ABC"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // > "ABC" => row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromString("ABC"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // >= "ABC" => row1, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromString("ABC"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // < "ABC" => row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromString("ABC"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // <= "ABC" => row1, row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromString("ABC"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // GetRange [row2, row6) - // = "ABC" => row2, row3 - RangeRowQueryCriteria rangeCriteria = new RangeRowQueryCriteria(tableName); - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row2")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row6")) - ); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - List rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // != "ABC" => row4, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row5")); - - // > "ABC" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "ABC" => row2, row3, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row5")); - - // < "ABC" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "ABC" => row2, row3, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row4")); - - // GetRangeReverse [row5, row1) - // = "ABC" => row3, row2 - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - rangeCriteria.setDirection(Direction.BACKWARD); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - - // != "ABC" => row4, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row4")); - - // > "ABC" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "ABC" => row5, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - - // < "ABC" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "ABC" => row4, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromString("ABC"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - } - - /** - * | pk | col1 | col2 | - * |------+------+------------| - * | row1 | 100 | DON'T CARE | - * | row2 | 100 | DON'T CARE | - * | row3 | 100 | DON'T CARE | - * | row4 | -1 | DON'T CARE | - * | row5 | 1000 | DON'T CARE | - */ - private HashMap WriteFixture4Case2() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 5; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - long value = 0; - if (i <= 3) { - value = 100; - } else if (i == 4) { - value = -1; - } else if (i == 5) { - value = 1000; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromLong(value)); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromLong(value)); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test relation filter with INTEGER type - * Test filters with the following combinations: - * ["col1"] x [=, !=, >, >=, <, <=] x [100, 99, 1000] - * for GetRow/BatchGetRow/GetRange - */ - @Test - public void testCase2() throws UnsupportedEncodingException { - LOG.info("Start testCase2"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case2(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // = 100 => PASS - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(100))); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // != 100 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromLong(100))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // > 100 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromLong(100))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // >= 100 => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromLong(100))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // < 100 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromLong(100))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // <= 100 => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromLong(100))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // row4: col1 < 0 => PASS - criteria.setPrimaryKey(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromLong(0))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row4")); - - // row4: col1 < 1 => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromLong(1))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row4")); - - // row4: col1 >= 0 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromLong(0))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // row4: col1 >= 1 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromLong(1))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // BatchGetRow (Get row1, row4, row5) - // = 100 => row1 - List criterias = new ArrayList(); - MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); - - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(100))); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - criterias.add(c); - List< BatchGetRowResult.RowStatus> result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // != 100 => row4, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromLong(100))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // > 100 => row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromLong(100))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // >= 100 => row1, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromLong(100))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // < 100 => row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromLong(100))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // <= 100 => row1, row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromLong(100))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // GetRange [row2, row6) - // = 100 => row2, row3 - RangeRowQueryCriteria rangeCriteria = new RangeRowQueryCriteria(tableName); - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row2")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row6")) - ); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(100))); - List rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // != 100 => row4, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row5")); - - // > 100 => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= 100 => row2, row3, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row5")); - - // < 100 => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= 100 => row2, row3, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row4")); - - // GetRangeReverse [row5, row1) - // = 100 => row3, row2 - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - rangeCriteria.setDirection(Direction.BACKWARD); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - - // != 100 => row4, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row4")); - - // > 100 => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= 100 => row5, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - - // < 100 => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= 100 => row4, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromLong(100))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - } - - /** - * | pk | col1 | col2 | - * |------+--------+------------| - * | row1 | 100.1 | DON'T CARE | - * | row2 | 100.1 | DON'T CARE | - * | row3 | 100.1 | DON'T CARE | - * | row4 | 99.9 | DON'T CARE | - * | row5 | 1000.5 | DON'T CARE | - */ - private HashMap WriteFixture4Case3() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 5; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - - double value = 0; - if (i <= 3) { - value = 100.1; - } else if (i == 4) { - value = 99.9; - } else if (i == 5) { - value = 1000.5; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromDouble(value)); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromDouble(value)); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test relation filter with DOUBLE type - * Test filters with the following combinations: - * ["col1"] x [=, !=, >, >=, <, <=] x [100.1, 99.9, 1000.5] - * for GetRow/BatchGetRow/GetRange - */ - @Test - public void testCase3() throws UnsupportedEncodingException { - LOG.info("Start testCase3"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case3(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // = 100.1 => PASS - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromDouble(100.1))); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // != 100.1 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromDouble(100.1))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // > 100.1 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromDouble(100.1))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // >= 100.1 => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromDouble(100.1))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // < 100.1 => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromDouble(100.1))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // <= 100.1 => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromDouble(100.1))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // BatchGetRow (Get row1, row4, row5) - // = 100.1 => row1 - List criterias = new ArrayList(); - MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); - - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromDouble(100.1))); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - criterias.add(c); - List< BatchGetRowResult.RowStatus> result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // != 100.1 => row4, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromDouble(100.1))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // > 100.1 => row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromDouble(100.1))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // >= 100.1 => row1, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromDouble(100.1))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // < 100.1 => row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromDouble(100.1))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // <= 100.1 => row1, row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromDouble(100.1))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // GetRange [row2, row6) - // = 100.1 => row2, row3 - RangeRowQueryCriteria rangeCriteria = new RangeRowQueryCriteria(tableName); - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row2")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row6")) - ); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromDouble(100.1))); - List rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // != 100.1 => row4, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row5")); - - // > 100.1 => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= 100.1 => row2, row3, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row5")); - - // < 100.1 => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= 100.1 => row2, row3, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row4")); - - // GetRangeReverse [row5, row1) - // = 100.1 => row3, row2 - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - rangeCriteria.setDirection(Direction.BACKWARD); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - - // != 100.1 => row4, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row4")); - - // > 100.1 => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= 100.1 => row5, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - - // < 100.1 => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= 100.1 => row4, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromDouble(100.1))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - } - - /** - * | pk | col1 | col2 | - * |------+------+------------| - * | row1 | ABC | DON'T CARE | - * | row2 | ABC | DON'T CARE | - * | row3 | ABC | DON'T CARE | - * | row4 | ABB | DON'T CARE | - * | row5 | ABD | DON'T CARE | - */ - private HashMap WriteFixture4Case4() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 5; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - - String value = "Uninitialized"; - if (i <= 3) { - value = "ABC"; - } else if (i == 4) { - value = "ABB"; - } else if (i == 5) { - value = "ABD"; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromBinary(value.getBytes())); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromBinary(value.getBytes())); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test relation filter with BINARY type - * Test filters with the following combinations: - * ["col1"] x [=, !=, >, >=, <, <=] x ["ABC", "ABB", "ABD"] - * for GetRow/BatchGetRow/GetRange - */ - @Test - public void testCase4() throws UnsupportedEncodingException { - LOG.info("Start testCase4"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case4(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // = "ABC" => PASS - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // != "ABC" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // > "ABC" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // >= "ABC" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // < "ABC" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // <= "ABC" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // BatchGetRow (Get row1, row4, row5) - // = "ABC" => row1 - List criterias = new ArrayList(); - MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); - - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - criterias.add(c); - List< BatchGetRowResult.RowStatus> result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // != "ABC" => row4, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // > "ABC" => row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // >= "ABC" => row1, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // < "ABC" => row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // <= "ABC" => row1, row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // GetRange [row2, row6) - // = "ABC" => row2, row3 - RangeRowQueryCriteria rangeCriteria = new RangeRowQueryCriteria(tableName); - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row2")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row6")) - ); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - List rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // != "ABC" => row4, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row5")); - - // > "ABC" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "ABC" => row2, row3, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row5")); - - // < "ABC" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "ABC" => row2, row3, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row4")); - - // GetRangeReverse [row5, row1) - // = "ABC" => row3, row2 - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - rangeCriteria.setDirection(Direction.BACKWARD); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - - // != "ABC" => row4, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row4")); - - // > "ABC" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "ABC" => row5, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - - // < "ABC" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "ABC" => row4, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - } - - /** - * | pk | col1 | col2 | - * |------+------+------------| - * | row1 | 杭州 | DON'T CARE | - * | row2 | 杭州 | DON'T CARE | - * | row3 | 杭州 | DON'T CARE | - * | row4 | 中国 | DON'T CARE | - * | row5 | 浙江 | DON'T CARE | - */ - private HashMap WriteFixture4Case5() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 5; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - - String value = "Uninitialized"; - if (i <= 3) { - value = "杭州"; - } else if (i == 4) { - value = "中国"; - } else if (i == 5) { - value = "浙江"; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromString(value)); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromString(value)); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test relation filter with STRING type with Chinese character - * Test filters with the following combinations: - * ["col1"] x [=, !=, >, >=, <, <=] x ["杭州", "中国", "浙江"] - * for GetRow/BatchGetRow/GetRange - */ - @Test - public void testCase5() throws UnsupportedEncodingException { - LOG.info("Start testCase5"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case5(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // = "杭州" => PASS - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("杭州"))); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // != "杭州" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("杭州"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // > "杭州" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromString("杭州"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // >= "杭州" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromString("杭州"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // < "杭州" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromString("杭州"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // <= "杭州" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromString("杭州"))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // BatchGetRow (Get row1, row4, row5) - // = "杭州" => row1 - List criterias = new ArrayList(); - MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); - - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("杭州"))); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - criterias.add(c); - List< BatchGetRowResult.RowStatus> result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // != "杭州" => row4, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("杭州"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // > "杭州" => row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromString("杭州"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // >= "杭州" => row1, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromString("杭州"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // < "杭州" => row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromString("杭州"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // <= "杭州" => row1, row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromString("杭州"))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // GetRange [row2, row6) - // = "杭州" => row2, row3 - RangeRowQueryCriteria rangeCriteria = new RangeRowQueryCriteria(tableName); - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row2")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row6")) - ); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("杭州"))); - List rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // != "杭州" => row4, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row5")); - - // > "杭州" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "杭州" => row2, row3, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row5")); - - // < "杭州" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "杭州" => row2, row3, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row4")); - - // GetRangeReverse [row5, row1) - // = "杭州" => row3, row2 - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - rangeCriteria.setDirection(Direction.BACKWARD); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - - // != "杭州" => row4, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row4")); - - // > "杭州" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "杭州" => row5, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - - // < "杭州" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "杭州" => row4, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromString("杭州"))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - } - - /** - * | pk | col1 | col2 | - * |------+------+------------| - * | row1 | 杭州 | DON'T CARE | - * | row2 | 杭州 | DON'T CARE | - * | row3 | 杭州 | DON'T CARE | - * | row4 | 中国 | DON'T CARE | - * | row5 | 浙江 | DON'T CARE | - */ - private HashMap WriteFixture4Case6() throws UnsupportedEncodingException { - LOG.info("Start testCase6"); - - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 5; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - String value = "Uninitialized"; - if (i <= 3) { - value = "杭州"; - } else if (i == 4) { - value = "中国"; - } else if (i == 5) { - value = "浙江"; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromBinary(value.getBytes("utf-8"))); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromBinary(value.getBytes("utf-8"))); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test relation filter with BINARY type with Chinese character - * Test filters with the following combinations: - * ["col1"] x [=, !=, >, >=, <, <=] x ["杭州", "中国", "浙江"] - * for GetRow/BatchGetRow/GetRange - */ - @Test - public void testCase6() throws UnsupportedEncodingException { - LOG.info("Start testCase6"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case6(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // = "杭州" => PASS - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // != "杭州" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // > "杭州" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // >= "杭州" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // < "杭州" => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // <= "杭州" => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // BatchGetRow (Get row1, row4, row5) - // = "杭州" => row1 - List criterias = new ArrayList(); - MultiRowQueryCriteria c = new MultiRowQueryCriteria(tableName); - - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - c.addRow(new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - criterias.add(c); - List< BatchGetRowResult.RowStatus> result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // != "杭州" => row4, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // > "杭州" => row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // >= "杭州" => row1, row5 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getRow().getColumns().size(), 0); - assertEquals(result.get(2).getTableName(), tableName); - VerifyRow(result.get(2).getRow(), fixture.get("row5")); - - // < "杭州" => row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getRow().getColumns().size(), 0); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // <= "杭州" => row1, row4 - c.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - result = OTSHelper.batchGetRow(ots, criterias).getSucceedRows(); - assertEquals(result.size(), 3); - assertEquals(result.get(0).getTableName(), tableName); - VerifyRow(result.get(0).getRow(), fixture.get("row1")); - assertEquals(result.get(1).getTableName(), tableName); - VerifyRow(result.get(1).getRow(), fixture.get("row4")); - assertEquals(result.get(2).getRow().getColumns().size(), 0); - - // GetRange [row2, row6) - // = "杭州" => row2, row3 - RangeRowQueryCriteria rangeCriteria = new RangeRowQueryCriteria(tableName); - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row2")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row6")) - ); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - List rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // != "杭州" => row4, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row5")); - - // > "杭州" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "杭州" => row2, row3, row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row5")); - - // < "杭州" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "杭州" => row2, row3, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row4")); - - // GetRangeReverse [row5, row1) - // = "杭州" => row3, row2 - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - rangeCriteria.setDirection(Direction.BACKWARD); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - - // != "杭州" => row4, row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row4")); - - // > "杭州" => row5 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row5")); - - // >= "杭州" => row5, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row5")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - - // < "杭州" => row4 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row4")); - - // <= "杭州" => row4, row3, row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, - ColumnValue.fromBinary(new String("杭州").getBytes()))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row4")); - VerifyRow(rows.get(1), fixture.get("row3")); - VerifyRow(rows.get(2), fixture.get("row2")); - } - - /** - * | pk | col1 | col2 | - * |------+-------+------------| - * | row1 | true | DON'T CARE | - * | row2 | false | DON'T CARE | - * | row3 | true | DON'T CARE | - */ - private HashMap WriteFixture4Case7() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 3; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - - boolean value = false; - if (i == 1) { - value = true; - } else if (i == 2) { - value = false; - } else if (i == 3) { - value = true; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromBoolean(value)); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromBoolean(value)); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test relation filter with BOOLEAN type - * Test the following comparisons: - * [true, false] x [=, !=, >, >=, <, <=] x [true, false] - */ - @Test - public void testCase7() throws UnsupportedEncodingException { - LOG.info("Start testCase7"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case7(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // = true => PASS - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(true))); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // != true => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromBoolean(true))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // > true => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromBoolean(true))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // >= true => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromBoolean(true))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // < true => DROP - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromBoolean(true))); - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // <= true => PASS - criteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromBoolean(true))); - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // GetRange [row1, row4) - // = true => row1, row3 - RangeRowQueryCriteria rangeCriteria = new RangeRowQueryCriteria(tableName); - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(true))); - List rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row1")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // != true => row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromBoolean(true))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row2")); - - // > true => none - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromBoolean(true))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 0); - - // >= true => row1, row3 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromBoolean(true))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row1")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // < true => row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromBoolean(true))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row2")); - - // <= true => row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromBoolean(true))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row1")); - VerifyRow(rows.get(1), fixture.get("row2")); - VerifyRow(rows.get(2), fixture.get("row3")); - - // GetRangeReverse [row3, row0) - // = false => row2 - rangeCriteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row3")) - ); - rangeCriteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row0")) - ); - rangeCriteria.setDirection(Direction.BACKWARD); - - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(false))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row2")); - - // != false => row3, row1 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromBoolean(false))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row1")); - - // > false => row3, row1 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, ColumnValue.fromBoolean(false))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row1")); - - // >= false => row3, row2, row1 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_EQUAL, ColumnValue.fromBoolean(false))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 3); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - VerifyRow(rows.get(2), fixture.get("row1")); - - // < false => none - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, ColumnValue.fromBoolean(false))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 0); - - // <= false => row2 - rangeCriteria.setFilter(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_EQUAL, ColumnValue.fromBoolean(false))); - rows = OTSHelper.getRange(ots, rangeCriteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row2")); - } - - /** - * | PK | col1 | col2 | col3 | - * |------+------+------+------------| - * | row1 | ABC | 100 | DON'T CARE | - * | row2 | ABC | 200 | DON'T CARE | - * | row3 | ABC | 300 | DON'T CARE | - * | row4 | ABB | 100 | DON'T CARE | - * | row5 | ABD | 100 | DON'T CARE | - */ - private HashMap WriteFixture4Case8() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 5; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - - String value1 = ""; - long value2 = 0; - if (i <= 3) { - value1 = "ABC"; - value2 = 100; - } else if (i == 4) { - value1 = "ABC"; - value2 = 100; - } else if (i == 5) { - value1 = "ABC"; - value2 = 100; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromString(value1)); - puts.put("col2", ColumnValue.fromLong(value2)); - puts.put("col3", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromString(value1)); - row.addColumn("col2", ColumnValue.fromLong(value2)); - row.addColumn("col3", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test composite filter with AND/OR/NOT - * Test the following comparisons: - * [true, false] x [AND/OR] x [true, false] - * [NOT] x [true, false] - */ - @Test - public void testCase8() throws UnsupportedEncodingException { - LOG.info("Start testCase8"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case8(); - - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")); - - // true AND true - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - criteria.setPrimaryKey(pk); - - CompositeCondition filter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(100))); - criteria.setFilter(filter); - - Row row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // true AND false - filter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(200))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // false AND true - filter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(200))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // false AND false - filter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromString("ABC"))); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(200))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // true OR true - filter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(100))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // true OR false - filter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(200))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // false OR true - filter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(200))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - - // false OR false - filter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromString("ABC"))); - filter.addCondition(new RelationalCondition("col2", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromLong(200))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // NOT true - filter = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("ABC"))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - checkRow(new Row(), row); - - // NOT false - filter = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.NOT_EQUAL, ColumnValue.fromString("ABC"))); - criteria.setFilter(filter); - - row = OTSHelper.getRow(ots, criteria).getRow(); - VerifyRow(row, fixture.get("row1")); - } - - /** - * | PK | col1 | col2 | - * |------+-----------+------------| - * | row1 | BINARY(5) | DON'T CARE | - * | row2 | BINARY(8) | DON'T CARE | - * | row3 | BINARY(2) | DON'T CARE | - * | row4 | BINARY(4) | DON'T CARE | - */ - private HashMap WriteFixture4Case9() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 4; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - byte[] value = null; - if (i == 1) { - value = new byte[]{5}; - } else if (i == 2) { - value = new byte[]{8}; - } else if (i == 3) { - value = new byte[]{2}; - } else if (i == 4) { - value = new byte[]{4}; - } - - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromBinary(value)); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromBinary(value)); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test composite filter: - * (>0 AND <3) OR =5 AND (NOT =9 OR <7) - */ - @Test - public void testCase9() throws UnsupportedEncodingException { - LOG.info("Start testCase9"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case9(); - - // ReadRange - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - criteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - - - CompositeCondition f1 = new CompositeCondition(CompositeCondition.LogicOperator.AND); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new byte[]{0}))); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new byte[]{3}))); - CompositeCondition f2 = new CompositeCondition(CompositeCondition.LogicOperator.OR); - f2.addCondition(f1); - f2.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new byte[]{5}))); - CompositeCondition f3 = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - f3.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new byte[]{9}))); - CompositeCondition f4 = new CompositeCondition(CompositeCondition.LogicOperator.OR); - f4.addCondition(f3); - f4.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromBinary(new byte[]{7}))); - - CompositeCondition filter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - filter.addCondition(f2); - filter.addCondition(f4); - - criteria.setFilter(filter); - List rows = OTSHelper.getRange(ots, criteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row1")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // ReadRangeReverse - criteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - criteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row0")) - ); - criteria.setDirection(Direction.BACKWARD); - - rows = OTSHelper.getRange(ots, criteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row1")); - } - - /** - * | PK | col1 | col2 | - * |------+--------------+------------| - * | row1 | BINARY(XXX) | DON'T CARE | - * | row2 | BINARY(YYY) | DON'T CARE | - * | row3 | BINARY(ABC) | DON'T CARE | - */ - private HashMap WriteFixture4Case10() throws UnsupportedEncodingException { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 3; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - - String value = "Uninitialized"; - if (i == 1) { - value = "XXX"; - } else if (i == 2) { - value = "YYY"; - } else if (i == 3) { - value = "ABC"; - } - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromBinary(value.getBytes("utf-8"))); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromBinary(value.getBytes("utf-8"))); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test composite filter: - * >"" AND >"A" AND >"AB" AND >"ABC" AND >"ABD" AND >"CCC" AND (NOT = "YYY") - */ - @Test - public void testCase10() throws UnsupportedEncodingException { - LOG.info("Start testCase10"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case10(); - - // ReadRange - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - criteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - - - CompositeCondition f1 = new CompositeCondition(CompositeCondition.LogicOperator.AND); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new byte[]{}))); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("A").getBytes()))); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("AB").getBytes()))); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("ABC").getBytes()))); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("ABD").getBytes()))); - f1.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.GREATER_THAN, - ColumnValue.fromBinary(new String("CCC").getBytes()))); - - CompositeCondition f2 = new CompositeCondition(CompositeCondition.LogicOperator.NOT); - f2.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromBinary(new String("YYY").getBytes()))); - - CompositeCondition filter = new CompositeCondition(CompositeCondition.LogicOperator.AND); - filter.addCondition(f1); - filter.addCondition(f2); - - criteria.setFilter(filter); - List rows = OTSHelper.getRange(ots, criteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row1")); - - // ReadRangeReverse - criteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row3")) - ); - criteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row0")) - ); - criteria.setDirection(Direction.BACKWARD); - - rows = OTSHelper.getRange(ots, criteria).getRows(); - assertEquals(rows.size(), 1); - VerifyRow(rows.get(0), fixture.get("row1")); - } - - /** - * | PK | col1 | col2 | - * |------+------+------------| - * | row1 | 10 | DON'T CARE | - * | row2 | 2 | DON'T CARE | - * | row3 | 5 | DON'T CARE | - * | row4 | 8 | DON'T CARE | - */ - private HashMap WriteFixture4Case11() { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk", PrimaryKeyType.STRING); - - OTSHelper.createTable(ots, tableMeta); - Utils.sleepSeconds(SECONDS_UNTIL_TABLE_READY); - - HashMap fixture = new HashMap(); - for (int i = 1; i <= 4; ++i) { - String rowKey = "row" + i; - RowPrimaryKey pk = new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString(rowKey)); - - long value = 0; - if (i == 1) { - value = 10; - } else if (i == 2) { - value = 2; - } else if (i == 3) { - value = 5; - } else if (i == 4) { - value = 8; - } - Map puts = new HashMap(); - puts.put("col1", ColumnValue.fromLong(value)); - puts.put("col2", ColumnValue.fromString("DON'T CARE")); - OTSHelper.updateRow(ots, tableName, pk, puts, null); - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromString(rowKey)); - row.addColumn("col1", ColumnValue.fromLong(value)); - row.addColumn("col2", ColumnValue.fromString("DON'T CARE")); - fixture.put(rowKey, row); - } - return fixture; - } - - /** - * Test composite filter: - * < 0 OR < 1 OR < 2 OR < 3 OR < 4 OR < 5 OR < 6 OR < 7 OR < 8 - */ - @Test - public void testCase11() throws UnsupportedEncodingException { - LOG.info("Start testCase11"); - - long ts = (new Date()).getTime(); - LOG.info("Begin time stamp : " + ts); - - HashMap fixture = WriteFixture4Case11(); - - // ReadRange - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row1")) - ); - criteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row5")) - ); - - - CompositeCondition filter = new CompositeCondition(CompositeCondition.LogicOperator.OR); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(0))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(1))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(2))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(3))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(4))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(5))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(6))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(7))); - filter.addCondition(new RelationalCondition("col1", - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(8))); - - criteria.setFilter(filter); - List rows = OTSHelper.getRange(ots, criteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row2")); - VerifyRow(rows.get(1), fixture.get("row3")); - - // ReadRangeReverse - criteria.setInclusiveStartPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row4")) - ); - criteria.setExclusiveEndPrimaryKey( - new RowPrimaryKey() - .addPrimaryKeyColumn("pk", PrimaryKeyValue.fromString("row0")) - ); - criteria.setDirection(Direction.BACKWARD); - - rows = OTSHelper.getRange(ots, criteria).getRows(); - assertEquals(rows.size(), 2); - VerifyRow(rows.get(0), fixture.get("row3")); - VerifyRow(rows.get(1), fixture.get("row2")); - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/internal/BatchOpRetryTest.java b/src/test/java/com/aliyun/openservices/ots/internal/BatchOpRetryTest.java deleted file mode 100644 index 3fea0b4..0000000 --- a/src/test/java/com/aliyun/openservices/ots/internal/BatchOpRetryTest.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.aliyun.openservices.ots.internal; - -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.Error; -import org.junit.Test; - -import java.util.Random; - -import static org.junit.Assert.assertEquals; - -public class BatchOpRetryTest { - - private RowPrimaryKey getPrimaryKey(int key) { - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn("pk", PrimaryKeyValue.fromLong(key)); - return primaryKey; - } - - @Test - public void testMergeBatchWriteRowResult() { - boolean[][] isSuccess = new boolean[10][100]; - - Random random = new Random(); - BatchWriteRowRequest request = new BatchWriteRowRequest(); - for (int tid = 0; tid < 10; tid++) { - if (tid % 3 == 0) { - for (int rid = 0; rid < 100; rid++) { - RowPutChange rowPutChange = new RowPutChange("table-" + tid); - rowPutChange.setPrimaryKey(getPrimaryKey(rid)); - request.addRowPutChange(rowPutChange); - isSuccess[tid][rid] = random.nextBoolean(); - } - } - if (tid % 3 == 1) { - for (int rid = 0; rid < 100; rid++) { - RowUpdateChange rowUpdateChange = new RowUpdateChange("table-" + tid); - rowUpdateChange.setPrimaryKey(getPrimaryKey(rid)); - request.addRowUpdateChange(rowUpdateChange); - isSuccess[tid][rid] = random.nextBoolean(); - } - } - if (tid % 3 == 2) { - for (int rid = 0; rid < 100; rid++) { - RowDeleteChange rowDeleteChange = new RowDeleteChange("table-" + tid); - rowDeleteChange.setPrimaryKey(getPrimaryKey(rid)); - request.addRowDeleteChange(rowDeleteChange); - isSuccess[tid][rid] = random.nextBoolean(); - } - } - } - - OTSResult meta = new OTSResult(); - meta.setRequestID(""); - meta.setRequestID(""); - BatchWriteRowResult result = new BatchWriteRowResult(meta); - - for (int tid = 0; tid < 10; tid++) { - for (int rid = 0; rid < 100; rid++) { - int rowIdx = rid; - if (isSuccess[tid][rowIdx]) { - ConsumedCapacity capacity = new ConsumedCapacity(); - capacity.setCapacityUnit(new CapacityUnit(0, 1)); - if (tid % 3 == 0) { - result.addPutRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, capacity, rowIdx)); - } - if (tid % 3 == 1) { - result.addUpdateRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, capacity, rowIdx)); - } - if (tid % 3 == 2) { - result.addDeleteRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, capacity, rowIdx)); - } - } else { - if (tid % 3 == 0) { - result.addPutRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, new Error("", ""), rowIdx)); - } - if (tid % 3 == 1) { - result.addUpdateRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, new Error("", ""), rowIdx)); - } - if (tid % 3 == 2) { - result.addDeleteRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, new Error("", ""), rowIdx)); - } - } - } - } - - BatchWriteRowRequest newRequest = request.createRequestForRetry(result.getFailedRowsOfPut(), result.getFailedRowsOfUpdate(), result.getFailedRowsOfDelete()); - BatchWriteRowResult newResult = new BatchWriteRowResult(meta); - - for (int tid = 0; tid < 10; tid++) { - if (tid % 3 == 0) { - int rowCount = newRequest.getRowPutChange().get("table-" + tid).size(); - for (int rowIdx = 0; rowIdx < rowCount; rowIdx++) { - RowPrimaryKey pk = newRequest.getRowPutChange("table-" + tid, rowIdx).getRowPrimaryKey(); - int key = (int)pk.getPrimaryKey().get("pk").asLong(); - assertEquals(false, isSuccess[tid][key]); - if (random.nextBoolean()) { - isSuccess[tid][key] = true; - ConsumedCapacity capacity = new ConsumedCapacity(); - capacity.setCapacityUnit(new CapacityUnit(0, 1)); - newResult.addPutRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, capacity, rowIdx)); - } else { - newResult.addPutRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, new Error("", ""), rowIdx)); - } - } - } - if (tid % 3 == 1) { - int rowCount = newRequest.getRowUpdateChange().get("table-" + tid).size(); - for (int rowIdx = 0; rowIdx < rowCount; rowIdx++) { - RowPrimaryKey pk = newRequest.getRowUpdateChange("table-" + tid, rowIdx).getRowPrimaryKey(); - int key = (int)pk.getPrimaryKey().get("pk").asLong(); - assertEquals(false, isSuccess[tid][key]); - if (random.nextBoolean()) { - isSuccess[tid][key] = true; - ConsumedCapacity capacity = new ConsumedCapacity(); - capacity.setCapacityUnit(new CapacityUnit(0, 1)); - newResult.addUpdateRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, capacity, rowIdx)); - } else { - newResult.addUpdateRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, new Error("", ""), rowIdx)); - } - } - } - if (tid % 3 == 2) { - int rowCount = newRequest.getRowDeleteChange().get("table-" + tid).size(); - for (int rowIdx = 0; rowIdx < rowCount; rowIdx++) { - RowPrimaryKey pk = newRequest.getRowDeleteChange("table-" + tid, rowIdx).getRowPrimaryKey(); - int key = (int)pk.getPrimaryKey().get("pk").asLong(); - assertEquals(false, isSuccess[tid][key]); - if (random.nextBoolean()) { - isSuccess[tid][key] = true; - ConsumedCapacity capacity = new ConsumedCapacity(); - capacity.setCapacityUnit(new CapacityUnit(0, 1)); - newResult.addDeleteRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, capacity, rowIdx)); - } else { - newResult.addDeleteRowResult(new BatchWriteRowResult.RowStatus("table-" + tid, new Error("", ""), rowIdx)); - } - } - } - } - - BatchWriteRowExecutionContext ec = new BatchWriteRowExecutionContext(null, null, new OTSTraceLogger("", 1000), null, null); - BatchWriteRowAsyncResponseConsumer consumer = new BatchWriteRowAsyncResponseConsumer(null, ec); - - BatchWriteRowResult mergedResult = consumer.mergeResult(result, newResult); - for (BatchWriteRowResult.RowStatus rowResult : mergedResult.getFailedRowsOfPut()) { - assertEquals(false, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - for (BatchWriteRowResult.RowStatus rowResult : mergedResult.getSucceedRowsOfPut()) { - assertEquals(true, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - for (BatchWriteRowResult.RowStatus rowResult : mergedResult.getFailedRowsOfUpdate()) { - assertEquals(false, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - for (BatchWriteRowResult.RowStatus rowResult : mergedResult.getSucceedRowsOfUpdate()) { - assertEquals(true, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - for (BatchWriteRowResult.RowStatus rowResult : mergedResult.getFailedRowsOfDelete()) { - assertEquals(false, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - for (BatchWriteRowResult.RowStatus rowResult : mergedResult.getSucceedRowsOfDelete()) { - assertEquals(true, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - } - - @Test - public void testMergeBatchGetRowResult() { - - boolean[][] isSuccess = new boolean[10][100]; - - Random random = new Random(); - BatchGetRowRequest request = new BatchGetRowRequest(); - for (int tid = 0; tid < 10; tid++) { - MultiRowQueryCriteria criteria = new MultiRowQueryCriteria("table-" + tid); - for (int rid = 0; rid < 100; rid++) { - criteria.addRow(getPrimaryKey(rid)); - isSuccess[tid][rid] = random.nextBoolean(); - } - request.addMultiRowQueryCriteria(criteria); - } - - OTSResult meta = new OTSResult(); - meta.setRequestID(""); - meta.setRequestID(""); - BatchGetRowResult result = new BatchGetRowResult(meta); - - for (int tid = 0; tid < 10; tid++) { - for (int rowIdx = 0; rowIdx < 100; rowIdx++) { - if (isSuccess[tid][rowIdx]) { - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromLong(rowIdx)); - result.addResult(new BatchGetRowResult.RowStatus("table-" + tid, row, - new ConsumedCapacity(), rowIdx)); - } else { - Error error = new Error("testError", "testError"); - result.addResult(new BatchGetRowResult.RowStatus("table-" + tid, error, rowIdx)); - } - } - } - - BatchGetRowRequest newRequest = request.createRequestForRetry(result.getFailedRows()); - BatchGetRowResult newResult = new BatchGetRowResult(meta); - - for (int tid = 0; tid < 10; tid++) { - MultiRowQueryCriteria criteria = newRequest.getCriteria("table-" + tid); - int rowCount = criteria.size(); - - for (int rowIdx = 0; rowIdx < rowCount; rowIdx++) { - RowPrimaryKey pk = criteria.get(rowIdx); - int key = (int)pk.getPrimaryKey().get("pk").asLong(); - assertEquals(false, isSuccess[tid][key]); - if (random.nextBoolean()) { - isSuccess[tid][key] = true; - Row row = new Row(); - row.addColumn("pk", ColumnValue.fromLong(rowIdx)); - newResult.addResult(new BatchGetRowResult.RowStatus("table-" + tid, row, - new ConsumedCapacity(), rowIdx)); - } else { - Error error = new Error("testError", "testError"); - newResult.addResult(new BatchGetRowResult.RowStatus("table-" + tid, error, rowIdx)); - } - } - } - - BatchGetRowExecutionContext ec = new BatchGetRowExecutionContext(null, null, new OTSTraceLogger("", 1000), null, null); - BatchGetRowAsyncResponseConsumer consumer = new BatchGetRowAsyncResponseConsumer(null, ec); - - BatchGetRowResult mergedResult = consumer.mergeResult(result, newResult); - for (BatchGetRowResult.RowStatus rowResult : mergedResult.getFailedRows()) { - assertEquals(false, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - for (BatchGetRowResult.RowStatus rowResult : mergedResult.getSucceedRows()) { - assertEquals(true, isSuccess[Integer.parseInt(rowResult.getTableName().substring(6))][rowResult.getIndex()]); - } - } - -} diff --git a/src/test/java/com/aliyun/openservices/ots/model/CapacityChangeTest.java b/src/test/java/com/aliyun/openservices/ots/model/CapacityChangeTest.java deleted file mode 100644 index 4822a4b..0000000 --- a/src/test/java/com/aliyun/openservices/ots/model/CapacityChangeTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class CapacityChangeTest { - - @Test - public void testCapacityChange() { - ReservedThroughputChange cc = new ReservedThroughputChange(); - - assertEquals(cc.isReadSet(), false); - assertEquals(cc.isWriteSet(), false); - - assertEquals(cc.getReadCapacityUnit(), 0); - assertEquals(cc.getWriteCapacityUnit(), 0); - - cc.setReadCapacityUnit(10); - assertEquals(cc.isReadSet(), true); - assertEquals(cc.isWriteSet(), false); - - assertEquals(cc.getReadCapacityUnit(), 10); - assertEquals(cc.getWriteCapacityUnit(), 0); - - cc.setWriteCapacityUnit(11); - assertEquals(cc.isReadSet(), true); - assertEquals(cc.isWriteSet(), true); - - assertEquals(cc.getReadCapacityUnit(), 10); - assertEquals(cc.getWriteCapacityUnit(), 11); - - cc.clearReadCapacityUnit(); - cc.clearWriteCapacityUnit(); - assertEquals(cc.isReadSet(), false); - assertEquals(cc.isWriteSet(), false); - } - -} diff --git a/src/test/java/com/aliyun/openservices/ots/model/OTSProtocolHelperTest.java b/src/test/java/com/aliyun/openservices/ots/model/OTSProtocolHelperTest.java deleted file mode 100644 index 5ee59bf..0000000 --- a/src/test/java/com/aliyun/openservices/ots/model/OTSProtocolHelperTest.java +++ /dev/null @@ -1,195 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class OTSProtocolHelperTest { - - @Test - public void testPrimaryKeyTypeConvert() { - assertEquals(OTSProtocolHelper.toPBColumnType(PrimaryKeyType.INTEGER), - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - assertEquals(OTSProtocolHelper.toPBColumnType(PrimaryKeyType.STRING), - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - assertEquals(OTSProtocolHelper.toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER), - PrimaryKeyType.INTEGER); - assertEquals(OTSProtocolHelper.toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING), - PrimaryKeyType.STRING); - assertEquals(OTSProtocolHelper.toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY), - PrimaryKeyType.BINARY); - try { - OTSProtocolHelper.toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.DOUBLE); - fail("expect exception."); - } catch(Exception e){ - } - try { - OTSProtocolHelper.toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BOOLEAN); - fail("expect exception."); - } catch(Exception e){ - } - try { - OTSProtocolHelper.toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN); - fail("expect exception."); - } catch(Exception e){ - } - try { - OTSProtocolHelper.toPrimaryKeyType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MAX); - fail("expect exception."); - } catch(Exception e){ - } - } - - @Test - public void testColumnTypeConvert() { - assertEquals(OTSProtocolHelper.toPBColumnType(ColumnType.BOOLEAN), - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BOOLEAN); - assertEquals(OTSProtocolHelper.toPBColumnType(ColumnType.INTEGER), - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - assertEquals(OTSProtocolHelper.toPBColumnType(ColumnType.STRING), - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - assertEquals(OTSProtocolHelper.toPBColumnType(ColumnType.DOUBLE), - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.DOUBLE); - assertEquals(OTSProtocolHelper.toPBColumnType(ColumnType.BINARY), - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY); - assertEquals(OTSProtocolHelper.toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BOOLEAN), - ColumnType.BOOLEAN); - assertEquals(OTSProtocolHelper.toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER), - ColumnType.INTEGER); - assertEquals(OTSProtocolHelper.toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING), - ColumnType.STRING); - assertEquals(OTSProtocolHelper.toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.DOUBLE), - ColumnType.DOUBLE); - assertEquals(OTSProtocolHelper.toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY), - ColumnType.BINARY); - - try { - OTSProtocolHelper.toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MIN); - fail("expect exception."); - } catch(Exception e){ - } - try { - OTSProtocolHelper.toColumnType(com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INF_MAX); - fail("expect exception."); - } catch(Exception e){ - } - } - - @Test - public void testPrimaryKeyValueConvert() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue pbValue = - OTSProtocolHelper.buildColumnValue(PrimaryKeyValue.fromLong(Integer.MAX_VALUE)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - assertEquals(pbValue.getVInt(), Integer.MAX_VALUE); - - PrimaryKeyValue value = OTSProtocolHelper.toPrimaryKeyValue(pbValue); - assertEquals(value.asLong(), Integer.MAX_VALUE); - - pbValue = OTSProtocolHelper.buildColumnValue(PrimaryKeyValue.fromLong(Integer.MIN_VALUE)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - assertEquals(pbValue.getVInt(), Integer.MIN_VALUE); - - value = OTSProtocolHelper.toPrimaryKeyValue(pbValue); - assertEquals(value.asLong(), Integer.MIN_VALUE); - - pbValue = OTSProtocolHelper.buildColumnValue(PrimaryKeyValue.fromString("")); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - assertEquals(pbValue.getVString(), ""); - - value = OTSProtocolHelper.toPrimaryKeyValue(pbValue); - assertEquals(value.asString(), ""); - - pbValue = OTSProtocolHelper.buildColumnValue(PrimaryKeyValue.fromString("阿里云")); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - assertEquals(pbValue.getVString(), "阿里云"); - - value = OTSProtocolHelper.toPrimaryKeyValue(pbValue); - assertEquals(value.asString(), "阿里云"); - } - - @Test - public void testColumnValueConvert() { - com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnValue pbValue = - OTSProtocolHelper.buildColumnValue(ColumnValue.fromLong(Integer.MAX_VALUE)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - assertEquals(pbValue.getVInt(), Integer.MAX_VALUE); - - ColumnValue value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(value.asLong(), Integer.MAX_VALUE); - - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromLong(Integer.MIN_VALUE)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.INTEGER); - assertEquals(pbValue.getVInt(), Integer.MIN_VALUE); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(value.asLong(), Integer.MIN_VALUE); - - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromString("")); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - assertEquals(pbValue.getVString(), ""); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(value.asString(), ""); - - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromString("阿里云")); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.STRING); - assertEquals(pbValue.getVString(), "阿里云"); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(value.asString(), "阿里云"); - - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromBoolean(true)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BOOLEAN); - assertEquals(pbValue.getVBool(), true); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(value.asBoolean(), true); - - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromBoolean(false)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BOOLEAN); - assertEquals(pbValue.getVBool(), false); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(value.asBoolean(), false); - - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromDouble(Double.MAX_VALUE)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.DOUBLE); - assertEquals(Double.toHexString(pbValue.getVDouble()), Double.toHexString(Double.MAX_VALUE)); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(Double.toHexString(value.asDouble()), Double.toHexString(Double.MAX_VALUE)); - - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromDouble(Double.MIN_VALUE)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.DOUBLE); - assertEquals(Double.toHexString(pbValue.getVDouble()), Double.toHexString(Double.MIN_VALUE)); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertEquals(Double.toHexString(value.asDouble()), Double.toHexString(Double.MIN_VALUE)); - - byte[] bs = {10, 11, 12, 13, 14, 15, 127, -1, -128}; - pbValue = OTSProtocolHelper.buildColumnValue(ColumnValue.fromBinary(bs)); - assertEquals(pbValue.getType(), com.aliyun.openservices.ots.protocol.OtsProtocol2.ColumnType.BINARY); - assertArrayEquals(bs, pbValue.getVBinary().toByteArray()); - - value = OTSProtocolHelper.toColumnValue(pbValue); - assertArrayEquals(bs, value.asBinary()); - } - - @Test - public void testRowExistenceExpectationConvertor() { - assertEquals(OTSProtocolHelper.toPBRowExistenceExpectation(RowExistenceExpectation.EXPECT_EXIST), - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.EXPECT_EXIST); - - assertEquals(OTSProtocolHelper.toPBRowExistenceExpectation(RowExistenceExpectation.EXPECT_NOT_EXIST), - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.EXPECT_NOT_EXIST); - - assertEquals(OTSProtocolHelper.toPBRowExistenceExpectation(RowExistenceExpectation.IGNORE), - com.aliyun.openservices.ots.protocol.OtsProtocol2.RowExistenceExpectation.IGNORE); - } - - @Test - public void testDirectionConvertor() { - assertEquals(OTSProtocolHelper.toPBDirection(Direction.BACKWARD), com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.BACKWARD); - assertEquals(OTSProtocolHelper.toPBDirection(Direction.FORWARD), com.aliyun.openservices.ots.protocol.OtsProtocol2.Direction.FORWARD); - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/model/PrimaryKeyTest.java b/src/test/java/com/aliyun/openservices/ots/model/PrimaryKeyTest.java deleted file mode 100644 index 1137895..0000000 --- a/src/test/java/com/aliyun/openservices/ots/model/PrimaryKeyTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class PrimaryKeyTest { - - @Test - public void testOperations() { - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) - .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) - .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)); - - assertEquals(primaryKey.getSize(), 3 + 8 * 3); - } - - @Test - public void testEquals() { - RowPrimaryKey primaryKey1 = new RowPrimaryKey(); - primaryKey1.addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) - .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) - .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)) - .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)) - .addPrimaryKeyColumn("E", PrimaryKeyValue.fromLong(5)); - - RowPrimaryKey primaryKey2 = new RowPrimaryKey(); - primaryKey2.addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) - .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) - .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)) - .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)) - .addPrimaryKeyColumn("E", PrimaryKeyValue.fromLong(5)); - - assertEquals(primaryKey1, primaryKey2); - assertEquals(primaryKey1.hashCode(), primaryKey2.hashCode()); - - RowPrimaryKey primaryKey3 = new RowPrimaryKey(); - primaryKey3.addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) - .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) - .addPrimaryKeyColumn("F", PrimaryKeyValue.fromLong(3)) - .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)) - .addPrimaryKeyColumn("E", PrimaryKeyValue.fromLong(5)); - - assertTrue(!primaryKey1.equals(primaryKey3)); - - RowPrimaryKey primaryKey4 = new RowPrimaryKey(); - primaryKey4.addPrimaryKeyColumn("A", PrimaryKeyValue.fromLong(1)) - .addPrimaryKeyColumn("B", PrimaryKeyValue.fromLong(2)) - .addPrimaryKeyColumn("C", PrimaryKeyValue.fromLong(3)) - .addPrimaryKeyColumn("D", PrimaryKeyValue.fromLong(4)); - assertTrue(!primaryKey1.equals(primaryKey4)); - } -} - diff --git a/src/test/java/com/aliyun/openservices/ots/model/RowChangeTest.java b/src/test/java/com/aliyun/openservices/ots/model/RowChangeTest.java deleted file mode 100644 index a2f9aee..0000000 --- a/src/test/java/com/aliyun/openservices/ots/model/RowChangeTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static org.junit.Assert.*; - -import org.junit.Test; - -import com.aliyun.openservices.ots.model.ColumnValue; -import com.aliyun.openservices.ots.model.PrimaryKeyValue; -import com.aliyun.openservices.ots.model.RowDeleteChange; -import com.aliyun.openservices.ots.model.RowPutChange; - -public class RowChangeTest { - - @Test - public void testRowPutChange() { - RowPutChange rc = new RowPutChange("tableName"); - assertTrue(rc.getRowPrimaryKey() != null); - assertTrue(rc.getAttributeColumns() != null); - - RowPrimaryKey pks = new RowPrimaryKey(); - pks.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromLong(1)); - rc.setPrimaryKey(pks); - rc.addAttributeColumn("col1", ColumnValue.fromDouble(3.5)); - rc.addAttributeColumn("col2", ColumnValue.fromLong(5)); - - assertEquals(1, rc.getRowPrimaryKey().getPrimaryKey().get("pk1").asLong()); - assertEquals("", 3.5, rc.getAttributeColumns().get("col1").asDouble(), 0); - assertEquals(5, rc.getAttributeColumns().get("col2").asLong()); - } - - @Test - public void testRowDeleteChange() { - RowDeleteChange rc = new RowDeleteChange("tableName"); - assertTrue(rc.getRowPrimaryKey() != null); - - RowPrimaryKey pks = new RowPrimaryKey(); - pks.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromLong(1)); - rc.setPrimaryKey(pks); - assertEquals(1, rc.getRowPrimaryKey().getPrimaryKey().get("pk1").asLong()); - } - - @Test - public void testRowUpdateChange() { - RowUpdateChange rc = new RowUpdateChange("tableName"); - RowPrimaryKey pks = new RowPrimaryKey(); - pks.addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromLong(1)); - rc.setPrimaryKey(pks); - - rc.addAttributeColumn("col1", ColumnValue.fromLong(2)); - assertEquals(1, rc.getRowPrimaryKey().getPrimaryKey().size()); - assertEquals(rc.getRowPrimaryKey().getPrimaryKey().get("pk1").asLong(), 1); - assertEquals(1, rc.getAttributeColumns().size()); - assertEquals(rc.getAttributeColumns().get("col1").asLong(), 2); - - rc.deleteAttributeColumn("col1"); - assertEquals(1, rc.getAttributeColumns().size()); - assertTrue(rc.getAttributeColumns().get("col1") == null); - } -} \ No newline at end of file diff --git a/src/test/java/com/aliyun/openservices/ots/model/RowQueryCriteriaTest.java b/src/test/java/com/aliyun/openservices/ots/model/RowQueryCriteriaTest.java deleted file mode 100644 index 50281d2..0000000 --- a/src/test/java/com/aliyun/openservices/ots/model/RowQueryCriteriaTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static org.junit.Assert.*; - -import org.junit.Test; - -import com.aliyun.openservices.ots.model.PrimaryKeyValue; -import com.aliyun.openservices.ots.model.RangeRowQueryCriteria; -import com.aliyun.openservices.ots.model.SingleRowQueryCriteria; - -public class RowQueryCriteriaTest { - private String tableName = "valid_table"; - - @Test - public void testSingleRowQueryCriteria() { - // valid table name - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - assertEquals(tableName, criteria.getTableName()); - assertTrue(criteria.getRowPrimaryKey() != null); - assertTrue(criteria.getColumnsToGet() != null); - criteria = new SingleRowQueryCriteria(tableName); - assertEquals(tableName, criteria.getTableName()); - - // with PK - RowPrimaryKey pks = new RowPrimaryKey(); - pks.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(1)); - criteria.setPrimaryKey(pks); - criteria.addColumnsToGet(new String[] { "name" }); - assertEquals(1, criteria.getRowPrimaryKey().getPrimaryKey().get("uid").asLong()); - assertEquals("name", criteria.getColumnsToGet().get(0)); - } - - @Test - public void testRangeRowQueryCriteria(){ - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - RowPrimaryKey inclusiveStartPrimaryKey = new RowPrimaryKey(); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(1)); - inclusiveStartPrimaryKey.addPrimaryKeyColumn("name", PrimaryKeyValue.INF_MIN); - - RowPrimaryKey exclusiveEndPrimaryKey = new RowPrimaryKey(); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("uid", PrimaryKeyValue.fromLong(1)); - exclusiveEndPrimaryKey.addPrimaryKeyColumn("name", PrimaryKeyValue.INF_MIN); - - criteria.setInclusiveStartPrimaryKey(inclusiveStartPrimaryKey); - criteria.setExclusiveEndPrimaryKey(exclusiveEndPrimaryKey); - - criteria.addColumnsToGet("col1"); - criteria.addColumnsToGet("col2"); - - criteria.setLimit(100); - - assertTrue(criteria.getInclusiveStartPrimaryKey() != null); - assertTrue(criteria.getExclusiveEndPrimaryKey() != null); - - assertEquals(1, criteria.getInclusiveStartPrimaryKey().getPrimaryKey().get("uid").asLong()); - assertEquals(1, criteria.getExclusiveEndPrimaryKey().getPrimaryKey().get("uid").asLong()); - - assertEquals("col1", criteria.getColumnsToGet().get(0)); - assertEquals("col2", criteria.getColumnsToGet().get(1)); - - assertEquals(100, criteria.getLimit()); - - try{ - criteria.setLimit(-1); - } - catch(ArithmeticException e) {} - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/model/TableMetaTest.java b/src/test/java/com/aliyun/openservices/ots/model/TableMetaTest.java deleted file mode 100644 index ba98d57..0000000 --- a/src/test/java/com/aliyun/openservices/ots/model/TableMetaTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.aliyun.openservices.ots.model; - -import static org.junit.Assert.*; - -import org.junit.Test; - -import com.aliyun.openservices.ots.model.PrimaryKeyType; -import com.aliyun.openservices.ots.model.TableMeta; - -public class TableMetaTest { - - @Test - public void testTableMetaCtor() { - String tableName = "table"; - TableMeta tm = new TableMeta(tableName); - assertTrue(tm.getPrimaryKey() != null); - assertEquals(tableName, tm.getTableName()); - } - - @Test - public void testTableMetaMembers() { - String tableName = "table"; - TableMeta tm = new TableMeta(tableName); - tm.addPrimaryKeyColumn("pk1", PrimaryKeyType.INTEGER); - tm.addPrimaryKeyColumn("pk2", PrimaryKeyType.STRING); - assertEquals(2, tm.getPrimaryKey().size()); - assertEquals(PrimaryKeyType.INTEGER, tm.getPrimaryKey().get("pk1")); - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/utils/BinaryFunction.java b/src/test/java/com/aliyun/openservices/ots/utils/BinaryFunction.java deleted file mode 100644 index fb63913..0000000 --- a/src/test/java/com/aliyun/openservices/ots/utils/BinaryFunction.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -public interface BinaryFunction { - TResult evaluate(TArg1 arg1, TArg2 arg2); -} diff --git a/src/test/java/com/aliyun/openservices/ots/utils/DateUtilUnittest.java b/src/test/java/com/aliyun/openservices/ots/utils/DateUtilUnittest.java deleted file mode 100644 index 3f3155b..0000000 --- a/src/test/java/com/aliyun/openservices/ots/utils/DateUtilUnittest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import static org.junit.Assert.*; - -import java.util.Date; - -import org.junit.Test; - -public class DateUtilUnittest { - private Date date = new Date(1408962632777L); - private String stringRfc822Date = "Mon, 25 Aug 2014 10:30:32 GMT"; - private String stringIso8601Date = "2014-08-25T10:30:32.777Z"; - private String stringAlternativeIso8601Date = "2014-08-25T10:30:32Z"; - - @Test - public void testRfc822Date() { - assertEquals(date.getTime()/1000, DateUtil.parseRfc822Date(stringRfc822Date).getTime()/1000); - assertEquals(stringRfc822Date, DateUtil.formatRfc822Date(date)); - } - - @Test - public void testIso8601Date() { - assertEquals(date.getTime()/1000, DateUtil.parseIso8601Date(stringIso8601Date).getTime()/1000); - assertEquals(stringIso8601Date, DateUtil.formatIso8601Date(date)); - } - - @Test - public void testAlternativeIso8601Date() { - assertEquals(date.getTime()/1000, DateUtil.parseAlternativeIso8601Date(stringAlternativeIso8601Date).getTime()/1000); - assertEquals(stringAlternativeIso8601Date, DateUtil.formatAlternativeIso8601Date(date)); - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/utils/ResourceManagerTest.java b/src/test/java/com/aliyun/openservices/ots/utils/ResourceManagerTest.java deleted file mode 100644 index 56a5eb1..0000000 --- a/src/test/java/com/aliyun/openservices/ots/utils/ResourceManagerTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import static org.junit.Assert.*; - -import java.util.Locale; - -import org.junit.Test; - -import com.aliyun.openservices.ots.utils.ResourceManager; - -public class ResourceManagerTest { - - @Test - public void testResourceManager(){ - // TODO: User a test-specific resource - String baseName = "common"; - ResourceManager rm; - - Locale currentLocale = Locale.getDefault(); - - try { - Locale.setDefault(Locale.ENGLISH); - rm = ResourceManager.getInstance(baseName); - assertEquals("Failed to parse the response result.", rm.getString("FailedToParseResponse")); - assertEquals("Connection error due to: test.", rm.getFormattedString("ConnectionError", "test.")); - - Locale.setDefault(Locale.CHINA); - rm = ResourceManager.getInstance(baseName); - assertEquals("返回结果无效,无法解析。", rm.getString("FailedToParseResponse")); - assertEquals("网络连接错误,详细信息:测试。", rm.getFormattedString("ConnectionError", "测试。")); - } finally { - Locale.setDefault(currentLocale); - } - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/utils/StreamUtils.java b/src/test/java/com/aliyun/openservices/ots/utils/StreamUtils.java deleted file mode 100644 index 238ff81..0000000 --- a/src/test/java/com/aliyun/openservices/ots/utils/StreamUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.security.DigestInputStream; -import java.security.MessageDigest; - -public class StreamUtils { - - public static String readContent(InputStream contentStream, String charset) - throws UnsupportedEncodingException{ - - InputStreamReader reader = - new InputStreamReader(contentStream, charset); - BufferedReader br = new BufferedReader(reader); - StringBuilder sb = new StringBuilder(); - String line = null; - try { - while((line = br.readLine()) != null){ - sb.append(line); - } - return sb.toString(); - } catch (IOException e) { - return null; - } - finally{ - try { - br.close(); - reader.close(); - } catch (IOException e) { - } - } - } - - public static String calculateMD5(InputStream in) throws Exception { - - DigestInputStream ds = new DigestInputStream(in, MessageDigest.getInstance("MD5")); - while (ds.read() != -1) { - } - - byte[] md5bytes = ds.getMessageDigest().digest(); - - StringBuilder sb = new StringBuilder(); - for (byte md5byte : md5bytes) { - String hexBiChars = String.format("%02x", md5byte); - sb.append(hexBiChars); - } - - return sb.toString(); - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/utils/TestUtil.java b/src/test/java/com/aliyun/openservices/ots/utils/TestUtil.java deleted file mode 100644 index 59c9e45..0000000 --- a/src/test/java/com/aliyun/openservices/ots/utils/TestUtil.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.aliyun.openservices.ots.utils; - -import com.aliyun.openservices.ots.OTS; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.model.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class TestUtil { - - public static long randomLong() { - Random random = new Random(System.currentTimeMillis()); - return random.nextInt(); - } - - public static boolean randomBoolean() { - Random random = new Random(System.currentTimeMillis()); - return random.nextInt() % 2 == 0; - } - - public static double randomDouble() { - Random random = new Random(System.currentTimeMillis()); - return random.nextDouble(); - } - - public static byte[] randomBytes(int length) { - Random random = new Random(System.currentTimeMillis()); - byte[] result = new byte[length]; - random.nextBytes(result); - return result; - } - - public static String newTableName(String tableName) { - return tableName + "_" + System.getProperty("java.version").replace(".", "_"); - } - - public static String randomString(int length) { - Random random = new Random(System.currentTimeMillis()); - char[] chars = new char[length]; - for (int i = 0; i < length; i++) { - chars[i] = (char)random.nextInt(); - } - return new String(new String(chars).getBytes()); - } - - public static int randomLength() { - int length = (int)(randomLong() % (1024)); - return Math.abs(length); - } - - public static PrimaryKeyValue randomPrimaryKeyValue(PrimaryKeyType type) { - switch (type) { - case STRING: - return PrimaryKeyValue.fromString(randomString(randomLength())); - case INTEGER: - return PrimaryKeyValue.fromLong(randomLong()); - default: - throw new IllegalStateException("Unsupported primary key type: " + type); - } - } - - public static ColumnValue randomColumnValue(ColumnType type) { - switch (type) { - case STRING: - return ColumnValue.fromString(randomString(randomLength())); - case INTEGER: - return ColumnValue.fromLong(randomLong()); - case BOOLEAN: - return ColumnValue.fromBoolean(randomBoolean()); - case DOUBLE: - return ColumnValue.fromDouble(randomDouble()); - case BINARY: - return ColumnValue.fromBinary(randomBytes(randomLength())); - default: - throw new IllegalStateException("Unsupported column type: " + type); - } - } - - public static void DeleteTable(OTS ots, String tableName) { - try { - DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName); - ots.deleteTable(deleteTableRequest); - } catch (Exception ex) { - ; - } - } -} diff --git a/src/test/java/com/aliyun/openservices/ots/writer/TestWriter.java b/src/test/java/com/aliyun/openservices/ots/writer/TestWriter.java deleted file mode 100644 index fd369bd..0000000 --- a/src/test/java/com/aliyun/openservices/ots/writer/TestWriter.java +++ /dev/null @@ -1,391 +0,0 @@ -package com.aliyun.openservices.ots.writer; - -import com.aliyun.openservices.ots.*; -import com.aliyun.openservices.ots.internal.OTSAlwaysRetryStrategy; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.internal.OTSRetryStrategy; -import com.aliyun.openservices.ots.internal.writer.WriterConfig; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.utils.ServiceSettings; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class TestWriter { - private static final String tableName = "WriterTest"; - private static ServiceSettings serviceSettings = ServiceSettings.load(); - private static AtomicLong succeedRows = new AtomicLong(); - private static AtomicLong failedRows = new AtomicLong(); - private static long rowsCount = 100000; - private static long columnsCount = 10; - private static int concurrency = 100; - private static int queueSize = 4096; - private OTSAsync ots; - final String strValue = "0123456789"; - private static AtomicLong retryCount = new AtomicLong(); - - public void createTable(OTSAsync ots) { - CreateTableRequest request = new CreateTableRequest(); - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn("pk0", PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn("pk1", PrimaryKeyType.STRING); - tableMeta.addPrimaryKeyColumn("pk2", PrimaryKeyType.INTEGER); - request.setTableMeta(tableMeta); - request.setReservedThroughput(new CapacityUnit(0, 0)); - - OTSFuture future = ots.createTable(request); - future.get(); - } - - @Before - public void setUp() throws Exception { - succeedRows.getAndSet(0); - failedRows.getAndSet(0); - - ClientConfiguration cc = new ClientConfiguration(); - cc.setMaxConnections(1000); - OTSServiceConfiguration ss = new OTSServiceConfiguration(); - ss.setRetryStrategy(new OTSRetryStrategy() { - @Override - public boolean shouldRetry(String action, Exception ex, int retries) { - if (action.equals(OTSActionNames.ACTION_DELETE_TABLE)) { - return false; - } - - if (ex instanceof OTSException) { - OTSException otsException = (OTSException) ex; - if (otsException.getErrorCode().equals(OTSErrorCode.INVALID_PARAMETER)) { - return false; - } - } - - retryCount.incrementAndGet(); - return true; - } - - @Override - public long getPauseDelay(String action, Exception ex, int retries) { - return 10; - } - }); - ots = new OTSClientAsync(serviceSettings.getOTSEndpoint(), - serviceSettings.getOTSAccessKeyId(), serviceSettings.getOTSAccessKeySecret(), - serviceSettings.getOTSInstanceName(), cc, ss); - - try { - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - OTSFuture future = ots.deleteTable(request); - future.get(); - } catch (OTSException e) { - // pass - } - createTable(ots); - Thread.sleep(3000); - } - - @After - public void after() { - ots.shutdown(); - } - - public static DefaultOTSWriter createWriter(OTSAsync ots, WriterConfig config, Executor executor) { - OTSCallback callback = new OTSCallback() { - @Override - public void onCompleted(OTSContext otsContext) { - succeedRows.incrementAndGet(); - } - - @Override - public void onFailed(OTSContext otsContext, OTSException ex) { - failedRows.incrementAndGet(); - } - - @Override - public void onFailed(OTSContext otsContext, ClientException ex) { - failedRows.incrementAndGet(); - } - }; - DefaultOTSWriter writer = new DefaultOTSWriter(ots, tableName, config, callback, executor); - - return writer; - } - - @Test - public void testWriteSameRow() throws Exception { - final WriterConfig config = new WriterConfig(); - config.setConcurrency(concurrency); - config.setBufferSize(queueSize); - config.setFlushInterval(1000000); - final ExecutorService executor = Executors.newFixedThreadPool(10); - - DefaultOTSWriter writer = createWriter(ots, config, executor); - - try { - for (int i = 0; i < 100; i++) { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - RowPrimaryKey pk = new RowPrimaryKey(); - pk.addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(0)).addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + 0)) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(0)); - - rowChange.setPrimaryKey(pk); - for (int j = 0; j < columnsCount; j++) { - rowChange.addAttributeColumn("column_" + j, ColumnValue.fromString(strValue)); - } - - writer.addRowChange(rowChange); - } - - writer.flush(); - - } finally { - writer.close(); - executor.shutdown(); - executor.awaitTermination(10, TimeUnit.SECONDS); - } - - assertEquals(succeedRows.get(), 100); - assertEquals(writer.getTotalRPCCount(), 100); - } - - @Test - public void testMixOperation() throws Exception { - final WriterConfig config = new WriterConfig(); - config.setConcurrency(concurrency); - config.setBufferSize(queueSize); - config.setFlushInterval(1000000); - final ExecutorService executor = Executors.newFixedThreadPool(10); - - final DefaultOTSWriter writer = createWriter(ots, config, executor); - - final int threadsCount = 5; - List threads = new ArrayList(); - try { - for (int i = 0; i < threadsCount; i++) { - final int finalI = i; - Thread th = new Thread(new Runnable() { - public void run() { - Random random = new Random(System.currentTimeMillis() + finalI * 1000); - for (int i = 0; i < rowsCount; i++) { - int id = Math.abs(random.nextInt()) % 2; - if (id == 0) { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - RowPrimaryKey pk = new RowPrimaryKey(); - pk.addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(i)).addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + i)) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(i)); - - rowChange.setPrimaryKey(pk); - for (int j = 0; j < columnsCount; j++) { - rowChange.addAttributeColumn("update_" + j, ColumnValue.fromString(strValue)); - } - - writer.addRowChange(rowChange); - } else { - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey pk = new RowPrimaryKey(); - pk.addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(i)).addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + i)) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(i)); - - rowChange.setPrimaryKey(pk); - for (int j = 0; j < columnsCount; j++) { - rowChange.addAttributeColumn("put_" + j, ColumnValue.fromString(strValue)); - } - - writer.addRowChange(rowChange); - } - } - System.out.println("Write thread finished."); - } - }); - threads.add(th); - } - - for (Thread thread : threads) { - thread.start(); - } - - for (Thread thread : threads) { - thread.join(); - } - - writer.flush(); - - assertEquals(succeedRows.get(), threadsCount * rowsCount); - scanTable(ots); - } finally { - writer.close(); - executor.shutdown(); - executor.awaitTermination(10, TimeUnit.SECONDS); - } - } - - private void scanTable(OTSAsync ots) { - int rowsCountInTable = 0; - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - RowPrimaryKey start = new RowPrimaryKey(); - start.addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN).addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MIN) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MIN); - RowPrimaryKey end = new RowPrimaryKey(); - end.addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX).addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MAX) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MAX); - criteria.setInclusiveStartPrimaryKey(start); - criteria.setExclusiveEndPrimaryKey(end); - - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - RowPrimaryKey nextStart = null; - do { - OTSFuture future = ots.getRange(request); - GetRangeResult result = future.get(); - for (Row row : result.getRows()) { - ColumnValue pk0 = row.getColumns().get("pk0"); - ColumnValue pk1 = row.getColumns().get("pk1"); - ColumnValue pk2 = row.getColumns().get("pk2"); - assertEquals(pk0.asLong(), rowsCountInTable); - assertEquals(pk1.asString(), "pk_" + rowsCountInTable); - assertEquals(pk2.asLong(), rowsCountInTable); - - if (row.getColumns().containsKey("put_0")) { - for (int i = 0; i < columnsCount; i++) { - ColumnValue c = row.getColumns().get("put_" + i); - assertTrue(c != null); - assertEquals(c.asString(), strValue); - } - } else if (row.getColumns().containsKey("update_0")) { - for (int i = 0; i < columnsCount; i++) { - ColumnValue c = row.getColumns().get("update_" + i); - assertTrue(c != null); - assertEquals(c.asString(), strValue); - } - } - - rowsCountInTable++; - } - - nextStart = result.getNextStartPrimaryKey(); - - if (nextStart != null) { - criteria.setInclusiveStartPrimaryKey(nextStart); - } - } while (nextStart != null); - - assertEquals(rowsCountInTable, rowsCount); - } - - @Test - public void testWriteDirtyRows() throws Exception { - final WriterConfig config = new WriterConfig(); - config.setConcurrency(concurrency); - config.setBufferSize(queueSize); - config.setFlushInterval(1000000); - config.setMaxAttrColumnSize(3 * 1024 * 1024); // max attribute length set to 100KB - config.setMaxBatchSize(4 * 1024 * 1024); - StringBuilder longStr = new StringBuilder(); - for (int i = 0; i < 2 * 1024 * 1024 + 1; i++) { - longStr.append('a'); - } - final ExecutorService executor = Executors.newFixedThreadPool(10); - - DefaultOTSWriter writer = createWriter(ots, config, executor); - - int dirtyRowId = 25; - try { - for (int i = 0; i < 100; i++) { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - RowPrimaryKey pk = new RowPrimaryKey(); - pk.addPrimaryKeyColumn("pk0", PrimaryKeyValue.fromLong(i)).addPrimaryKeyColumn("pk1", PrimaryKeyValue.fromString("pk_" + i)) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.fromLong(i)); - - rowChange.setPrimaryKey(pk); - for (int j = 0; j < columnsCount; j++) { - rowChange.addAttributeColumn("column_" + j, ColumnValue.fromString(strValue)); - } - - if (i == dirtyRowId) { - rowChange.addAttributeColumn("longattr", ColumnValue.fromString(longStr.toString())); - } - - writer.addRowChange(rowChange); - } - - writer.flush(); - - } finally { - writer.close(); - executor.shutdown(); - executor.awaitTermination(10, TimeUnit.SECONDS); - } - - assertEquals(succeedRows.get(), 99); - assertEquals(failedRows.get(), 1); - - int rowsCountInTable = 0; - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - RowPrimaryKey start = new RowPrimaryKey(); - start.addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MIN).addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MIN) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MIN); - RowPrimaryKey end = new RowPrimaryKey(); - end.addPrimaryKeyColumn("pk0", PrimaryKeyValue.INF_MAX).addPrimaryKeyColumn("pk1", PrimaryKeyValue.INF_MAX) - .addPrimaryKeyColumn("pk2", PrimaryKeyValue.INF_MAX); - criteria.setInclusiveStartPrimaryKey(start); - criteria.setExclusiveEndPrimaryKey(end); - - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - - RowPrimaryKey nextStart = null; - do { - OTSFuture future = ots.getRange(request); - GetRangeResult result = future.get(); - for (Row row : result.getRows()) { - if (rowsCountInTable == dirtyRowId) { - rowsCountInTable++; - } - ColumnValue pk0 = row.getColumns().get("pk0"); - ColumnValue pk1 = row.getColumns().get("pk1"); - ColumnValue pk2 = row.getColumns().get("pk2"); - assertEquals(pk0.asLong(), rowsCountInTable); - assertEquals(pk1.asString(), "pk_" + rowsCountInTable); - assertEquals(pk2.asLong(), rowsCountInTable); - - if (row.getColumns().containsKey("put_0")) { - for (int i = 0; i < columnsCount; i++) { - ColumnValue c = row.getColumns().get("put_" + i); - assertTrue(c != null); - assertEquals(c.asString(), strValue); - } - } else if (row.getColumns().containsKey("update_0")) { - for (int i = 0; i < columnsCount; i++) { - ColumnValue c = row.getColumns().get("update_" + i); - assertTrue(c != null); - assertEquals(c.asString(), strValue); - } - } - - rowsCountInTable++; - } - - nextStart = result.getNextStartPrimaryKey(); - - if (nextStart != null) { - criteria.setInclusiveStartPrimaryKey(nextStart); - } - } while (nextStart != null); - - assertEquals(rowsCountInTable, 100); - } -} diff --git a/src/test/java/examples/OTSAsyncSample.java b/src/test/java/examples/AsyncSample.java old mode 100755 new mode 100644 similarity index 62% rename from src/test/java/examples/OTSAsyncSample.java rename to src/test/java/examples/AsyncSample.java index 7a73f7b..a651277 --- a/src/test/java/examples/OTSAsyncSample.java +++ b/src/test/java/examples/AsyncSample.java @@ -1,293 +1,294 @@ -package examples; - -import com.aliyun.openservices.ots.*; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.condition.RelationalCondition; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -public class OTSAsyncSample { - - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - private static final String COLUMN_NAME_NAME = "name"; - private static final String COLUMN_AGE_NAME = "age"; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = ""; - final String accessKey = ""; - final String instanceName = ""; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, instanceName); - OTSClientAsync asyncClient = new OTSClientAsync(endPoint, accessId, accessKey, instanceName); - final String tableName = "sampleTable"; - - try{ - // 创建表 - createTable(client, tableName); - - // 注意:创建表只是提交请求,OTS创建表需要一段时间。 - // 这里简单地等待2秒,请根据您的实际逻辑修改。 - Thread.sleep(2000); - - listTableWithFuture(asyncClient); - listTableWithCallback(asyncClient); - - // 异步并发的执行多次batchWriteRow操作 - batchWriteRow(asyncClient, tableName); - - // 异步并发的执行多次getRange操作 - batchGetRange(asyncClient, tableName); - }catch(ServiceException e){ - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())){ - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - }catch(ClientException e){ - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } - finally{ - // 不留垃圾。 - try { - deleteTable(client, tableName); - } catch (ServiceException e) { - System.err.println("删除表格失败,原因:" + e.getMessage()); - e.printStackTrace(); - } catch (ClientException e) { - System.err.println("删除表格请求失败,原因:" + e.getMessage()); - e.printStackTrace(); - } - client.shutdown(); - asyncClient.shutdown(); - } - } - - private static OTSFuture sendGetRangeRequest(OTSClientAsync asyncClient, String tableName, long start, long end) { - RowPrimaryKey startPk = new RowPrimaryKey(); - startPk.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(start)); - startPk.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MIN); - - RowPrimaryKey endPk = new RowPrimaryKey(); - endPk.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(end)); - endPk.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MIN); - - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(startPk); - criteria.setExclusiveEndPrimaryKey(endPk); - criteria.setLimit(10); - - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - OTSFuture future = asyncClient.getRange(request); - return future; - } - - private static void batchGetRange(OTSClientAsync asyncClient, String tableName) { - // 一次性查询多个范围的数据,设置10个任务,每个任务查询100条数据。 - // 每个范围查询的时候设置limit为10,100条数据需要10次请求才能全部查完。 - int count = 10; - OTSFuture[] futures = new OTSFuture[count]; - for (int i = 0; i < count; i++) { - futures[i] = sendGetRangeRequest(asyncClient, tableName, i * 100, i * 100 + 100); - } - - // 检查是否所有范围查询均已做完,若未做完,则继续发送查询请求 - List allRows = new ArrayList(); - while (true) { - boolean completed = true; - for (int i = 0; i < futures.length; i++) { - OTSFuture future = futures[i]; - if (future == null) { - continue; - } - - if (future.isDone()) { - GetRangeResult result = future.get(); - allRows.addAll(result.getRows()); - - if (result.getNextStartPrimaryKey() != null) { - // 该范围还未查询完毕,需要从nextStart开始继续往下读。 - long nextStart = result.getNextStartPrimaryKey().getPrimaryKey().get(COLUMN_GID_NAME).asLong(); - long rangeEnd = i * 100 + 100; - futures[i] = sendGetRangeRequest(asyncClient, tableName, nextStart, rangeEnd); - completed = false; - } else { - futures[i] = null; // 若某个范围查询完毕,则将对应future设置为null - } - } else { - completed = false; - } - } - - if (completed) { - break; - } else { - try { - Thread.sleep(10); // 避免busy wait,每次循环完毕后等待一小段时间 - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - // 所有数据全部读出 - System.out.println("Total rows scanned: " + allRows.size()); - } - - private static void batchWriteRow(OTSClientAsync asyncClient, String tableName) { - // BatchWriteRow的行数限制是100行,使用异步接口,实现一次批量导入1000行。 - List> futures = new ArrayList>(); - int count = 10; - // 一次性发出10个请求,每个请求写100行数据 - for (int i = 0; i < count; i++) { - BatchWriteRowRequest request = new BatchWriteRowRequest(); - for (int j = 0; j < 100; j++) { - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(i * 100 + j)); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(j)); - rowChange.setPrimaryKey(primaryKey); - rowChange.addAttributeColumn(COLUMN_NAME_NAME, ColumnValue.fromString("name" + j)); - rowChange.addAttributeColumn(COLUMN_AGE_NAME, ColumnValue.fromLong(j)); - - request.addRowChange(rowChange); - } - OTSFuture result = asyncClient.batchWriteRow(request); - futures.add(result); - } - - // 等待结果返回 - List results = new ArrayList(); - for (OTSFuture future : futures) { - try { - BatchWriteRowResult result = future.get(); // 同步等待结果返回 - results.add(result); - } catch (OTSException e) { - e.printStackTrace(); - } catch (ClientException e) { - e.printStackTrace(); - } - } - - // 统计返回结果 - int totalSucceedRows = 0; - int totalFailedRows = 0; - for (BatchWriteRowResult result : results) { - totalSucceedRows += result.getSucceedRowsOfPut().size(); - totalFailedRows += result.getFailedRowsOfPut().size(); - } - - System.out.println("Total succeed rows: " + totalSucceedRows); - System.out.println("Total failed rows: " + totalFailedRows); - } - - private static void listTableWithCallback(OTSClientAsync asyncClient) { - final AtomicBoolean isDone = new AtomicBoolean(false); - OTSCallback callback = new OTSCallback() { - @Override - public void onCompleted(OTSContext otsContext) { - isDone.set(true); - System.out.println("\nList table by listTableWithCallback:"); - for (String tableName : otsContext.getOTSResult().getTableNames()) { - System.out.println(tableName); - } - } - - @Override - public void onFailed(OTSContext otsContext, OTSException ex) { - isDone.set(true); - ex.printStackTrace(); - } - - @Override - public void onFailed(OTSContext otsContext, ClientException ex) { - isDone.set(true); - ex.printStackTrace(); - } - }; - - asyncClient.listTable(callback); // 将callback扔给SDK,SDK在完成请求接到响应后,会自动调用callback - - // 等待callback被调用,一般的业务处理逻辑下,不需要这一步等待。 - while (!isDone.get()) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - private static void listTableWithFuture(OTSClientAsync client) { - // 通过Future同步的等待结果返回。 - try { - OTSFuture future = client.listTable(); - ListTableResult result = future.get(); // 同步的等待 - System.out.println("\nList table by listTableWithFuture:"); - for (String tableName : result.getTableNames()) { - System.out.println(tableName); - } - } catch (OTSException e) { - e.printStackTrace(); - } catch (ClientException e) { - e.printStackTrace(); - } - - // 通过Future,间歇性的等待结果返回。 - try { - OTSFuture future = client.listTable(); - - while (!future.isDone()) { - System.out.println("Waiting for result of list table."); - Thread.sleep(10); // 每隔10ms检查结果是否返回 - } - - ListTableResult result = future.get(); - System.out.println("\nList table by listTableWithFuture:"); - for (String tableName : result.getTableNames()) { - System.out.println(tableName); - } - } catch (OTSException e) { - e.printStackTrace(); - } catch (ClientException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } -} +package examples; + +import com.alicloud.openservices.tablestore.*; +import com.alicloud.openservices.tablestore.core.ErrorCode; +import com.alicloud.openservices.tablestore.model.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.atomic.AtomicBoolean; + +public class AsyncSample { + + private static final String COLUMN_GID_NAME = "gid"; + private static final String COLUMN_UID_NAME = "uid"; + private static final String COLUMN_NAME_NAME = "name"; + private static final String COLUMN_AGE_NAME = "age"; + + public static void main(String args[]) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClientInterface client = new SyncClient(endPoint, accessId, accessKey, instanceName); + AsyncClientInterface asyncClient = new AsyncClient(endPoint, accessId, accessKey, instanceName); + final String tableName = "sampleTable"; + + try{ + // 创建表 + createTable(client, tableName); + + // 注意:创建表只是提交请求,OTS创建表需要一段时间。 + // 这里简单地等待2秒,请根据您的实际逻辑修改。 + Thread.sleep(2000); + + listTableWithFuture(asyncClient); + listTableWithCallback(asyncClient); + + // 异步并发的执行多次batchWriteRow操作 + batchWriteRow(asyncClient, tableName); + + // 异步并发的执行多次getRange操作 + batchGetRange(asyncClient, tableName); + }catch(TableStoreException e){ + System.err.println("操作失败,详情:" + e.getMessage()); + // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 + if (ErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())){ + System.err.println("超出存储配额。"); + } + // Request ID可以用于有问题时联系客服诊断异常。 + System.err.println("Request ID:" + e.getRequestId()); + }catch(ClientException e){ + // 可能是网络不好或者是返回结果有问题 + System.err.println("请求失败,详情:" + e.getMessage()); + } catch (Exception e) { + System.err.println(e.getMessage()); + } + finally{ + // 不留垃圾。 + try { + deleteTable(client, tableName); + } catch (TableStoreException e) { + System.err.println("删除表格失败,原因:" + e.getMessage()); + e.printStackTrace(); + } catch (ClientException e) { + System.err.println("删除表格请求失败,原因:" + e.getMessage()); + e.printStackTrace(); + } + client.shutdown(); + asyncClient.shutdown(); + } + } + + private static Future sendGetRangeRequest(AsyncClientInterface asyncClient, String tableName, long start, long end) { + PrimaryKey startPk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(start)) + .addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MIN).build(); + + PrimaryKey endPk = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(end)) + .addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MIN).build(); + + RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); + criteria.setInclusiveStartPrimaryKey(startPk); + criteria.setExclusiveEndPrimaryKey(endPk); + criteria.setLimit(10); + + criteria.setMaxVersions(1); + + GetRangeRequest request = new GetRangeRequest(); + request.setRangeRowQueryCriteria(criteria); + Future future = asyncClient.getRange(request, null); + return future; + } + + private static void batchGetRange(AsyncClientInterface asyncClient, String tableName) throws ExecutionException, InterruptedException { + // 一次性查询多个范围的数据,设置10个任务,每个任务查询100条数据。 + // 每个范围查询的时候设置limit为10,100条数据需要10次请求才能全部查完。 + int count = 10; + Future[] futures = new Future[count]; + for (int i = 0; i < count; i++) { + futures[i] = sendGetRangeRequest(asyncClient, tableName, i * 100, i * 100 + 100); + } + + // 检查是否所有范围查询均已做完,若未做完,则继续发送查询请求 + List allRows = new ArrayList(); + while (true) { + boolean completed = true; + for (int i = 0; i < futures.length; i++) { + Future future = futures[i]; + if (future == null) { + continue; + } + + if (future.isDone()) { + GetRangeResponse result = future.get(); + allRows.addAll(result.getRows()); + + if (result.getNextStartPrimaryKey() != null) { + // 该范围还未查询完毕,需要从nextStart开始继续往下读。 + long nextStart = result.getNextStartPrimaryKey().getPrimaryKeyColumn(COLUMN_GID_NAME).getValue().asLong(); + long rangeEnd = i * 100 + 100; + futures[i] = sendGetRangeRequest(asyncClient, tableName, nextStart, rangeEnd); + completed = false; + } else { + futures[i] = null; // 若某个范围查询完毕,则将对应future设置为null + } + } else { + completed = false; + } + } + + if (completed) { + break; + } else { + try { + Thread.sleep(10); // 避免busy wait,每次循环完毕后等待一小段时间 + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + // 所有数据全部读出 + System.out.println("Total rows scanned: " + allRows.size()); + } + + private static void batchWriteRow(AsyncClientInterface asyncClient, String tableName) { + // BatchWriteRow的行数限制是100行,使用异步接口,实现一次批量导入1000行。 + List> futures = new ArrayList>(); + int count = 10; + // 一次性发出10个请求,每个请求写100行数据 + for (int i = 0; i < count; i++) { + BatchWriteRowRequest request = new BatchWriteRowRequest(); + for (int j = 0; j < 100; j++) { + RowPutChange rowChange = new RowPutChange(tableName); + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder() + .addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(i * 100 + j)) + .addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(j)).build(); + rowChange.setPrimaryKey(primaryKey); + rowChange.addColumn(COLUMN_NAME_NAME, ColumnValue.fromString("name" + j)); + rowChange.addColumn(COLUMN_AGE_NAME, ColumnValue.fromLong(j)); + + request.addRowChange(rowChange); + } + Future result = asyncClient.batchWriteRow(request, null); + futures.add(result); + } + + // 等待结果返回 + List results = new ArrayList(); + for (Future future : futures) { + try { + BatchWriteRowResponse result = future.get(); // 同步等待结果返回 + results.add(result); + } catch (TableStoreException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + // 统计返回结果 + int totalSucceedRows = 0; + int totalFailedRows = 0; + for (BatchWriteRowResponse result : results) { + totalSucceedRows += result.getSucceedRows().size(); + totalFailedRows += result.getFailedRows().size(); + } + + System.out.println("Total succeed rows: " + totalSucceedRows); + System.out.println("Total failed rows: " + totalFailedRows); + } + + private static void listTableWithCallback(AsyncClientInterface asyncClient) { + final AtomicBoolean isDone = new AtomicBoolean(false); + TableStoreCallback callback = new TableStoreCallback() { + @Override + public void onCompleted(ListTableRequest request, ListTableResponse response) { + isDone.set(true); + System.out.println("\nList table by listTableWithCallback:"); + for (String tableName : response.getTableNames()) { + System.out.println(tableName); + } + } + + @Override + public void onFailed(ListTableRequest request, Exception ex) { + isDone.set(true); + ex.printStackTrace(); + } + }; + + asyncClient.listTable(callback); // 将callback扔给SDK,SDK在完成请求接到响应后,会自动调用callback + + // 等待callback被调用,一般的业务处理逻辑下,不需要这一步等待。 + while (!isDone.get()) { + try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + private static void listTableWithFuture(AsyncClientInterface client) { + // 通过Future同步的等待结果返回。 + try { + Future future = client.listTable(null); + ListTableResponse result = future.get(); // 同步的等待 + System.out.println("\nList table by listTableWithFuture:"); + for (String tableName : result.getTableNames()) { + System.out.println(tableName); + } + } catch (TableStoreException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + // 通过Future,间歇性的等待结果返回。 + try { + Future future = client.listTable(null); + + while (!future.isDone()) { + System.out.println("Waiting for result of list table."); + Thread.sleep(10); // 每隔10ms检查结果是否返回 + } + + ListTableResponse result = future.get(); + System.out.println("\nList table by listTableWithFuture:"); + for (String tableName : result.getTableNames()) { + System.out.println(tableName); + } + } catch (TableStoreException e) { + e.printStackTrace(); + } catch (ClientException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static void createTable(SyncClientInterface client, String tableName) + throws TableStoreException, ClientException{ + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); + tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setTimeToLive(-1); + tableOptions.setMaxVersions(1); + + // 将该表的读写CU都设置为0 + CapacityUnit capacityUnit = new CapacityUnit(0, 0); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + request.setTableMeta(tableMeta); + request.setReservedThroughput(new ReservedThroughput(capacityUnit)); + client.createTable(request); + + System.out.println("表已创建"); + } + + private static void deleteTable(SyncClientInterface client, String tableName) + throws TableStoreException, ClientException{ + DeleteTableRequest request = new DeleteTableRequest(tableName); + client.deleteTable(request); + + System.out.println("表已删除"); + } +} diff --git a/src/test/java/examples/CallRecordsUsingGlobalIndex.java b/src/test/java/examples/CallRecordsUsingGlobalIndex.java new file mode 100644 index 0000000..992c7c8 --- /dev/null +++ b/src/test/java/examples/CallRecordsUsingGlobalIndex.java @@ -0,0 +1,381 @@ +package examples; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; + +import java.util.ArrayList; + +public class CallRecordsUsingGlobalIndex { + + /** + * 建立通话记录表,其中包含两列主键,第一列主键为主叫号码,第二列主键为通话发生时间,类型均为Interger + * 通话记录表中包含三列预定义列,分别为被叫号码,通话时长,基站号码,类型均为Integer + * 另外建立三张索引表,第一张为被叫号码索引表,主键为被叫号码,没有属性列 + * 第二张为基站话单索引表,主键为基站号码,通话发生时间,没有属性列 + * 第三张为基站话单时间索引表,主键为基站号码,通话发生时间,属性列为通话时长 + */ + private static final String TABLE_NAME = "CallRecordTable"; + private static final String INDEX0_NAME = "IndexOnBeCalledNumber"; + private static final String INDEX1_NAME = "IndexOnBaseStation1"; + private static final String INDEX2_NAME = "IndexOnBaseStation2"; + private static final String PRIMARY_KEY_NAME_1 = "CellNumber"; + private static final String PRIMARY_KEY_NAME_2 = "StartTime"; + private static final String DEFINED_COL_NAME_1 = "CalledNumber"; + private static final String DEFINED_COL_NAME_2 = "Duration"; + private static final String DEFINED_COL_NAME_3 = "BaseStationNumber"; + + public static void main(String[] args) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient client = new SyncClient(endPoint, accessId, accessKey, instanceName); + + try { + + //deleteTable(client); + // 建表 + createTable(client); + + System.out.println("建表成功."); + + // 等待加载完成 + try { + Thread.sleep(10 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // 向主表中写入通话记录 + putRow(client, 123456, 1532574644, 654321, 60, 1); + putRow(client, 234567, 1532574714, 765432, 10, 1); + putRow(client, 234567, 1532574734, 123456, 20, 3); + putRow(client, 345678, 1532574795, 123456, 5, 2); + putRow(client, 456789, 1532584054, 345678, 200, 3); + + // 查询号码`234567`的所有主叫话单 + + getRangeFromMainTable(client, 234567); + + // 查询号码`123456`的所有被叫话单 + getRangeFromIndexTable(client, 123456); + + // 查询基站`2`从时间`1532574740`开始的所有话单 + getRangeFromIndexTable(client,2, 1532574740); + + // 查询基站`3`从时间`1532574861`到`1532584054`的所有通话记录的通话时长 + getRowFromIndexAndMainTable(client, + 3, + 1532574861, + 1532584054, + DEFINED_COL_NAME_2); + getRangeFromIndexTable(client, + 3, + 1532574861, + 1532584054, + DEFINED_COL_NAME_2); + + // 删表 + deleteTable(client); + + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } finally { + // 为了安全,这里不能默认删表,如果需要删表,需用户自己手动打开 + // deleteTable(client); + } + client.shutdown(); + } + + private static void createTable(SyncClient client) { + TableMeta tableMeta = new TableMeta(TABLE_NAME); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_1, PrimaryKeyType.INTEGER)); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_2, PrimaryKeyType.INTEGER)); + tableMeta.addDefinedColumn(new DefinedColumnSchema(DEFINED_COL_NAME_1, DefinedColumnType.INTEGER)); + tableMeta.addDefinedColumn(new DefinedColumnSchema(DEFINED_COL_NAME_2, DefinedColumnType.INTEGER)); + tableMeta.addDefinedColumn(new DefinedColumnSchema(DEFINED_COL_NAME_3, DefinedColumnType.INTEGER)); + + + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 带索引表的主表数据过期时间必须为-1 + int maxVersions = 1; // 保存的最大版本数, 带索引表的请表最大版本数必须为1 + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + ArrayList indexMetas = new ArrayList(); + IndexMeta indexMeta0 = new IndexMeta(INDEX0_NAME); + indexMeta0.addPrimaryKeyColumn(DEFINED_COL_NAME_1); + indexMetas.add(indexMeta0); + IndexMeta indexMeta1 = new IndexMeta(INDEX1_NAME); + indexMeta1.addPrimaryKeyColumn(DEFINED_COL_NAME_3); + indexMeta1.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2); + indexMetas.add(indexMeta1); + IndexMeta indexMeta2 = new IndexMeta(INDEX2_NAME); + indexMeta2.addPrimaryKeyColumn(DEFINED_COL_NAME_3); + indexMeta2.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2); + indexMeta2.addDefinedColumn(DEFINED_COL_NAME_2); + indexMetas.add(indexMeta2); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions, indexMetas); + + client.createTable(request); + } + + + private static void deleteTable(SyncClient client) { + DeleteTableRequest request = new DeleteTableRequest(TABLE_NAME); + client.deleteTable(request); + } + + private static void putRow(SyncClient client, long pk1, long pk2, long def1, long def2, long def3) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromLong(pk1)); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(pk2)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowPutChange rowPutChange = new RowPutChange(TABLE_NAME, primaryKey); + + rowPutChange.addColumn(new Column(DEFINED_COL_NAME_1, ColumnValue.fromLong(def1))); + rowPutChange.addColumn(new Column(DEFINED_COL_NAME_2, ColumnValue.fromLong(def2))); + rowPutChange.addColumn(new Column(DEFINED_COL_NAME_3, ColumnValue.fromLong(def3))); + + client.putRow(new PutRowRequest(rowPutChange)); + } + + + private static void deleteRow(SyncClient client, PrimaryKey pk) { + RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, pk); + + client.deleteRow(new DeleteRowRequest(rowDeleteChange)); + } + + private static void updateRow(SyncClient client, PrimaryKey pk) { + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, pk); + + rowUpdateChange.put(new Column(DEFINED_COL_NAME_1, ColumnValue.fromString("def"))); + + client.updateRow(new UpdateRowRequest(rowUpdateChange)); + } + + private static void getRangeFromMainTable(SyncClient client, long cellNumber) + { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(TABLE_NAME); + + // 构造主键 + PrimaryKeyBuilder startPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromLong(cellNumber)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(0)); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(startPrimaryKeyBuilder.build()); + + // 构造主键 + PrimaryKeyBuilder endPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromLong(cellNumber)); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endPrimaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + String strNum = String.format("%d", cellNumber); + System.out.println("号码" + strNum + "的所有主叫话单:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + + private static void getRangeFromIndexTable(SyncClient client, long cellNumber) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(INDEX0_NAME); + + // 构造主键 + PrimaryKeyBuilder startPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + startPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_1, PrimaryKeyValue.fromLong(cellNumber)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MIN); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(startPrimaryKeyBuilder.build()); + + // 构造主键 + PrimaryKeyBuilder endPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + endPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_1, PrimaryKeyValue.fromLong(cellNumber)); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MAX); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endPrimaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + String strNum = String.format("%d", cellNumber); + System.out.println("号码" + strNum + "的所有被叫话单:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + + private static void getRangeFromIndexTable(SyncClient client, + long baseStationNumber, + long startTime) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(INDEX1_NAME); + + // 构造主键 + PrimaryKeyBuilder startPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + startPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_3, PrimaryKeyValue.fromLong(baseStationNumber)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(startTime)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MIN); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(startPrimaryKeyBuilder.build()); + + // 构造主键 + PrimaryKeyBuilder endPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + endPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_3, PrimaryKeyValue.fromLong(baseStationNumber)); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endPrimaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + String strBaseStationNum = String.format("%d", baseStationNumber); + String strStartTime = String.format("%d", startTime); + System.out.println("基站" + strBaseStationNum + "从时间" + strStartTime + "开始的所有被叫话单:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + + private static void getRowFromIndexAndMainTable(SyncClient client, + long baseStationNumber, + long startTime, + long endTime, + String colName) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(INDEX1_NAME); + + // 构造主键 + PrimaryKeyBuilder startPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + startPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_3, PrimaryKeyValue.fromLong(baseStationNumber)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(startTime)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MIN); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(startPrimaryKeyBuilder.build()); + + // 构造主键 + PrimaryKeyBuilder endPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + endPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_3, PrimaryKeyValue.fromLong(baseStationNumber)); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(endTime)); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endPrimaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + String strBaseStationNum = String.format("%d", baseStationNumber); + String strStartTime = String.format("%d", startTime); + String strEndTime = String.format("%d", endTime); + + System.out.println("基站" + strBaseStationNum + "从时间" + strStartTime + "到" + strEndTime + "的所有话单通话时长:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + PrimaryKey curIndexPrimaryKey = row.getPrimaryKey(); + PrimaryKeyColumn mainCalledNumber = curIndexPrimaryKey.getPrimaryKeyColumn(PRIMARY_KEY_NAME_1); + PrimaryKeyColumn callStartTime = curIndexPrimaryKey.getPrimaryKeyColumn(PRIMARY_KEY_NAME_2); + PrimaryKeyBuilder mainTablePKBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + mainTablePKBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, mainCalledNumber.getValue()); + mainTablePKBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, callStartTime.getValue()); + PrimaryKey mainTablePK = mainTablePKBuilder.build(); // 构造主表PK + + // 反查主表 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, mainTablePK); + criteria.addColumnsToGet(colName); // 读取主表的"通话时长"列 + // 设置读取最新版本 + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row mainTableRow = getRowResponse.getRow(); + + System.out.println(mainTableRow); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + + private static void getRangeFromIndexTable(SyncClient client, + long baseStationNumber, + long startTime, + long endTime, + String colName) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(INDEX2_NAME); + + // 构造主键 + PrimaryKeyBuilder startPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + startPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_3, PrimaryKeyValue.fromLong(baseStationNumber)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(startTime)); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MIN); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(startPrimaryKeyBuilder.build()); + + // 构造主键 + PrimaryKeyBuilder endPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + endPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_3, PrimaryKeyValue.fromLong(baseStationNumber)); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(endTime)); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endPrimaryKeyBuilder.build()); + + // 设置读取列 + rangeRowQueryCriteria.addColumnsToGet(colName); + + rangeRowQueryCriteria.setMaxVersions(1); + + String strBaseStationNum = String.format("%d", baseStationNumber); + String strStartTime = String.format("%d", startTime); + String strEndTime = String.format("%d", endTime); + + + System.out.println("基站" + strBaseStationNum + "从时间" + strStartTime + "到" + strEndTime + "的所有话单通话时长:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } +} diff --git a/src/test/java/examples/ComputeSplitsBySizeSample.java b/src/test/java/examples/ComputeSplitsBySizeSample.java new file mode 100644 index 0000000..e58ce7c --- /dev/null +++ b/src/test/java/examples/ComputeSplitsBySizeSample.java @@ -0,0 +1,166 @@ +package examples; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +import com.alicloud.openservices.tablestore.AsyncClient; +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; + +public class ComputeSplitsBySizeSample { + + private static final String TABLE_NAME = "testtargettable"; + private static final long SPLIT_SIZE_IN_100MB = 1l; + private static final String primaryKeyPrefix = "primarykey_"; + private static final String columnNamePrefix = "columnName_"; + private static final int maxNumberPrimaryKeysEachRow = 4; + private static final int maxNumberColumnsEachRow = 500; + private static final int maxNumberRowsEachWrite = 200; + private static final int defaultCuRead = 0; + private static final int defaultCuWrite = 0; + + public static void main(String[] args) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient syncClient = new SyncClient(endPoint, accessId, accessKey, + instanceName); + AsyncClient asyncClient = new AsyncClient(endPoint, accessId, accessKey, + instanceName); + + try { + // 准备目标表格和测试数据。 + prepareTableAndData(syncClient); + + // 进行同步ComputeSplitsBySize接口操作 + ComputeSplitsBySizeResponse csbsr = syncComputeSplitsBySize(syncClient); + List splits = csbsr.getSplits(); + System.out.println("同步获得split:" + splits.size()); + for (Split s: splits) { + System.out.println(s.jsonize()); + } + getRange(syncClient, + csbsr.getSplits().get(0).getLowerBound(), + csbsr.getSplits().get(0).getUpperBound()); + + // 进行异步ComputeSplitsBySize接口操作 + Future fcsbsrr = asyncComputeSplitsBySize(asyncClient); + ComputeSplitsBySizeResponse csbsrr = fcsbsrr.get(); + splits = csbsrr.getSplits(); + System.out.println("异步获得split:" + splits.size()); + for (Split s: splits) { + System.out.println(s.jsonize()); + } + getRange(syncClient, + csbsrr.getSplits().get(0).getLowerBound(), + csbsrr.getSplits().get(0).getUpperBound()); + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } catch (InterruptedException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } catch (ExecutionException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } finally { + syncClient.shutdown(); + asyncClient.shutdown(); + } + + } + + private static GetRangeResponse getRange(SyncClient client, PrimaryKey lowerBound, PrimaryKey upperBound) { + GetRangeRequest grr = new GetRangeRequest(); + RangeRowQueryCriteria rrqc = new RangeRowQueryCriteria(TABLE_NAME); + rrqc.setDirection(Direction.FORWARD); + rrqc.setInclusiveStartPrimaryKey(lowerBound); + PrimaryKey endPK = upperBound; + if ( endPK.getPrimaryKeyColumns().length <= 1 ) { + List pkcl = new ArrayList(); + pkcl.add(endPK.getPrimaryKeyColumn(0)); + for ( int i = 1; i < maxNumberPrimaryKeysEachRow; ++i ) { + String ss = primaryKeyPrefix + i; + pkcl.add(new PrimaryKeyColumn(ss, PrimaryKeyValue.INF_MIN)); + } + endPK = new PrimaryKey(pkcl); + } + rrqc.setExclusiveEndPrimaryKey(endPK); + rrqc.setMaxVersions(5); + grr.setRangeRowQueryCriteria(rrqc); + return client.getRange(grr); + + } + + private static ComputeSplitsBySizeResponse syncComputeSplitsBySize(SyncClient client) { + ComputeSplitsBySizeRequest csbsr = new ComputeSplitsBySizeRequest(); + csbsr.setTableName(TABLE_NAME); + csbsr.setSplitSizeIn100MB(SPLIT_SIZE_IN_100MB); + return client.computeSplitsBySize(csbsr); + } + + private static Future asyncComputeSplitsBySize(AsyncClient client) { + ComputeSplitsBySizeRequest csbsr = new ComputeSplitsBySizeRequest(); + csbsr.setTableName(TABLE_NAME); + csbsr.setSplitSizeInByte(2, 1048576); + return client.computeSplitsBySize(csbsr, null); + } + + private static void prepareTableAndData(SyncClient client) { + // Testing configuration + String tableName = "testtargettable"; + long maxPutRowTime = 10l * 60l * 1000l; + + // Creating testing data + boolean ifCreateTable = true; + ListTableResponse ltr = client.listTable(); + for ( String tn : ltr.getTableNames() ) { + if ( tn.equals(tableName) ) { + ifCreateTable = false; + } + } + if ( ifCreateTable ) { + TableMeta tm = new TableMeta(tableName); + for (int j = 0; j < maxNumberPrimaryKeysEachRow; ++j) { + tm.addPrimaryKeyColumn(primaryKeyPrefix + j, PrimaryKeyType.STRING); + } + TableOptions to = new TableOptions(86400, 5, 86400); + ReservedThroughput rtp = new ReservedThroughput( new CapacityUnit(defaultCuRead, defaultCuWrite)); + CreateTableRequest ctr = new CreateTableRequest(tm, to, rtp); + client.createTable(ctr); + } + long startTime = System.currentTimeMillis(); + int bn = 0; + while( System.currentTimeMillis() - startTime <= maxPutRowTime ) { + // To insert the testing rows. + BatchWriteRowRequest bwrr = new BatchWriteRowRequest(); + ++bn; + + for (int i = 0; i < maxNumberRowsEachWrite; ++i) { + RowPutChange brpc = new RowPutChange(tableName); + List pkcl = new ArrayList(); + for (int j = 0; j < maxNumberPrimaryKeysEachRow; ++j) { + String ss = primaryKeyPrefix + j; + pkcl.add(new PrimaryKeyColumn(ss, PrimaryKeyValue.fromString(ss + "_" + i + "_" + bn))); + } + PrimaryKey bwpk = new PrimaryKey(pkcl); + brpc.setPrimaryKey(bwpk); + for (int k = 0; k < maxNumberColumnsEachRow; ++k) { + String ss = columnNamePrefix + k; + brpc.addColumn(ss, ColumnValue.fromString(ss)); + } + bwrr.addRowChange(brpc); + } + + client.batchWriteRow(bwrr); + } + + } + +} diff --git a/src/test/java/examples/DataOperationSample.java b/src/test/java/examples/DataOperationSample.java new file mode 100644 index 0000000..7c3bf1b --- /dev/null +++ b/src/test/java/examples/DataOperationSample.java @@ -0,0 +1,416 @@ +package examples; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; +import com.alicloud.openservices.tablestore.model.condition.SingleColumnValueCondition; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; + +import java.util.Iterator; + +public class DataOperationSample { + + /** + * 本示例中建立一张表,名为sampleTable,只含有一个主键, 主键名为pk. + */ + private static final String TABLE_NAME = "sampleTable"; + private static final String PRIMARY_KEY_NAME = "pk"; + + public static void main(String[] args) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient client = new SyncClient(endPoint, accessId, accessKey, + instanceName); + + try { + // 建表 + deleteTable(client); + createTable(client); + + // 等待表load完毕. + try { + Thread.sleep(10 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // putRow + putRow(client, "pkValue"); + + // getRow + getRow(client, "pkValue"); + + // updateRow + updateRow(client, "pkValue"); + + // 使用condition递增一列 + updateRowWithCondition(client, "pkValue"); + + // getRow + getRow(client, "pkValue"); + + // 再写入两行 + putRow(client, "aaa"); + putRow(client, "bbb"); + + increment(client, "pkValue"); + + // getRange + getRange(client, "a", "z"); + + // 使用iterator进行getRange + getRangeByIterator(client, "a", "z"); + + batchWriteRow(client); + + batchGetRow(client); + + getRange(client, "a", "z"); + + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } finally { + // 为了安全,这里不能默认删表,如果需要删表,需用户自己手动打开 + // deleteTable(client); + } + client.shutdown(); + } + + private static void createTable(SyncClient client) { + TableMeta tableMeta = new TableMeta(TABLE_NAME); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME, PrimaryKeyType.STRING)); + + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 假如设置过期时间为一年, 即为 365 * 24 * 3600. + int maxVersions = 1; // 保存的最大版本数, 设置为1即代表每列上最多保存一个版本(保存最新的版本). + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + + client.createTable(request); + } + + private static void deleteTable(SyncClient client) { + DeleteTableRequest request = new DeleteTableRequest(TABLE_NAME); + client.deleteTable(request); + } + + private static void putRow(SyncClient client, String pkValue) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(pkValue)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowPutChange rowPutChange = new RowPutChange(TABLE_NAME, primaryKey); + + //加入一些属性列 + long ts = System.currentTimeMillis(); + rowPutChange.addColumn(new Column("price", ColumnValue.fromLong(5120), ts)); + + client.putRow(new PutRowRequest(rowPutChange)); + } + + private static void updateRow(SyncClient client, String pkValue) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(pkValue)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, primaryKey); + + // 更新一些列 + for (int i = 0; i < 10; i++) { + rowUpdateChange.put(new Column("Col" + i, ColumnValue.fromLong(i))); + } + + // 删除某列的某一版本 + rowUpdateChange.deleteColumn("Col10", 1465373223000L); + + // 删除某一列 + rowUpdateChange.deleteColumns("Col11"); + + client.updateRow(new UpdateRowRequest(rowUpdateChange)); + } + + private static void deleteRow(SyncClient client, String pkValue) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(pkValue)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, primaryKey); + + client.deleteRow(new DeleteRowRequest(rowDeleteChange)); + } + + private static void increment(SyncClient client, String pkValue) { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(pkValue)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, primaryKey); + rowUpdateChange.increment(new Column("price", ColumnValue.fromLong(10000L))); + rowUpdateChange.setReturnType(ReturnType.RT_PK); + + UpdateRowResponse response = client.updateRow(new UpdateRowRequest(rowUpdateChange)); + Row row = response.getRow(); + System.out.println("更新结果(add value = 10000): start"); + System.out.println(row); + System.out.println("更新结果(add value = 10000): end"); + } + + private static void batchWriteRow(SyncClient client) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + // 构造rowPutChange1 + PrimaryKeyBuilder pk1Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk1Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString("pk1")); + RowPutChange rowPutChange1 = new RowPutChange(TABLE_NAME, pk1Builder.build()); + // 添加一些列 + for (int i = 0; i < 10; i++) { + rowPutChange1.addColumn(new Column("Col" + i, ColumnValue.fromLong(i))); + } + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowPutChange1); + + // 构造rowPutChange2 + PrimaryKeyBuilder pk2Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk2Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString("pk2")); + RowPutChange rowPutChange2 = new RowPutChange(TABLE_NAME, pk2Builder.build()); + // 添加一些列 + for (int i = 0; i < 10; i++) { + rowPutChange2.addColumn(new Column("Col" + i, ColumnValue.fromLong(i))); + } + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowPutChange2); + + // 构造rowUpdateChange + PrimaryKeyBuilder pk3Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk3Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString("pk3")); + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, pk3Builder.build()); + // 添加一些列 + for (int i = 0; i < 10; i++) { + rowUpdateChange.put(new Column("Col" + i, ColumnValue.fromLong(i))); + } + // 删除一列 + rowUpdateChange.deleteColumns("Col10"); + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowUpdateChange); + + // 构造rowDeleteChange + PrimaryKeyBuilder pk4Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk4Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString("pk4")); + RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, pk4Builder.build()); + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowDeleteChange); + + // 构造increment + PrimaryKeyBuilder primaryKeyBuilderInc = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilderInc.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString("pkValue")); + PrimaryKey primaryKeyInc = primaryKeyBuilderInc.build(); + RowUpdateChange rowUpdateChangeInc = new RowUpdateChange(TABLE_NAME, primaryKeyInc); + rowUpdateChangeInc.increment(new Column("price", ColumnValue.fromLong(20000L))); + rowUpdateChangeInc.setReturnType(ReturnType.RT_PK); + batchWriteRowRequest.addRowChange(rowUpdateChangeInc); + + BatchWriteRowResponse response = client.batchWriteRow(batchWriteRowRequest); + + System.out.println("是否全部成功:" + response.isAllSucceed()); + if (!response.isAllSucceed()) { + for (BatchWriteRowResponse.RowResult rowResult : response.getFailedRows()) { + System.out.println("失败的行:" + batchWriteRowRequest.getRowChange(rowResult.getTableName(), rowResult.getIndex()).getPrimaryKey()); + System.out.println("失败原因:" + rowResult.getError()); + } + /** + * 可以通过createRequestForRetry方法再构造一个请求对失败的行进行重试.这里只给出构造重试请求的部分. + * 推荐的重试方法是使用SDK的自定义重试策略功能, 支持对batch操作的部分行错误进行重试. 设定重试策略后, 调用接口处即不需要增加重试代码. + */ + BatchWriteRowRequest retryRequest = batchWriteRowRequest.createRequestForRetry(response.getFailedRows()); + } + } + + private static void getRow(SyncClient client, String pkValue) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(pkValue)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row row = getRowResponse.getRow(); + + System.out.println("读取行完毕, 结果为: "); + System.out.println(row); + + // 设置读取某些列 + criteria.addColumnsToGet("Col0"); + getRowResponse = client.getRow(new GetRowRequest(criteria)); + row = getRowResponse.getRow(); + + System.out.println("读取列(col0)完毕, 结果为: "); + System.out.println(row); + } + + private static void getRowWithFilter(SyncClient client, String pkValue) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(pkValue)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, primaryKey); + // 设置读取最新版本 + criteria.setMaxVersions(1); + + // 设置过滤器, 当Col0的值为0时返回该行. + SingleColumnValueFilter singleColumnValueFilter = new SingleColumnValueFilter("Col0", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(0)); + // 如果不存在Col0这一列, 也不返回. + singleColumnValueFilter.setPassIfMissing(false); + // 只判断最新版本 + singleColumnValueFilter.setLatestVersionsOnly(true); + + criteria.setFilter(singleColumnValueFilter); + + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row row = getRowResponse.getRow(); + + System.out.println("读取完毕, 结果为: "); + System.out.println(row); + } + + private static void batchGetRow(SyncClient client) { + MultiRowQueryCriteria multiRowQueryCriteria = new MultiRowQueryCriteria(TABLE_NAME); + // 加入10个要读取的行 + for (int i = 0; i < 10; i++) { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString("pk" + i)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + multiRowQueryCriteria.addRow(primaryKey); + } + // 添加条件 + multiRowQueryCriteria.setMaxVersions(1); + multiRowQueryCriteria.addColumnsToGet("Col0"); + multiRowQueryCriteria.addColumnsToGet("Col1"); + SingleColumnValueFilter singleColumnValueFilter = new SingleColumnValueFilter("Col0", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(0)); + singleColumnValueFilter.setPassIfMissing(false); + multiRowQueryCriteria.setFilter(singleColumnValueFilter); + + BatchGetRowRequest batchGetRowRequest = new BatchGetRowRequest(); + // batchGetRow支持读取多个表的数据, 一个multiRowQueryCriteria对应一个表的查询条件, 可以添加多个multiRowQueryCriteria. + batchGetRowRequest.addMultiRowQueryCriteria(multiRowQueryCriteria); + + BatchGetRowResponse batchGetRowResponse = client.batchGetRow(batchGetRowRequest); + + System.out.println("是否全部成功:" + batchGetRowResponse.isAllSucceed()); + if (!batchGetRowResponse.isAllSucceed()) { + for (BatchGetRowResponse.RowResult rowResult : batchGetRowResponse.getFailedRows()) { + System.out.println("失败的行:" + batchGetRowRequest.getPrimaryKey(rowResult.getTableName(), rowResult.getIndex())); + System.out.println("失败原因:" + rowResult.getError()); + } + + /** + * 可以通过createRequestForRetry方法再构造一个请求对失败的行进行重试.这里只给出构造重试请求的部分. + * 推荐的重试方法是使用SDK的自定义重试策略功能, 支持对batch操作的部分行错误进行重试. 设定重试策略后, 调用接口处即不需要增加重试代码. + */ + BatchGetRowRequest retryRequest = batchGetRowRequest.createRequestForRetry(batchGetRowResponse.getFailedRows()); + } + } + + // 通过Condition实现乐观锁机制, 递增一列. + private static void updateRowWithCondition(SyncClient client, String pkValue) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(pkValue)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, primaryKey); + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row row = getRowResponse.getRow(); + long col0Value = row.getLatestColumn("Col0").getValue().asLong(); + + // 条件更新Col0这一列, 使列值+1 + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, primaryKey); + Condition condition = new Condition(RowExistenceExpectation.EXPECT_EXIST); + ColumnCondition columnCondition = new SingleColumnValueCondition("Col0", SingleColumnValueCondition.CompareOperator.EQUAL, ColumnValue.fromLong(col0Value)); + condition.setColumnCondition(columnCondition); + rowUpdateChange.setCondition(condition); + rowUpdateChange.put(new Column("Col0", ColumnValue.fromLong(col0Value + 1))); + + try { + client.updateRow(new UpdateRowRequest(rowUpdateChange)); + } catch (TableStoreException ex) { + System.out.println(ex.toString()); + } + } + + private static void getRange(SyncClient client, String startPkValue, String endPkValue) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(TABLE_NAME); + + // 设置起始主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(startPkValue)); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKeyBuilder.build()); + + // 设置结束主键 + primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(endPkValue)); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + System.out.println("GetRange的结果为:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + + private static void getRangeByIterator(SyncClient client, String startPkValue, String endPkValue) { + RangeIteratorParameter rangeIteratorParameter = new RangeIteratorParameter(TABLE_NAME); + + // 设置起始主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(startPkValue)); + rangeIteratorParameter.setInclusiveStartPrimaryKey(primaryKeyBuilder.build()); + + // 设置结束主键 + primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME, PrimaryKeyValue.fromString(endPkValue)); + rangeIteratorParameter.setExclusiveEndPrimaryKey(primaryKeyBuilder.build()); + + rangeIteratorParameter.setMaxVersions(1); + + Iterator iterator = client.createRangeIterator(rangeIteratorParameter); + + System.out.println("使用Iterator进行GetRange的结果为:"); + while (iterator.hasNext()) { + Row row = iterator.next(); + System.out.println(row); + } + } + +} diff --git a/src/test/java/examples/GlobalIndexSample.java b/src/test/java/examples/GlobalIndexSample.java new file mode 100644 index 0000000..623d230 --- /dev/null +++ b/src/test/java/examples/GlobalIndexSample.java @@ -0,0 +1,293 @@ +package examples; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; +import com.alicloud.openservices.tablestore.model.condition.SingleColumnValueCondition; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; + +import java.util.ArrayList; +import java.util.Iterator; + +public class GlobalIndexSample { + + /** + * 本示例中建立一张表,名为globalIndexSampleMainTable,两个主键, 主键分别为pk1,pk2. 两个预定义列,分别为col1, col2 + * 另外建立一张索引表,名为globalIndexSampleIndexTable, 索引列为col1, 属性列为col2 + */ + private static final String TABLE_NAME = "globalIndexSampleMainTable"; + private static final String INDEX_NAME = "globalIndexSampleIndexTable"; + private static final String INDEX2_NAME = "globalIndexSampleIndexTable2"; + private static final String PRIMARY_KEY_NAME_1 = "pk1"; + private static final String PRIMARY_KEY_NAME_2 = "pk2"; + private static final String DEFINED_COL_NAME_1 = "col1"; + private static final String DEFINED_COL_NAME_2 = "col2"; + + public static void main(String[] args) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient client = new SyncClient(endPoint, accessId, accessKey, instanceName); + try { + + //deleteTable(client); + // 建表,表中两列PK,pk1, pk2,另外两列预定义列,col1, col2 + // 其中在cok1上建立索引,索引表的属性列为col2 + createTable(client); + + System.out.println("create table succeeded."); + + // 等待表load完毕. + try { + Thread.sleep(10 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // 获取表列表,其中不不包含索引表 + ListTableResponse response = client.listTable(); + System.out.println("All tables:"); + for (String tableName : response.getTableNames()) { + System.out.println(tableName); + } + + // describe主表及索引表 + describeTable(client, TABLE_NAME); + describeTable(client, INDEX_NAME); + + // 向主表中写入一行数据 + PrimaryKey pk = putRow(client); + + // 从主表中读取,验证该数据已经被写入 + getRowFromMainTable(client, pk); + + try { + Thread.sleep(1 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + // 从索引表中读取,验证索引已经被建立 + scanFromIndex(client); + + // 更新刚才中主表中写入的行 + updateRow(client, pk); + + // 单独在主表上创建索引表2,索引表2的PK为col2, pk2, 属性列为空 + createIndex(client); + + // 从索引表中读取,验证主表中的数据更新已经同步到了索引表 + scanFromIndex(client); + + try { + Thread.sleep(1 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // 从索引表2中读取,验证主表中的数据已经同步到了索引表2 + scanFromIndex2(client); + + // 将主表中写入的行删除 + deleteRow(client, pk); + + // 从索引表1中读取,验证索引表中的索引已经被删除 + scanFromIndex(client); + + // 从索引表2中读取,验证索引表中的索引已经被删除 + scanFromIndex2(client); + + // 删除索引表 + deleteIndex(client); + + // 删除主表 + deleteTable(client); + + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } finally { + // 为了安全,这里不能默认删表,如果需要删表,需用户自己手动打开 + // deleteTable(client); + } + client.shutdown(); + } + + private static void createTable(SyncClient client) { + TableMeta tableMeta = new TableMeta(TABLE_NAME); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_1, PrimaryKeyType.STRING)); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_2, PrimaryKeyType.INTEGER)); + tableMeta.addDefinedColumn(new DefinedColumnSchema(DEFINED_COL_NAME_1, DefinedColumnType.STRING)); + tableMeta.addDefinedColumn(new DefinedColumnSchema(DEFINED_COL_NAME_2, DefinedColumnType.INTEGER)); + + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 带索引表的主表数据过期时间必须为-1 + int maxVersions = 1; // 保存的最大版本数, 带索引表的请表最大版本数必须为1 + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + ArrayList indexMetas = new ArrayList(); + IndexMeta indexMeta = new IndexMeta(INDEX_NAME); + indexMeta.addPrimaryKeyColumn(DEFINED_COL_NAME_1); + indexMeta.addDefinedColumn(DEFINED_COL_NAME_2); + indexMetas.add(indexMeta); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions, indexMetas); + + client.createTable(request); + } + + private static void createIndex(SyncClient client) { + IndexMeta indexMeta = new IndexMeta(INDEX2_NAME); + indexMeta.addPrimaryKeyColumn(DEFINED_COL_NAME_2); + indexMeta.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2); + CreateIndexRequest request = new CreateIndexRequest(TABLE_NAME, indexMeta, false); + client.createIndex(request); + } + + private static void describeTable(SyncClient client, String tableName) { + DescribeTableRequest request = new DescribeTableRequest(tableName); + DescribeTableResponse response = client.describeTable(request); + TableMeta tableMeta = response.getTableMeta(); + for (PrimaryKeySchema pk : tableMeta.getPrimaryKeyList()) { + System.out.println(pk.getName()); + System.out.println(pk.getType()); + } + for (DefinedColumnSchema defCol : tableMeta.getDefinedColumnsList()) { + System.out.println(defCol.getName()); + System.out.println(defCol.getType()); + } + } + + private static void deleteIndex(SyncClient client) { + DeleteIndexRequest request = new DeleteIndexRequest(TABLE_NAME, INDEX_NAME); + client.deleteIndex(request); + } + + private static void deleteTable(SyncClient client) { + DeleteTableRequest request = new DeleteTableRequest(TABLE_NAME); + client.deleteTable(request); + } + + private static PrimaryKey putRow(SyncClient client) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("chengdu")); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(123)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowPutChange rowPutChange = new RowPutChange(TABLE_NAME, primaryKey); + + rowPutChange.addColumn(new Column(DEFINED_COL_NAME_1, ColumnValue.fromString("abc"))); + rowPutChange.addColumn(new Column(DEFINED_COL_NAME_2, ColumnValue.fromLong(456))); + + PutRowResponse response = client.putRow(new PutRowRequest(rowPutChange)); + // 打印出消耗的CU + CapacityUnit cu = response.getConsumedCapacity().getCapacityUnit(); + System.out.println("Read CapacityUnit:" + cu.getReadCapacityUnit()); + System.out.println("Write CapacityUnit:" + cu.getWriteCapacityUnit()); + return primaryKey; + } + + + private static void deleteRow(SyncClient client, PrimaryKey pk) { + RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, pk); + + client.deleteRow(new DeleteRowRequest(rowDeleteChange)); + } + + private static void updateRow(SyncClient client, PrimaryKey pk) { + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, pk); + + rowUpdateChange.put(new Column(DEFINED_COL_NAME_1, ColumnValue.fromString("def"))); + + client.updateRow(new UpdateRowRequest(rowUpdateChange)); + } + + private static void getRowFromMainTable(SyncClient client, PrimaryKey pk) + { + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, pk); + criteria.setMaxVersions(1); + + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row row = getRowResponse.getRow(); + + System.out.println("读取主表完毕, 结果为: "); + System.out.println(row); + } + private static void scanFromIndex(SyncClient client) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(INDEX_NAME); + + // 设置起始主键 + PrimaryKeyBuilder startPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + startPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_1, PrimaryKeyValue.INF_MIN); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MIN); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MIN); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(startPrimaryKeyBuilder.build()); + + // 设置结束主键 + PrimaryKeyBuilder endPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + endPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_1, PrimaryKeyValue.INF_MAX); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MAX); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endPrimaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + System.out.println("扫描索引表1的结果为:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + + private static void scanFromIndex2(SyncClient client) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(INDEX2_NAME); + + // 设置起始主键 + PrimaryKeyBuilder startPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + startPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_2, PrimaryKeyValue.INF_MIN); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MIN); + startPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MIN); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(startPrimaryKeyBuilder.build()); + + // 设置结束主键 + PrimaryKeyBuilder endPrimaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + endPrimaryKeyBuilder.addPrimaryKeyColumn(DEFINED_COL_NAME_2, PrimaryKeyValue.INF_MAX); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + endPrimaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(endPrimaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + System.out.println("扫描索引表2的结果为:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } +} diff --git a/src/test/java/examples/GlobalUniqueID.java b/src/test/java/examples/GlobalUniqueID.java new file mode 100644 index 0000000..afcda17 --- /dev/null +++ b/src/test/java/examples/GlobalUniqueID.java @@ -0,0 +1,110 @@ +package examples; + +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; + +/** + * GlobalUniqueID: [bucket id] + [auto increment id] + * Table Schema: BUCKET_ID[INTEGER], ID[AUTO_INCREMENT] + * + * This class is thread safe. + */ +public class GlobalUniqueID { + private SyncClient client; + private String tableName; + final private long BUCKET_COUNT = 4096; // max 12 bits + final private long MAX_SUB_ID = 1L << 52; // 52 bits + final private String PK_0 = "b"; + final private String PK_1 = "i"; + final private String COL_0 = "_t"; + + public GlobalUniqueID(SyncClient client, String tableName) { + this.client = client; + this.tableName = tableName; + } + + public boolean isTableExist() { + DescribeTableRequest request = new DescribeTableRequest(); + request.setTableName(tableName); + + DescribeTableResponse response; + try { + response = client.describeTable(request); + } catch(TableStoreException e) { + if (e.getErrorCode().equals("OTSObjectNotExist")) { + return false; + } + throw e; + } + + // check meta + TableMeta tableMeta = response.getTableMeta(); + boolean metaCheckOK = true; + if (tableMeta.getPrimaryKeyList().size() == 2) { + PrimaryKeySchema pk0 = tableMeta.getPrimaryKeyList().get(0); + if (!pk0.getName().equals(PK_0) || pk0.getType() != PrimaryKeyType.INTEGER) { + metaCheckOK = false; + } + + PrimaryKeySchema pk1 = tableMeta.getPrimaryKeyList().get(1); + if (!pk1.getName().equals(PK_1) || pk1.getType() != PrimaryKeyType.INTEGER || pk1.getOption() != PrimaryKeyOption.AUTO_INCREMENT) { + metaCheckOK = false; + } + } else { + metaCheckOK = false; + } + + if (!metaCheckOK) { + throw new IllegalStateException("Table schema is invalid."); + } + + return true; + } + + public long generateUniqueID(Object obj) { + return generateUniqueID(obj.hashCode()); + } + + public long generateUniqueID(int hashCode) { + long bucketID = Math.abs(hashCode) % BUCKET_COUNT; + + RowPutChange rpc = new RowPutChange(tableName); + PrimaryKey primaryKey = PrimaryKeyBuilder.createPrimaryKeyBuilder().addPrimaryKeyColumn(PK_0, PrimaryKeyValue.fromLong(bucketID)) + .addPrimaryKeyColumn(PK_1, PrimaryKeyValue.AUTO_INCREMENT).build(); + rpc.setPrimaryKey(primaryKey); + rpc.addColumn(COL_0, ColumnValue.fromLong(System.currentTimeMillis())); + rpc.setReturnType(ReturnType.RT_PK); + + PutRowResponse response = client.putRow(new PutRowRequest(rpc)); + long subId = response.getRow().getPrimaryKey().getPrimaryKeyColumn(1).getValue().asLong(); + if (subId >= MAX_SUB_ID) { + throw new IllegalStateException("Auto increment id reach maximum: " + subId); + } + + System.out.println(bucketID); + System.out.println(subId); + long uniqueID = (bucketID << 52) | (subId & 0x000fffffffffffffL); + return uniqueID; + } + + public void createTable() { + TableMeta tableMeta = new TableMeta(tableName); + tableMeta.addPrimaryKeyColumn(PK_0, PrimaryKeyType.INTEGER); + tableMeta.addAutoIncrementPrimaryKeyColumn(PK_1); + + TableOptions tableOptions = new TableOptions(); + tableOptions.setTimeToLive(-1); + tableOptions.setMaxVersions(1); + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + client.createTable(request); + } + + public static void main(String[] args) { + SyncClient client = new SyncClient("", "", "", ""); + GlobalUniqueID gui = new GlobalUniqueID(client, "GUI"); + long uniqueID = gui.generateUniqueID(1029182172121L); + System.out.println(uniqueID); + client.shutdown(); + } +} diff --git a/src/test/java/examples/LocalTransactionSample.java b/src/test/java/examples/LocalTransactionSample.java new file mode 100644 index 0000000..3e8ddc3 --- /dev/null +++ b/src/test/java/examples/LocalTransactionSample.java @@ -0,0 +1,99 @@ +package examples; + + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.core.protocol.OtsInternalApi; +import com.alicloud.openservices.tablestore.model.*; + +public class LocalTransactionSample { + /** + * 本示例中建立一张表,名为sampleTable,两个主键, 主键分别为pk1,pk2. + */ + private static final String TABLE_NAME = "LocalTransactionSample"; + private static final String PRIMARY_KEY_NAME_1 = "pk1"; + private static final String PRIMARY_KEY_NAME_2 = "pk2"; + + public static void main(String[] args) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient client = new SyncClient(endPoint, accessId, accessKey, + instanceName); + + try { + // 建表 + createTable(client); + + System.out.println("create table succeeded."); + + // 等待表load完毕. + try { + Thread.sleep(10 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + String txnId = startTxn(client); + + putRow(txnId, client); + + // commit txn + client.commitTransaction(new CommitTransactionRequest(txnId)); + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } finally { + // 为了安全,这里不能默认删表,如果需要删表,需用户自己手动打开 + // deleteTable(client); + } + client.shutdown(); + } + + private static void createTable(SyncClient client) { + TableMeta tableMeta = new TableMeta(TABLE_NAME); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_1, PrimaryKeyType.STRING)); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_2, PrimaryKeyType.INTEGER)); + + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 假如设置过期时间为一年, 即为 365 * 24 * 3600. + int maxVersions = 1; // 保存的最大版本数, 设置为1即代表每列上最多保存一个版本(保存最新的版本). + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + + client.createTable(request); + } + + private static String startTxn(SyncClient client) { + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("chengdu")); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + StartLocalTransactionRequest request = new StartLocalTransactionRequest(TABLE_NAME, primaryKey); + StartLocalTransactionResponse response = client.startLocalTransaction(request); + return response.getTransactionID(); + } + + private static void putRow(String txnId, SyncClient client) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("chengdu")); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(10000)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowPutChange rowPutChange = new RowPutChange(TABLE_NAME, primaryKey); + + //加入一些属性列 + rowPutChange.addColumn(new Column("Col", ColumnValue.fromLong(1099))); + + PutRowRequest request = new PutRowRequest(rowPutChange); + request.setTransactionId(txnId); + client.putRow(request); + } +} diff --git a/src/test/java/examples/OTSConditionalUpdateSample.java b/src/test/java/examples/OTSConditionalUpdateSample.java deleted file mode 100755 index 77d7532..0000000 --- a/src/test/java/examples/OTSConditionalUpdateSample.java +++ /dev/null @@ -1,230 +0,0 @@ -package examples; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.OTSErrorCode; -import com.aliyun.openservices.ots.ServiceException; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.condition.ColumnCondition; -import com.aliyun.openservices.ots.model.condition.CompositeCondition; -import com.aliyun.openservices.ots.model.condition.RelationalCondition; - -/** - * 该示例代码包含了如何使用OTS的Conditional update功能 - */ -public class OTSConditionalUpdateSample { - - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - private static final String COLUMN_NAME_NAME = "name"; - private static final String COLUMN_ADDRESS_NAME = "address"; - private static final String COLUMN_AGE_NAME = "age"; - private static final String COLUMN_MOBILE_NAME = "mobile"; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = "xxxx"; - final String accessKey = "yyyy"; - final String instanceName = "zzzz"; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, instanceName); - final String tableName = "ConditionalUpdateSampleTable"; - - try{ - // 创建表 - createTable(client, tableName); - - // 注意:创建表只是提交请求,OTS创建表需要一段时间。 - // 这里简单地等待10秒,请根据您的实际逻辑修改。 - Thread.sleep(10 * 1000); - - // 插入一条数据。 - putRow(client, tableName); - // 再取回来看看。 - getRow(client, tableName); - // 改一下这条数据。 - - // 设置update condition为:年龄小于20岁 - ColumnCondition cond = new RelationalCondition( - COLUMN_AGE_NAME, RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(20)); - // 这时update应该失败 - updateRow(client, tableName, cond); - getRow(client, tableName); - - // 设置update condition为:年龄大于等于20 并且 地址是中国A地 - cond = new CompositeCondition(CompositeCondition.LogicOperator.AND) - .addCondition(new RelationalCondition( - COLUMN_AGE_NAME, RelationalCondition.CompareOperator.GREATER_EQUAL, - ColumnValue.fromLong(20))) - .addCondition(new RelationalCondition( - COLUMN_ADDRESS_NAME, RelationalCondition.CompareOperator.EQUAL, - ColumnValue.fromString("中国A地"))); - // 这时update应该成功 - updateRow(client, tableName, cond); - getRow(client, tableName); - - // 删除这条数据。 - deleteRow(client, tableName); - - } catch(ServiceException e) { - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())){ - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch(ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } finally{ - // 不留垃圾。 - try { - deleteTable(client, tableName); - } catch (ServiceException e) { - System.err.println("删除表格失败,原因:" + e.getMessage()); - e.printStackTrace(); - } catch (ClientException e) { - System.err.println("删除表格请求失败,原因:" + e.getMessage()); - e.printStackTrace(); - } - client.shutdown(); - } - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void putRow(OTSClient client, String tableName) - throws ServiceException, ClientException{ - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - rowChange.setPrimaryKey(primaryKey); - rowChange.addAttributeColumn(COLUMN_NAME_NAME, ColumnValue.fromString("张三")); - rowChange.addAttributeColumn(COLUMN_MOBILE_NAME, ColumnValue.fromString("111111111")); - rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME, ColumnValue.fromString("中国A地")); - rowChange.addAttributeColumn(COLUMN_AGE_NAME, ColumnValue.fromLong(20)); - rowChange.setCondition(new Condition(RowExistenceExpectation.EXPECT_NOT_EXIST)); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - - PutRowResult result = client.putRow(request); - int consumedWriteCU = result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(); - - System.out.println("成功插入数据, 消耗的写CapacityUnit为:" + consumedWriteCU); - } - - private static void getRow(OTSClient client, String tableName) - throws ServiceException, ClientException{ - - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - criteria.setPrimaryKey(primaryKeys); - criteria.addColumnsToGet(new String[] { - COLUMN_NAME_NAME, - COLUMN_ADDRESS_NAME, - COLUMN_AGE_NAME - }); - - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - GetRowResult result = client.getRow(request); - Row row = result.getRow(); - - int consumedReadCU = result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(); - System.out.println("本次读操作消耗的读CapacityUnti为:" + consumedReadCU); - System.out.println("name信息:" + row.getColumns().get(COLUMN_NAME_NAME)); - System.out.println("address信息:" + row.getColumns().get(COLUMN_ADDRESS_NAME)); - System.out.println("age信息:" + row.getColumns().get(COLUMN_AGE_NAME)); - } - - private static boolean updateRow(OTSClient client, String tableName, ColumnCondition cond) { - try { - RowUpdateChange rowChange = new RowUpdateChange(tableName); - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - rowChange.setPrimaryKey(primaryKeys); - // 更新以下三列的值 - rowChange.addAttributeColumn(COLUMN_NAME_NAME, ColumnValue.fromString("张三")); - rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME, ColumnValue.fromString("中国B地")); - // 删除mobile和age信息 - rowChange.deleteAttributeColumn(COLUMN_MOBILE_NAME); - rowChange.deleteAttributeColumn(COLUMN_AGE_NAME); - - // 设置update condition为"年龄小于25" - Condition condition = new Condition(RowExistenceExpectation.IGNORE); - condition.setColumnCondition(cond); - rowChange.setCondition(condition); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - - UpdateRowResult result = client.updateRow(request); - int consumedWriteCU = result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(); - System.out.println("成功更新数据, 消耗的写CapacityUnit为:" + consumedWriteCU); - - return true; - } catch(ServiceException e) { - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())){ - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch(ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } - - return false; - } - - private static void deleteRow(OTSClient client, String tableName) - throws ServiceException, ClientException{ - RowDeleteChange rowChange = new RowDeleteChange(tableName); - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - rowChange.setPrimaryKey(primaryKeys); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - DeleteRowResult result = client.deleteRow(request); - int consumedWriteCU = result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(); - - System.out.println("成功删除数据, 消耗的写CapacityUnit为:" + consumedWriteCU); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } -} diff --git a/src/test/java/examples/OTSFilterSample.java b/src/test/java/examples/OTSFilterSample.java deleted file mode 100755 index 0704802..0000000 --- a/src/test/java/examples/OTSFilterSample.java +++ /dev/null @@ -1,188 +0,0 @@ -package examples; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.OTSErrorCode; -import com.aliyun.openservices.ots.ServiceException; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.model.condition.ColumnCondition; -import com.aliyun.openservices.ots.model.condition.CompositeCondition; -import com.aliyun.openservices.ots.model.condition.RelationalCondition; - -import java.util.Iterator; -import java.util.Random; - -/** - * 该示例代码包含了如何使用OTS的filter功能 - */ -public class OTSFilterSample { - - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - private static final String COLUMN_NAME_NAME = "name"; - private static final String COLUMN_ADDRESS_NAME = "address"; - private static final String COLUMN_AGE_NAME = "age"; - private static final String COLUMN_IS_STUDENT_NAME = "isstudent"; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = ""; - final String accessKey = ""; - final String instanceName = ""; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, instanceName); - final String tableName = "FilterSampleTable"; - - try{ - // 创建表 - createTable(client, tableName); - - // 注意:创建表只是提交请求,OTS创建表需要一段时间。 - // 这里简单地等待5秒,请根据您的实际逻辑修改。 - Thread.sleep(5 * 1000); - - // 构造一些数据供查询测试 - generateData(client, tableName); - - getRowWithFilter(client, tableName); - - getRangeWithFilter(client, tableName); - } catch(ServiceException e) { - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())){ - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch(ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } finally{ - // 不留垃圾。 - try { - deleteTable(client, tableName); - } catch (ServiceException e) { - System.err.println("删除表格失败,原因:" + e.getMessage()); - e.printStackTrace(); - } catch (ClientException e) { - System.err.println("删除表格请求失败,原因:" + e.getMessage()); - e.printStackTrace(); - } - client.shutdown(); - } - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void generateData(OTSClient client, String tableName) - throws ServiceException, ClientException{ - for (int i = 0; i < 100; i++) { - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(i)); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(i + 1)); - rowChange.setPrimaryKey(primaryKey); - rowChange.addAttributeColumn(COLUMN_NAME_NAME, ColumnValue.fromString("lilei")); - rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME, ColumnValue.fromString("somewhere")); - rowChange.addAttributeColumn(COLUMN_AGE_NAME, ColumnValue.fromLong(new Random().nextInt(30) + 10)); - rowChange.addAttributeColumn(COLUMN_IS_STUDENT_NAME, ColumnValue.fromBoolean(i % 2 == 0)); - rowChange.setCondition(new Condition(RowExistenceExpectation.EXPECT_NOT_EXIST)); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - - client.putRow(request); - } - } - - private static void getRowWithFilter(OTSClient client, String tableName) - throws ServiceException, ClientException{ - - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(2)); - criteria.setPrimaryKey(primaryKeys); - - // 增加一个查询条件,只有当满足条件 name == 'lilei' 时才返回数据。 - RelationalCondition filter = new RelationalCondition(COLUMN_NAME_NAME, RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromString("lilei")); - criteria.setFilter(filter); - - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - GetRowResult result = client.getRow(request); - Row row = result.getRow(); - System.out.println("Row returned (name == 'lilei'): " + row.getColumns()); - - // 更改查询条件,只有当满足条件(name == 'lilei' and isstudent == true)时才返回数据。 - RelationalCondition anotherFilter = new RelationalCondition(COLUMN_IS_STUDENT_NAME, RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(true)); - CompositeCondition cc = new CompositeCondition(CompositeCondition.LogicOperator.AND); - cc.addCondition(filter); - cc.addCondition(anotherFilter); - - criteria.setFilter(cc); - // 而目前表中的该行数据不满足该条件,所以不会返回。 - result = client.getRow(request); - row = result.getRow(); - System.out.println("Row returned (name == 'lilei' and isstudent == true): " + row.getColumns()); - } - - private static void getRangeWithFilter(OTSClient client, String tableName) - throws ServiceException, ClientException { - // 查询范围为: - // start primary key = (gid=0, INF_MIN) - // end primary key = (gid=100, INF_MAX) - // 且满足条件为: - // isstudent == true - // 的所有行。 - RangeIteratorParameter param = new RangeIteratorParameter(tableName); - RowPrimaryKey startPk = new RowPrimaryKey(); - startPk.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(0)); - startPk.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MIN); - RowPrimaryKey endPk = new RowPrimaryKey(); - endPk.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(100)); - endPk.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MAX); - - param.setInclusiveStartPrimaryKey(startPk); - param.setExclusiveEndPrimaryKey(endPk); - - RelationalCondition filter = new RelationalCondition(COLUMN_IS_STUDENT_NAME, RelationalCondition.CompareOperator.EQUAL, ColumnValue.fromBoolean(true)); - param.setFilter(filter); - - Iterator rowIter = client.createRangeIterator(param); - int totalRows = 0; - while (rowIter.hasNext()) { - Row row = rowIter.next(); - totalRows++; - System.out.println(row); - } - - System.out.println("Total rows read: " + totalRows); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } -} diff --git a/src/test/java/examples/OTSMultiDataSample.java b/src/test/java/examples/OTSMultiDataSample.java deleted file mode 100755 index d72ed43..0000000 --- a/src/test/java/examples/OTSMultiDataSample.java +++ /dev/null @@ -1,265 +0,0 @@ -package examples; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.ServiceException; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.OTSErrorCode; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.model.*; - -public class OTSMultiDataSample { - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - private static final String COLUMN_NAME_NAME = "name"; - private static final String COLUMN_ADDRESS_NAME = "address"; - private static final String COLUMN_AGE_NAME = "age"; - private static final String COLUMN_MOBILE_NAME = "mobile"; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = ""; - final String accessKey = ""; - final String instanceName = ""; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, - instanceName); - final String tableName = "sampleTable"; - - try { - // 创建表 - createTable(client, tableName); - - // 注意:创建表只是提交请求,OTS创建表需要一段时间。 - // 这里简单地等待30秒,请根据您的实际逻辑修改。 - Thread.sleep(30000); - - // 插入多行数据。 - putRows(client, tableName); - - // 再取回来看看。 - getRange(client, tableName); - - // 迭代读取 - getByIterator(client, tableName); - - // 统计行数 - countRows(client, tableName); - } catch (ServiceException e) { - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())) { - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch (ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } finally { - // 不留垃圾。 - try { - deleteTable(client, tableName); - } catch (ServiceException e) { - System.err.println("删除表格失败,原因:" + e.getMessage()); - e.printStackTrace(); - } catch (ClientException e) { - System.err.println("删除表格请求失败,原因:" + e.getMessage()); - e.printStackTrace(); - } - client.shutdown(); - } - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } - - private static void putRows(OTSClient client, String tableName) - throws OTSException, ClientException { - int bid = 1; - final int rowCount = 5; - for (int i = 0; i < rowCount; ++i) { - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(bid)); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.fromLong(i)); - rowChange.setPrimaryKey(primaryKey); - rowChange.addAttributeColumn(COLUMN_NAME_NAME, - ColumnValue.fromString("小" + Integer.toString(i))); - rowChange.addAttributeColumn(COLUMN_MOBILE_NAME, - ColumnValue.fromString("111111111")); - rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME, - ColumnValue.fromString("中国A地")); - rowChange.addAttributeColumn(COLUMN_AGE_NAME, - ColumnValue.fromLong(20)); - rowChange.setCondition(new Condition( - RowExistenceExpectation.EXPECT_NOT_EXIST)); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - - PutRowResult result = client.putRow(request); - int consumedWriteCU = result.getConsumedCapacity() - .getCapacityUnit().getWriteCapacityUnit(); - - System.out.println("成功插入数据, 消耗的写CU为:" + consumedWriteCU); - } - - System.out.println(String.format("成功插入%d行数据。", rowCount)); - } - - private static void getRange(OTSClient client, String tableName) - throws OTSException, ClientException { - // 演示一下如何按主键范围查找,这里查找uid从1-4(左开右闭)的数据 - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - RowPrimaryKey inclusiveStartKey = new RowPrimaryKey(); - inclusiveStartKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(1)); - inclusiveStartKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.fromLong(1)); // 范围的边界需要提供完整的PK,若查询的范围不涉及到某一列值的范围,则需要将该列设置为无穷大或者无穷小 - - RowPrimaryKey exclusiveEndKey = new RowPrimaryKey(); - exclusiveEndKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(1)); - exclusiveEndKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.fromLong(4)); // 范围的边界需要提供完整的PK,若查询的范围不涉及到某一列值的范围,则需要将该列设置为无穷大或者无穷小 - - GetRangeRequest request = new GetRangeRequest(); - int consumedReadCU = 0; - List rows = new ArrayList(); - - // 对表进行范围查询时,TableStore对一次查询返回的数据量会有限制,可能无法返回用户指定的范围内的所有数据。 - // TableStore的getRange接口返回的结果中会包含一个nextStartPrimaryKey,即当前已经扫描到的主键的断点。若 - // 需要继续在这个范围内读取还未返回的数据,需要拿这个nextStartPrimaryKey作为下一次查询的起始主键,继续下 - // 一次查询,直到查询返回的nextStartPrimaryKey为空为止。 - // 比如:用户想查询10条数据,通过调用一次GetRange,用户可能得到1条,5条,或者10条等,单次返回的结果是不确定 - // 的,要保证获取完整的数据,就需要使用到nextStartPrimaryKey,下面的例子展示了nextStartPrimaryKey的使用方式。 - - RowPrimaryKey next = inclusiveStartKey; - do { - criteria.setInclusiveStartPrimaryKey(next); - criteria.setExclusiveEndPrimaryKey(exclusiveEndKey); - request.setRangeRowQueryCriteria(criteria); - GetRangeResult result = client.getRange(request); - rows.addAll(result.getRows()); - next = result.getNextStartPrimaryKey(); - consumedReadCU += result.getConsumedCapacity().getCapacityUnit() - .getReadCapacityUnit(); - } while (next != null); - - System.out.println("GetRange result:"); - for (Row row : rows) { - System.out.println("name信息为:" - + row.getColumns().get(COLUMN_NAME_NAME)); - System.out.println("address信息为:" - + row.getColumns().get(COLUMN_ADDRESS_NAME)); - System.out.println("mobile信息为:" - + row.getColumns().get(COLUMN_MOBILE_NAME)); - System.out - .println("age信息为:" + row.getColumns().get(COLUMN_AGE_NAME)); - } - System.out.println("本次读操作消耗的读CapacityUnit为:" + consumedReadCU); - } - - private static void getByIterator(OTSClient client, String tableName) - throws OTSException, ClientException { - // 构造迭代读取的起始位置 - RowPrimaryKey inclusiveStartKey = new RowPrimaryKey(); - inclusiveStartKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(1)); - inclusiveStartKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.INF_MIN); - - // 构造迭代读取的结束位置 - RowPrimaryKey exclusiveEndKey = new RowPrimaryKey(); - exclusiveEndKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(4)); - exclusiveEndKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.INF_MAX); - - // 构造迭代读取的参数对象,并设置起始和结束的位置,包括起始位置的行,不包括结束位置的行 - RangeIteratorParameter rangeIteratorParameter = new RangeIteratorParameter(tableName); - rangeIteratorParameter.setInclusiveStartPrimaryKey(inclusiveStartKey); - rangeIteratorParameter.setExclusiveEndPrimaryKey(exclusiveEndKey); - - // 创建出迭代器,并迭代获取每一行数据 - try { - Iterator iterator = client.createRangeIterator(rangeIteratorParameter); - while (iterator.hasNext()) { - Row row = iterator.next(); - System.out.println("name:" + row.getColumns().get(COLUMN_NAME_NAME)); - System.out.println("address" + row.getColumns().get(COLUMN_ADDRESS_NAME)); - } - System.out.println("Iterator get succeeded."); - } catch (ClientException ex) { - System.out.println("Iterator get failed."); - } catch (OTSException ex) { - System.out.println("Iterator get failed."); - } - } - - private static void countRows(OTSClient client, String tableName) - throws OTSException, ClientException { - // 构造迭代读取的起始位置 - RowPrimaryKey inclusiveStartKey = new RowPrimaryKey(); - inclusiveStartKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(1)); - inclusiveStartKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.INF_MIN); - - // 构造迭代读取的结束位置 - RowPrimaryKey exclusiveEndKey = new RowPrimaryKey(); - exclusiveEndKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(4)); - exclusiveEndKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.INF_MAX); - - // 构造迭代读取的参数对象,并设置起始和结束的位置,包括起始位置的行,不包括结束位置的行 - RangeIteratorParameter rangeIteratorParameter = new RangeIteratorParameter(tableName); - rangeIteratorParameter.setInclusiveStartPrimaryKey(inclusiveStartKey); - rangeIteratorParameter.setExclusiveEndPrimaryKey(exclusiveEndKey); - - List columnsToGet = new ArrayList(); - columnsToGet.add(COLUMN_GID_NAME); // 由于我们只统计行数,为了避免读出过多的数据,这里选择只返回主键列中的一列。 - rangeIteratorParameter.setColumnsToGet(columnsToGet); - - int totalRowsCount = 0; - Iterator iter = client.createRangeIterator(rangeIteratorParameter); - while (iter.hasNext()) { - totalRowsCount++; - iter.next(); - } - - System.out.println("Rows count in range is: " + totalRowsCount); - } -} diff --git a/src/test/java/examples/OTSMultiTableOperationSample.java b/src/test/java/examples/OTSMultiTableOperationSample.java deleted file mode 100755 index 38b8709..0000000 --- a/src/test/java/examples/OTSMultiTableOperationSample.java +++ /dev/null @@ -1,275 +0,0 @@ -package examples; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.ServiceException; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.OTSErrorCode; -import com.aliyun.openservices.ots.OTSException; -import com.aliyun.openservices.ots.model.BatchGetRowRequest; -import com.aliyun.openservices.ots.model.BatchGetRowResult; -import com.aliyun.openservices.ots.model.BatchWriteRowRequest; -import com.aliyun.openservices.ots.model.BatchWriteRowResult; -import com.aliyun.openservices.ots.model.BatchWriteRowResult.RowStatus; -import com.aliyun.openservices.ots.model.CapacityUnit; -import com.aliyun.openservices.ots.model.ColumnValue; -import com.aliyun.openservices.ots.model.CreateTableRequest; -import com.aliyun.openservices.ots.model.DeleteTableRequest; -import com.aliyun.openservices.ots.model.MultiRowQueryCriteria; -import com.aliyun.openservices.ots.model.PrimaryKeyType; -import com.aliyun.openservices.ots.model.PrimaryKeyValue; -import com.aliyun.openservices.ots.model.Row; -import com.aliyun.openservices.ots.model.RowPrimaryKey; -import com.aliyun.openservices.ots.model.RowPutChange; -import com.aliyun.openservices.ots.model.TableMeta; - -public class OTSMultiTableOperationSample { - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - private static final String COLUMN_NAME_NAME = "name"; - private static final String COLUMN_ADDRESS_NAME = "address"; - private static final String tableNamePrefix = "sampleTable_"; - private static final int TABLE_COUNT = 5; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = "xxxx"; - final String accessKey = "yyyy"; - final String instanceName = "zzzz"; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, - instanceName); - - try { - // 创建表 - for (int i = 0; i < TABLE_COUNT; i++) { - createTable(client, tableNamePrefix + i); - } - - // 注意:创建表只是提交请求,OTS创建表需要一段时间。 - // 这里简单地等待30秒,请根据您的实际逻辑修改。 - Thread.sleep(30000); - - // 向多个表插入多行数据 - batchWriteRow(client); - // 从多个表读取多行数据 - batchGetRow(client); - } catch (ServiceException e) { - e.printStackTrace(); - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())) { - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch (ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } finally { - // 不留垃圾。 - try { - for (int i = 0; i < TABLE_COUNT; i++) { - deleteTable(client, tableNamePrefix + i); - } - } catch (ServiceException e) { - System.err.println("删除表格失败,原因:" + e.getMessage()); - e.printStackTrace(); - } catch (ClientException e) { - System.err.println("删除表格请求失败,原因:" + e.getMessage()); - e.printStackTrace(); - } - client.shutdown(); - } - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.STRING); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } - - private static void batchWriteRow(OTSClient client) throws OTSException, - ClientException { - System.out.println("\n############# 开始BatchWriteRow操作 #############"); - BatchWriteRowRequest request = new BatchWriteRowRequest(); - // 向TABLE_COUNT张表中插入数据, 每张表插入10行。 - for (int i = 0; i < TABLE_COUNT; ++i) { - for (int j = 0; j < 10; ++j) { - - RowPutChange rowPutChange = new RowPutChange(tableNamePrefix - + i); - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.fromLong(1)); - primaryKey.addPrimaryKeyColumn( - COLUMN_GID_NAME, - PrimaryKeyValue.fromString(String.format("%03d", j))); - rowPutChange.setPrimaryKey(primaryKey); - - rowPutChange.addAttributeColumn(COLUMN_ADDRESS_NAME, - ColumnValue.fromString("中国某地")); - rowPutChange.addAttributeColumn(COLUMN_NAME_NAME, - ColumnValue.fromString("张三" + j)); - request.addRowPutChange(rowPutChange); - } - } - // batchWriteRow接口会返回一个结果集, 结果集中包含的结果个数与插入的行数相同。 结果集中的结果不一定都是成功, - // 用户需要自己对不成功的操作进行重试。 - BatchWriteRowResult result = client.batchWriteRow(request); - BatchWriteRowRequest failedOperations = null; - int succeedCount = 0; - - int retryCount = 0; - do { - Map> status = result.getPutRowStatus(); - failedOperations = new BatchWriteRowRequest(); - for (Entry> entry : status.entrySet()) { - String tableName = entry.getKey(); - List statuses = entry.getValue(); - for (int index = 0; index < statuses.size(); index++) { - RowStatus rowStatus = statuses.get(index); - if (!rowStatus.isSucceed()) { - // 操作失败, 需要放到重试列表中再次重试 - // 需要重试的操作可以从request中获取参数 - failedOperations.addRowPutChange(request - .getRowPutChange(tableName, index)); - } else { - succeedCount++; - System.out.println("本次操作消耗的写CapacityUnit为:" + rowStatus.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit()); - } - } - } - - if (failedOperations.isEmpty() || ++retryCount > 3) { - break; // 如果所有操作都成功了或者重试次数达到上线, 则不再需要重试。 - } - - // 如果有需要重试的操作, 则稍微等待一会后再次重试, 否则继续出错的概率很高。 - try { - Thread.sleep(100); // 100ms后继续重试 - } catch (InterruptedException e) { - e.printStackTrace(); - } - - request = failedOperations; - result = client.batchWriteRow(request); - } while (true); - - System.out.println(String.format("成功插入%d行数据。", succeedCount)); - } - - private static void batchGetRow(OTSClient client) throws OTSException, - ClientException { - // 从每张表中查询插入的10行数据, 由于一个BatchGetRow最多接受10行数据,所以每张表分开查 - for (int i = 0; i < TABLE_COUNT; ++i) { - batchGetRow(client, tableNamePrefix + i); - } - } - - private static void batchGetRow(OTSClient client, String tableName) - throws OTSException, ClientException { - System.out.println("\n############# 开始BatchGetRow操作 #############"); - BatchGetRowRequest request = new BatchGetRowRequest(); - // 从每张表中查询插入的10行数据, 由于一个BatchGetRow最多接受10行数据,所以每张表分开查 - MultiRowQueryCriteria tableRows = new MultiRowQueryCriteria(tableName); - for (int j = 0; j < 10; ++j) { - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn( - COLUMN_GID_NAME, - PrimaryKeyValue.fromString(String.format("%03d", j))); - - tableRows.addRow(primaryKeys); - } - tableRows.addColumnsToGet(new String[] { COLUMN_NAME_NAME, - COLUMN_GID_NAME, COLUMN_UID_NAME, COLUMN_ADDRESS_NAME }); - request.addMultiRowQueryCriteria(tableRows); - - BatchGetRowResult result = client.batchGetRow(request); - BatchGetRowRequest failedOperations = null; - - List succeedRows = new ArrayList(); - - int retryCount = 0; - do { - failedOperations = new BatchGetRowRequest(); - - Map> status = result - .getTableToRowsStatus(); - for (Entry> entry : status - .entrySet()) { - tableName = entry.getKey(); - tableRows = new MultiRowQueryCriteria(tableName); - List statuses = entry - .getValue(); - for (int index = 0; index < statuses.size(); index++) { - com.aliyun.openservices.ots.model.BatchGetRowResult.RowStatus rowStatus = statuses - .get(index); - if (!rowStatus.isSucceed()) { - // 操作失败, 需要放到重试列表中再次重试 - // 需要重试的操作可以从request中获取参数 - tableRows.addRow(request - .getPrimaryKey(tableName, index)); - } else { - succeedRows.add(rowStatus.getRow()); - System.out.println("成功读取一行数据:"); - System.out.println("uid信息为:" + rowStatus.getRow().getColumns().get(COLUMN_UID_NAME)); - System.out.println("gid信息为:" + rowStatus.getRow().getColumns().get(COLUMN_GID_NAME)); - System.out.println("name信息为:" + rowStatus.getRow().getColumns().get(COLUMN_NAME_NAME)); - System.out.println("address信息为:" + rowStatus.getRow().getColumns().get(COLUMN_ADDRESS_NAME)); - System.out.println("本次读操作消耗的读CapacityUnti为:" + rowStatus.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit()); - } - } - - if (!tableRows.getRowKeys().isEmpty()) { - tableRows.addColumnsToGet(new String[] { COLUMN_NAME_NAME, - COLUMN_GID_NAME, COLUMN_UID_NAME }); - failedOperations.addMultiRowQueryCriteria(tableRows); - } - } - - if (failedOperations.isEmpty() || ++retryCount > 3) { - break; // 如果所有操作都成功了或者重试次数达到上线, 则不再需要重试。 - } - - // 如果有需要重试的操作, 则稍微等待一会后再次重试, 否则继续出错的概率很高。 - try { - Thread.sleep(100); // 100ms后继续重试 - } catch (InterruptedException e) { - e.printStackTrace(); - } - - request = failedOperations; - result = client.batchGetRow(request); - } while (true); - - System.out.println(String.format("查询成功%d行数据。", succeedRows.size())); - } -} diff --git a/src/test/java/examples/OTSPaginationReadSample.java b/src/test/java/examples/OTSPaginationReadSample.java deleted file mode 100755 index 078a7e8..0000000 --- a/src/test/java/examples/OTSPaginationReadSample.java +++ /dev/null @@ -1,197 +0,0 @@ -package examples; - -import com.aliyun.openservices.ots.*; -import com.aliyun.openservices.ots.model.*; -import com.aliyun.openservices.ots.utils.Pair; -import com.aliyun.openservices.ots.utils.Preconditions; - -import java.util.ArrayList; -import java.util.List; - -public class OTSPaginationReadSample { - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - private static final String COLUMN_NAME_NAME = "name"; - private static final String COLUMN_ADDRESS_NAME = "address"; - private static final String COLUMN_AGE_NAME = "age"; - private static final String COLUMN_MOBILE_NAME = "mobile"; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = ""; - final String accessKey = ""; - final String instanceName = ""; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, - instanceName); - final String tableName = "sampleTable"; - - try { - // 创建表 - createTable(client, tableName); - - // 注意:创建表只是提交请求,OTS创建表需要一段时间。 - // 这里简单地等待5秒,请根据您的实际逻辑修改。 - Thread.sleep(5000); - - // 插入多行数据。 - putRows(client, tableName); - - // 分页查询数据,每一页取5条,直到全部查完. - readByPage(client, tableName); - } catch (ServiceException e) { - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())) { - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch (ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } finally { - // 不留垃圾。 - try { - deleteTable(client, tableName); - } catch (ServiceException e) { - System.err.println("删除表格失败,原因:" + e.getMessage()); - e.printStackTrace(); - } catch (ClientException e) { - System.err.println("删除表格请求失败,原因:" + e.getMessage()); - e.printStackTrace(); - } - client.shutdown(); - } - } - - /** - * 范围查询指定范围内的数据,返回指定页数大小的数据,并能根据offset跳过部分行。 - */ - private static Pair, RowPrimaryKey> readByPage(OTSClient client, String tableName, RowPrimaryKey startKey, RowPrimaryKey endKey, int offset, int pageSize) { - Preconditions.checkArgument(offset >= 0, "Offset should not be negative."); - Preconditions.checkArgument(pageSize > 0, "Page size should be greater than 0."); - - List rows = new ArrayList(pageSize); - int limit = pageSize; - int skip = offset; - - RowPrimaryKey nextStart = startKey; - while (limit > 0 && nextStart != null) { - RangeRowQueryCriteria criteria = new RangeRowQueryCriteria(tableName); - criteria.setInclusiveStartPrimaryKey(nextStart); - criteria.setExclusiveEndPrimaryKey(endKey); - criteria.setLimit(skip + limit); - - GetRangeRequest request = new GetRangeRequest(); - request.setRangeRowQueryCriteria(criteria); - GetRangeResult response = client.getRange(request); - for (Row row : response.getRows()) { - if (skip > 0) { - skip--; - } else { - rows.add(row); - limit--; - } - } - - nextStart = response.getNextStartPrimaryKey(); - } - - return new Pair, RowPrimaryKey>(rows, nextStart); - } - - private static void readByPage(OTSClient client, String tableName) { - int pageSize = 8; - int offset = 33; - - RowPrimaryKey startKey = new RowPrimaryKey(); - startKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.INF_MIN); - startKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MIN); - - RowPrimaryKey endKey = new RowPrimaryKey(); - endKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.INF_MAX); - endKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MAX); - // 读第一页,从范围的offset=33的行开始读起 - Pair, RowPrimaryKey> result = readByPage(client, tableName, startKey, endKey, offset, pageSize); - for (Row row : result.getFirst()) { - System.out.println(row.getColumns()); - } - System.out.println("Total rows count: " + result.getFirst().size()); - - // 顺序翻页,读完范围内的所有数据 - startKey = result.getSecond(); - while (startKey != null) { - System.out.println("============= start read next page =============="); - result = readByPage(client, tableName, startKey, endKey, 0, pageSize); - for (Row row : result.getFirst()) { - System.out.println(row.getColumns()); - } - startKey = result.getSecond(); - System.out.println("Total rows count: " + result.getFirst().size()); - } - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } - - private static void putRows(OTSClient client, String tableName) - throws OTSException, ClientException { - int bid = 1; - final int rowCount = 100; - for (int i = 0; i < rowCount; ++i) { - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_GID_NAME, - PrimaryKeyValue.fromLong(bid)); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, - PrimaryKeyValue.fromLong(i)); - rowChange.setPrimaryKey(primaryKey); - rowChange.addAttributeColumn(COLUMN_NAME_NAME, - ColumnValue.fromString("小" + Integer.toString(i))); - rowChange.addAttributeColumn(COLUMN_MOBILE_NAME, - ColumnValue.fromString("111111111")); - rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME, - ColumnValue.fromString("中国A地")); - rowChange.addAttributeColumn(COLUMN_AGE_NAME, - ColumnValue.fromLong(20)); - rowChange.setCondition(new Condition( - RowExistenceExpectation.EXPECT_NOT_EXIST)); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - - PutRowResult result = client.putRow(request); - int consumedWriteCU = result.getConsumedCapacity() - .getCapacityUnit().getWriteCapacityUnit(); - - System.out.println("成功插入数据, 消耗的写CU为:" + consumedWriteCU); - } - - System.out.println(String.format("成功插入%d行数据。", rowCount)); - } -} diff --git a/src/test/java/examples/OTSSingleDataSample.java b/src/test/java/examples/OTSSingleDataSample.java deleted file mode 100755 index b4fb5a2..0000000 --- a/src/test/java/examples/OTSSingleDataSample.java +++ /dev/null @@ -1,223 +0,0 @@ -package examples; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.ServiceException; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.OTSErrorCode; -import com.aliyun.openservices.ots.model.CapacityUnit; -import com.aliyun.openservices.ots.model.Condition; -import com.aliyun.openservices.ots.model.ColumnValue; -import com.aliyun.openservices.ots.model.CreateTableRequest; -import com.aliyun.openservices.ots.model.DeleteRowRequest; -import com.aliyun.openservices.ots.model.DeleteRowResult; -import com.aliyun.openservices.ots.model.DeleteTableRequest; -import com.aliyun.openservices.ots.model.GetRowRequest; -import com.aliyun.openservices.ots.model.GetRowResult; -import com.aliyun.openservices.ots.model.PrimaryKeyType; -import com.aliyun.openservices.ots.model.PrimaryKeyValue; -import com.aliyun.openservices.ots.model.PutRowRequest; -import com.aliyun.openservices.ots.model.PutRowResult; -import com.aliyun.openservices.ots.model.Row; -import com.aliyun.openservices.ots.model.RowDeleteChange; -import com.aliyun.openservices.ots.model.RowExistenceExpectation; -import com.aliyun.openservices.ots.model.RowPrimaryKey; -import com.aliyun.openservices.ots.model.RowPutChange; -import com.aliyun.openservices.ots.model.RowUpdateChange; -import com.aliyun.openservices.ots.model.SingleRowQueryCriteria; -import com.aliyun.openservices.ots.model.TableMeta; -import com.aliyun.openservices.ots.model.UpdateRowRequest; -import com.aliyun.openservices.ots.model.UpdateRowResult; -import com.aliyun.openservices.ots.model.condition.RelationalCondition; - -/** - * 该示例代码包含了如何创建、删除OTS表; - * 如何向表中插入一条数据; - * 以及如何从表中根据指定条件查询一条数据。 - * - */ -public class OTSSingleDataSample { - - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - private static final String COLUMN_NAME_NAME = "name"; - private static final String COLUMN_ADDRESS_NAME = "address"; - private static final String COLUMN_AGE_NAME = "age"; - private static final String COLUMN_MOBILE_NAME = "mobile"; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = "xxxx"; - final String accessKey = "yyyy"; - final String instanceName = "zzzz"; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, instanceName); - final String tableName = "sampleTable"; - - try{ - // 创建表 - createTable(client, tableName); - - // 注意:创建表只是提交请求,OTS创建表需要一段时间。 - // 这里简单地等待30秒,请根据您的实际逻辑修改。 - Thread.sleep(30000); - - // 插入一条数据。 - putRow(client, tableName); - // 再取回来看看。 - getRow(client, tableName); - // 改一下这条数据。 - updateRow(client, tableName); - // 删除这条数据。 - deleteRow(client, tableName); - - }catch(ServiceException e){ - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())){ - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - }catch(ClientException e){ - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } - finally{ - // 不留垃圾。 - try { - deleteTable(client, tableName); - } catch (ServiceException e) { - System.err.println("删除表格失败,原因:" + e.getMessage()); - e.printStackTrace(); - } catch (ClientException e) { - System.err.println("删除表格请求失败,原因:" + e.getMessage()); - e.printStackTrace(); - } - client.shutdown(); - } - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void putRow(OTSClient client, String tableName) - throws ServiceException, ClientException{ - RowPutChange rowChange = new RowPutChange(tableName); - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - rowChange.setPrimaryKey(primaryKey); - rowChange.addAttributeColumn(COLUMN_NAME_NAME, ColumnValue.fromString("张三")); - rowChange.addAttributeColumn(COLUMN_MOBILE_NAME, ColumnValue.fromString("111111111")); - rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME, ColumnValue.fromString("中国A地")); - rowChange.addAttributeColumn(COLUMN_AGE_NAME, ColumnValue.fromLong(20)); - rowChange.setCondition(new Condition(RowExistenceExpectation.EXPECT_NOT_EXIST)); - - PutRowRequest request = new PutRowRequest(); - request.setRowChange(rowChange); - - PutRowResult result = client.putRow(request); - int consumedWriteCU = result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(); - - System.out.println("成功插入数据, 消耗的写CapacityUnit为:" + consumedWriteCU); - } - - private static void getRow(OTSClient client, String tableName) - throws ServiceException, ClientException{ - - SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(tableName); - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - criteria.setPrimaryKey(primaryKeys); - criteria.addColumnsToGet(new String[] { - COLUMN_NAME_NAME, - COLUMN_ADDRESS_NAME, - COLUMN_AGE_NAME - }); - - GetRowRequest request = new GetRowRequest(); - request.setRowQueryCriteria(criteria); - GetRowResult result = client.getRow(request); - Row row = result.getRow(); - - int consumedReadCU = result.getConsumedCapacity().getCapacityUnit().getReadCapacityUnit(); - System.out.println("本次读操作消耗的读CapacityUnti为:" + consumedReadCU); - System.out.println("name信息:" + row.getColumns().get(COLUMN_NAME_NAME)); - System.out.println("address信息:" + row.getColumns().get(COLUMN_ADDRESS_NAME)); - System.out.println("age信息:" + row.getColumns().get(COLUMN_AGE_NAME)); - } - - private static void updateRow(OTSClient client, String tableName) - throws ServiceException, ClientException{ - RowUpdateChange rowChange = new RowUpdateChange(tableName); - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - rowChange.setPrimaryKey(primaryKeys); - // 更新以下三列的值 - rowChange.addAttributeColumn(COLUMN_NAME_NAME, ColumnValue.fromString("张三")); - rowChange.addAttributeColumn(COLUMN_ADDRESS_NAME, ColumnValue.fromString("中国B地")); - // 删除mobile和age信息 - rowChange.deleteAttributeColumn(COLUMN_MOBILE_NAME); - rowChange.deleteAttributeColumn(COLUMN_AGE_NAME); - - // 设置update condition为"年龄小于25" - Condition cond = new Condition(RowExistenceExpectation.EXPECT_EXIST); - cond.setColumnCondition( - new RelationalCondition( - COLUMN_AGE_NAME, - RelationalCondition.CompareOperator.LESS_THAN, - ColumnValue.fromLong(25))); - rowChange.setCondition(cond); - - UpdateRowRequest request = new UpdateRowRequest(); - request.setRowChange(rowChange); - - UpdateRowResult result = client.updateRow(request); - int consumedWriteCU = result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(); - - System.out.println("成功更新数据, 消耗的写CapacityUnit为:" + consumedWriteCU); - } - - private static void deleteRow(OTSClient client, String tableName) - throws ServiceException, ClientException{ - RowDeleteChange rowChange = new RowDeleteChange(tableName); - RowPrimaryKey primaryKeys = new RowPrimaryKey(); - primaryKeys.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(1)); - primaryKeys.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(101)); - rowChange.setPrimaryKey(primaryKeys); - - DeleteRowRequest request = new DeleteRowRequest(); - request.setRowChange(rowChange); - - DeleteRowResult result = client.deleteRow(request); - int consumedWriteCU = result.getConsumedCapacity().getCapacityUnit().getWriteCapacityUnit(); - - System.out.println("成功删除数据, 消耗的写CapacityUnit为:" + consumedWriteCU); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException{ - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } -} diff --git a/src/test/java/examples/OTSTableOperationSample.java b/src/test/java/examples/OTSTableOperationSample.java deleted file mode 100755 index 36c8068..0000000 --- a/src/test/java/examples/OTSTableOperationSample.java +++ /dev/null @@ -1,149 +0,0 @@ -package examples; - -import com.aliyun.openservices.ots.ClientException; -import com.aliyun.openservices.ots.ServiceException; -import com.aliyun.openservices.ots.OTSClient; -import com.aliyun.openservices.ots.OTSErrorCode; -import com.aliyun.openservices.ots.model.ReservedThroughputChange; -import com.aliyun.openservices.ots.model.CapacityUnit; -import com.aliyun.openservices.ots.model.ReservedThroughputDetails; -import com.aliyun.openservices.ots.model.CreateTableRequest; -import com.aliyun.openservices.ots.model.DeleteTableRequest; -import com.aliyun.openservices.ots.model.DescribeTableRequest; -import com.aliyun.openservices.ots.model.DescribeTableResult; -import com.aliyun.openservices.ots.model.ListTableResult; -import com.aliyun.openservices.ots.model.PrimaryKeyType; -import com.aliyun.openservices.ots.model.TableMeta; -import com.aliyun.openservices.ots.model.UpdateTableRequest; -import com.aliyun.openservices.ots.model.UpdateTableResult; - -public class OTSTableOperationSample { - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - - public static void main(String args[]) { - final String endPoint = ""; - final String accessId = "xxxx"; - final String accessKey = "yyyy"; - final String instanceName = "zzzz"; - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, - instanceName); - final String tableName = "sampleTable"; - - try { - // 创建表 - createTable(client, tableName); - - // 查看表的属性 - describeTable(client, tableName); - - // 修改表的CapacityUnit设置。 - // 注意:OTS对上调CapacityUnit的次数没有限制,但是对下调CapacityUnit的次数有限制。 - // 修改CU的频率有限制,两次UpdateTable操作之间至少需要相隔10分钟。 - updateTable(client, tableName); - - // update table完之后查看表的属性 - describeTable(client, tableName); - - // list table查看表的列表 - listTable(client); - - deleteTable(client, tableName); - - } catch (ServiceException e) { - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())) { - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch (ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.println(e.getMessage()); - } - client.shutdown(); - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void describeTable(OTSClient client, String tableName) { - DescribeTableRequest request = new DescribeTableRequest(); - request.setTableName(tableName); - DescribeTableResult result = client.describeTable(request); - TableMeta tableMeta = result.getTableMeta(); - System.out.println("表的名称:" + tableMeta.getTableName()); - System.out.println("表的主键:"); - for (String keyName : tableMeta.getPrimaryKey().keySet()) { - System.out.println(keyName + " : " - + tableMeta.getPrimaryKey().get(keyName)); - } - ReservedThroughputDetails reservedThroughputDetails = result.getReservedThroughputDetails(); - System.out.println("表的预留读吞吐量:" - + reservedThroughputDetails.getCapacityUnit().getReadCapacityUnit()); - System.out.println("表的预留写吞吐量:" - + reservedThroughputDetails.getCapacityUnit().getWriteCapacityUnit()); - System.out.println("最后一次上调预留读写吞吐量的时间:" + reservedThroughputDetails.getLastIncreaseTime()); - System.out.println("最后一次下调预留读写吞吐量的时间:" + reservedThroughputDetails.getLastDecreaseTime()); - System.out.println("UTC自然日内总的下调预留读写吞吐量的次数:" - + reservedThroughputDetails.getNumberOfDecreasesToday()); - } - - private static void updateTable(OTSClient client, String tableName) - throws InterruptedException { - // 将表的CU下调为:(50, 50), 但是由于刚创建表,所以需要10分钟之后才能调整 - System.out.println("等待10分钟之后调整表的CU设置。"); - Thread.sleep(10 * 60000); - UpdateTableRequest request = new UpdateTableRequest(); - request.setTableName(tableName); - ReservedThroughputChange cuChange = new ReservedThroughputChange(); - cuChange.setReadCapacityUnit(1); // 若想单独调整写CU,则无须设置读CU - cuChange.setWriteCapacityUnit(1); // 若想单独调整读CU,则无须设置写CU - request.setReservedThroughputChange(cuChange); - UpdateTableResult result = client.updateTable(request); - - ReservedThroughputDetails reservedThroughputDetails = result.getReservedThroughputDetails(); - System.out.println("表的预留读吞吐量:" - + reservedThroughputDetails.getCapacityUnit().getReadCapacityUnit()); - System.out.println("表的预留写吞吐量:" - + reservedThroughputDetails.getCapacityUnit().getWriteCapacityUnit()); - System.out.println("最后一次上调预留读写吞吐量的时间:" + reservedThroughputDetails.getLastIncreaseTime()); - System.out.println("最后一次下调预留读写吞吐量的时间:" + reservedThroughputDetails.getLastDecreaseTime()); - System.out.println("UTC自然日内总的下调预留读写吞吐量的次数:" - + reservedThroughputDetails.getNumberOfDecreasesToday()); - } - - private static void listTable(OTSClient client) { - ListTableResult result = client.listTable(); - System.out.println("表的列表如下:"); - for (String tableName : result.getTableNames()) { - System.out.println(tableName); - } - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } -} diff --git a/src/test/java/examples/OTSWriterSample.java b/src/test/java/examples/OTSWriterSample.java deleted file mode 100755 index 5460b35..0000000 --- a/src/test/java/examples/OTSWriterSample.java +++ /dev/null @@ -1,226 +0,0 @@ -package examples; - -import com.aliyun.openservices.ots.*; -import com.aliyun.openservices.ots.internal.OTSAlwaysRetryStrategy; -import com.aliyun.openservices.ots.internal.OTSCallback; -import com.aliyun.openservices.ots.internal.OTSDefaultRetryStrategy; -import com.aliyun.openservices.ots.internal.writer.WriterConfig; -import com.aliyun.openservices.ots.model.*; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; - -public class OTSWriterSample { - private static final String COLUMN_GID_NAME = "gid"; - private static final String COLUMN_UID_NAME = "uid"; - final private static String endPoint = ""; - final private static String accessId = ""; - final private static String accessKey = ""; - final private static String instanceName = ""; - - - public static void main(String args[]) { - - OTSClient client = new OTSClient(endPoint, accessId, accessKey, - instanceName); - final String tableName = "sampleTable"; - - try { - // 创建表 - createTable(client, tableName); - - writeRow(tableName); - - scanTable(client, tableName); - - //deleteTable(client, tableName); - - } catch (ServiceException e) { - System.err.println("操作失败,详情:" + e.getMessage()); - // 可以根据错误代码做出处理, OTS的ErrorCode定义在OTSErrorCode中。 - if (OTSErrorCode.QUOTA_EXHAUSTED.equals(e.getErrorCode())) { - System.err.println("超出存储配额。"); - } - // Request ID可以用于有问题时联系客服诊断异常。 - System.err.println("Request ID:" + e.getRequestId()); - } catch (ClientException e) { - // 可能是网络不好或者是返回结果有问题 - System.err.println("请求失败,详情:" + e.getMessage()); - } catch (InterruptedException e) { - System.err.print(e); - } - client.shutdown(); - } - - private static void scanTable(OTSClient client, String tableName) { - RangeIteratorParameter param = new RangeIteratorParameter(tableName); - RowPrimaryKey startKey = new RowPrimaryKey(); - startKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.INF_MIN); - startKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MIN); - - RowPrimaryKey endKey = new RowPrimaryKey(); - endKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.INF_MAX); - endKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.INF_MAX); - - param.setInclusiveStartPrimaryKey(startKey); - param.setExclusiveEndPrimaryKey(endKey); - - Iterator rowIter = client.createRangeIterator(param); - int totalCount = 0; - while (rowIter.hasNext()) { - rowIter.next(); - totalCount++; - } - - System.out.println("TotalRows in table: " + totalCount); - } - - private static void createTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - TableMeta tableMeta = new TableMeta(tableName); - tableMeta.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyType.INTEGER); - tableMeta.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyType.INTEGER); - // 将该表的读写CU都设置为0 - CapacityUnit capacityUnit = new CapacityUnit(0, 0); - - CreateTableRequest request = new CreateTableRequest(); - request.setTableMeta(tableMeta); - request.setReservedThroughput(capacityUnit); - client.createTable(request); - - System.out.println("表已创建"); - } - - private static void deleteTable(OTSClient client, String tableName) - throws ServiceException, ClientException { - DeleteTableRequest request = new DeleteTableRequest(); - request.setTableName(tableName); - client.deleteTable(request); - - System.out.println("表已删除"); - } - - private static void writeRow(String tableName) throws InterruptedException { - ClientConfiguration cc = new ClientConfiguration(); - OTSServiceConfiguration osc = new OTSServiceConfiguration(); - osc.setRetryStrategy(new OTSDefaultRetryStrategy()); // 可定制重试策略,若需要保证数据写入成功率,可采用更激进的重试策略 - OTSClientAsync asyncClient = new OTSClientAsync(endPoint, accessId, accessKey, instanceName, cc, osc); - - // 初始化 - WriterConfig config = new WriterConfig(); - config.setMaxBatchSize(1024 * 1024); // 配置一次批量导入请求的大小限制,默认是1MB - config.setMaxColumnsCount(128); // 配置一行的列数的上限,默认128列 - config.setBufferSize(1024); // 配置内存中最多缓冲的数据行数,默认1024行,必须是2的指数倍 - config.setMaxBatchRowsCount(100); // 配置一次批量导入的行数上限,默认100 - config.setConcurrency(10); // 配置最大并发数,默认10 - config.setMaxAttrColumnSize(64 * 1024); // 配置属性列的值大小上限,默认是64KB - config.setMaxPKColumnSize(1024); // 配置主键列的值大小上限,默认1KB - config.setFlushInterval(10000); // 配置缓冲区flush的时间间隔,默认10s - - // 配置一个callback,OTSWriter通过该callback反馈哪些导入成功,哪些行导入失败,该callback只简单的统计写入成功和失败的行数。 - - AtomicLong succeedCount = new AtomicLong(); - AtomicLong failedCount = new AtomicLong(); - OTSCallback callback = new SampleCallback(succeedCount, failedCount); - ExecutorService executor = Executors.newFixedThreadPool(2); - OTSWriter otsWriter = new DefaultOTSWriter(asyncClient, tableName, config, callback, executor); - - // 起多个线程,并发的导入数据 - int threadCount = 10; - int rowsCount = 10000; - List threads = new ArrayList(); - for (int i = 0; i < threadCount; i++) { - WriteRow writeRow = new WriteRow(i, tableName, otsWriter, rowsCount); - threads.add(new Thread(writeRow)); - } - - for (Thread thread : threads) { - thread.start(); - } - - for (Thread thread : threads) { - thread.join(); - } - - // 所有压力线程完成后,等待OTSWriter将数据导入完毕 - otsWriter.flush(); - - // 所有数据导入完毕后,需要显式的将OTSWriter给close掉 - otsWriter.close(); - - // 最终关闭ots client - asyncClient.shutdown(); - - // 关闭executor thread pool - executor.shutdown(); - executor.awaitTermination(10, TimeUnit.SECONDS); - - System.out.println("成功导入行数: " + succeedCount); - System.out.println("失败导入行数: " + failedCount); - } - - private static class WriteRow implements Runnable { - private int id; - private String tableName; - private OTSWriter writer; - private int rowsCount; - - public WriteRow(int id, String tableName, OTSWriter writer, int rowsCount) { - this.id = id; - this.tableName = tableName; - this.writer = writer; - this.rowsCount = rowsCount; - } - - @Override - public void run() { - int start = id * rowsCount; - for (int i = 0; i < rowsCount; i++) { - RowPrimaryKey primaryKey = new RowPrimaryKey(); - primaryKey.addPrimaryKeyColumn(COLUMN_GID_NAME, PrimaryKeyValue.fromLong(start + i)); - primaryKey.addPrimaryKeyColumn(COLUMN_UID_NAME, PrimaryKeyValue.fromLong(start + i)); - - RowPutChange rowChange = new RowPutChange(tableName); - rowChange.setPrimaryKey(primaryKey); - rowChange.addAttributeColumn("col1", ColumnValue.fromBoolean(true)); - rowChange.addAttributeColumn("col2", ColumnValue.fromLong(10)); - rowChange.addAttributeColumn("col3", ColumnValue.fromString("Hello world.")); - - writer.addRowChange(rowChange); - } - } - } - - private static class SampleCallback implements OTSCallback { - private AtomicLong succeedCount; - private AtomicLong failedCount; - - public SampleCallback(AtomicLong succeedCount, AtomicLong failedCount) { - this.succeedCount = succeedCount; - this.failedCount = failedCount; - } - - @Override - public void onCompleted(OTSContext otsContext) { - succeedCount.incrementAndGet(); - } - - @Override - public void onFailed(OTSContext otsContext, OTSException ex) { - ex.printStackTrace(); - failedCount.incrementAndGet(); - } - - @Override - public void onFailed(OTSContext otsContext, ClientException ex) { - ex.printStackTrace(); - failedCount.incrementAndGet(); - } - } -} diff --git a/src/test/java/examples/PkAutoIncrSample.java b/src/test/java/examples/PkAutoIncrSample.java new file mode 100644 index 0000000..c4e975c --- /dev/null +++ b/src/test/java/examples/PkAutoIncrSample.java @@ -0,0 +1,360 @@ +package examples; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.condition.ColumnCondition; +import com.alicloud.openservices.tablestore.model.condition.SingleColumnValueCondition; +import com.alicloud.openservices.tablestore.model.filter.SingleColumnValueFilter; + +import java.util.Iterator; + +public class PkAutoIncrSample { + + /** + * 本示例中建立一张表,名为sampleTable,两个主键, 主键分别为pk1,pk2. + */ + private static final String TABLE_NAME = "sampleTable_pk"; + private static final String PRIMARY_KEY_NAME_1 = "pk1"; + private static final String PRIMARY_KEY_NAME_2 = "pk2"; + + public static void main(String[] args) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient client = new SyncClient(endPoint, accessId, accessKey, + instanceName); + + try { + // 建表 + createTable(client); + + System.out.println("create table succeeded."); + + // 等待表load完毕. + try { + Thread.sleep(10 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // putRow + PrimaryKey pk = putRow(client); + + System.out.println("put row succeeded,pk:" + pk.toString()); + + // getRow + getRow(client, pk); + + // updateRow + updateRow(client, pk); + + getRowWithFilter(client, pk); + + // 使用condition递增一列 + updateRowWithCondition(client, pk); + + // getRow + getRow(client, pk); + + // 再写入两行 + putRow(client); + putRow(client); + + // getRange + getRange(client, "a", "z"); + + // 使用iterator进行getRange + getRangeByIterator(client, "a", "z"); + + batchWriteRow(client); + + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } finally { + // 为了安全,这里不能默认删表,如果需要删表,需用户自己手动打开 + // deleteTable(client); + } + client.shutdown(); + } + + private static void createTable(SyncClient client) { + TableMeta tableMeta = new TableMeta(TABLE_NAME); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_1, PrimaryKeyType.STRING)); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_2, PrimaryKeyType.INTEGER, PrimaryKeyOption.AUTO_INCREMENT)); + + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 假如设置过期时间为一年, 即为 365 * 24 * 3600. + int maxVersions = 1; // 保存的最大版本数, 设置为1即代表每列上最多保存一个版本(保存最新的版本). + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + + client.createTable(request); + } + + private static void deleteTable(SyncClient client) { + DeleteTableRequest request = new DeleteTableRequest(TABLE_NAME); + client.deleteTable(request); + } + + private static PrimaryKey putRow(SyncClient client) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("chengdu")); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.AUTO_INCREMENT); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowPutChange rowPutChange = new RowPutChange(TABLE_NAME, primaryKey); + rowPutChange.setReturnType(ReturnType.RT_PK); + + //加入一些属性列 + long ts = System.currentTimeMillis(); + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 3; j++) { + rowPutChange.addColumn(new Column("Col" + i, ColumnValue.fromLong(j), ts + j)); + } + } + + PutRowResponse response = client.putRow(new PutRowRequest(rowPutChange)); + // 打印出消耗的CU + CapacityUnit cu = response.getConsumedCapacity().getCapacityUnit(); + System.out.println("Read CapacityUnit:" + cu.getReadCapacityUnit()); + System.out.println("Write CapacityUnit:" + cu.getWriteCapacityUnit()); + + // 打印出返回的PK列 + PrimaryKey pk = response.getRow().getPrimaryKey(); + System.out.println("PrimaryKey:" + pk.toString()); + + return pk; + } + + private static void updateRow(SyncClient client, PrimaryKey pk) { + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, pk); + + // 更新一些列 + for (int i = 0; i < 10; i++) { + rowUpdateChange.put(new Column("Col" + i, ColumnValue.fromLong(i))); + } + + // 删除某列的某一版本 + rowUpdateChange.deleteColumn("Col10", 1465373223000L); + + // 删除某一列 + rowUpdateChange.deleteColumns("Col11"); + rowUpdateChange.setCondition(new Condition(RowExistenceExpectation.EXPECT_EXIST)); + + client.updateRow(new UpdateRowRequest(rowUpdateChange)); + } + + private static void deleteRow(SyncClient client, PrimaryKey pk) { + RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, pk); + + client.deleteRow(new DeleteRowRequest(rowDeleteChange)); + } + + private static void batchWriteRow(SyncClient client) { + BatchWriteRowRequest batchWriteRowRequest = new BatchWriteRowRequest(); + + // 构造rowPutChange1 + PrimaryKeyBuilder pk1Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk1Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("Hangzhou")); + pk1Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.AUTO_INCREMENT); + RowPutChange rowPutChange1 = new RowPutChange(TABLE_NAME, pk1Builder.build()); + rowPutChange1.setReturnType(ReturnType.RT_PK); + // 添加一些列 + rowPutChange1.addColumn(new Column("Column_0", ColumnValue.fromLong(99))); + + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowPutChange1); + + // 构造rowPutChange2 + PrimaryKeyBuilder pk2Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk2Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("Hangzhou")); + pk2Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.AUTO_INCREMENT); + RowPutChange rowPutChange2 = new RowPutChange(TABLE_NAME, pk2Builder.build()); + rowPutChange2.setReturnType(ReturnType.RT_PK); + // 添加一些列 + rowPutChange2.addColumn(new Column("Column_0", ColumnValue.fromLong(100))); + + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowPutChange2); + + // 构造rowUpdateChange + PrimaryKeyBuilder pk3Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk3Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("Hangzhou")); + pk3Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.AUTO_INCREMENT); + + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, pk3Builder.build()); + rowUpdateChange.setReturnType(ReturnType.RT_PK); + // 添加一列 + rowUpdateChange.put(new Column("Column_0", ColumnValue.fromLong(101))); + + // 删除一列 + rowUpdateChange.deleteColumns("Column_1"); + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowUpdateChange); + + // 构造rowDeleteChange + PrimaryKeyBuilder pk4Builder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + pk4Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("Hangzhou")); + pk4Builder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(1)); + RowDeleteChange rowDeleteChange = new RowDeleteChange(TABLE_NAME, pk4Builder.build()); + rowDeleteChange.setReturnType(ReturnType.RT_PK); + // 添加到batch操作中 + batchWriteRowRequest.addRowChange(rowDeleteChange); + + BatchWriteRowResponse response = client.batchWriteRow(batchWriteRowRequest); + + System.out.println("是否全部成功:" + response.isAllSucceed()); + if (!response.isAllSucceed()) { + for (BatchWriteRowResponse.RowResult rowResult : response.getFailedRows()) { + System.out.println("失败的行:" + batchWriteRowRequest.getRowChange(rowResult.getTableName(), rowResult.getIndex()).getPrimaryKey()); + System.out.println("失败原因:" + rowResult.getError()); + } + /* + * 可以通过createRequestForRetry方法再构造一个请求对失败的行进行重试.这里只给出构造重试请求的部分. + * 推荐的重试方法是使用SDK的自定义重试策略功能, 支持对batch操作的部分行错误进行重试. 设定重试策略后, 调用接口处即不需要增加重试代码. + */ + BatchWriteRowRequest retryRequest = batchWriteRowRequest.createRequestForRetry(response.getFailedRows()); + } else { + for (BatchWriteRowResponse.RowResult rowResult : response.getSucceedRows()) { + PrimaryKey pk = rowResult.getRow().getPrimaryKey(); + System.out.println("Return PK:" + pk.jsonize()); + } + } + } + + private static void getRow(SyncClient client, PrimaryKey pk) { + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, pk); + // 设置读取最新版本 + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row row = getRowResponse.getRow(); + + System.out.println("读取完毕, 结果为: "); + System.out.println(row); + + // 设置读取某些列 + criteria.addColumnsToGet("Col0"); + getRowResponse = client.getRow(new GetRowRequest(criteria)); + row = getRowResponse.getRow(); + + System.out.println("读取完毕, 结果为: "); + System.out.println(row); + } + + private static void getRowWithFilter(SyncClient client, PrimaryKey pk) { + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, pk); + // 设置读取最新版本 + criteria.setMaxVersions(1); + + // 设置过滤器, 当Col0的值为0时返回该行. + SingleColumnValueFilter singleColumnValueFilter = new SingleColumnValueFilter("Col0", + SingleColumnValueFilter.CompareOperator.EQUAL, ColumnValue.fromLong(0)); + // 如果不存在Col0这一列, 也不返回. + singleColumnValueFilter.setPassIfMissing(false); + // 只判断最新版本 + singleColumnValueFilter.setLatestVersionsOnly(true); + + criteria.setFilter(singleColumnValueFilter); + + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row row = getRowResponse.getRow(); + + System.out.println("读取完毕, 结果为: "); + System.out.println(row); + } + + // 通过Condition实现乐观锁机制, 递增一列. + private static void updateRowWithCondition(SyncClient client, PrimaryKey pk) { + // 读一行 + SingleRowQueryCriteria criteria = new SingleRowQueryCriteria(TABLE_NAME, pk); + criteria.setMaxVersions(1); + GetRowResponse getRowResponse = client.getRow(new GetRowRequest(criteria)); + Row row = getRowResponse.getRow(); + long col0Value = row.getLatestColumn("Col0").getValue().asLong(); + + // 条件更新Col0这一列, 使列值+1 + RowUpdateChange rowUpdateChange = new RowUpdateChange(TABLE_NAME, pk); + Condition condition = new Condition(RowExistenceExpectation.EXPECT_EXIST); + ColumnCondition columnCondition = new SingleColumnValueCondition("Col0", SingleColumnValueCondition.CompareOperator.EQUAL, ColumnValue.fromLong(col0Value)); + condition.setColumnCondition(columnCondition); + rowUpdateChange.setCondition(condition); + rowUpdateChange.put(new Column("Col0", ColumnValue.fromLong(col0Value + 1))); + + try { + client.updateRow(new UpdateRowRequest(rowUpdateChange)); + } catch (TableStoreException ex) { + System.out.println(ex.toString()); + } + } + + private static void getRange(SyncClient client, String startPkValue, String endPkValue) { + RangeRowQueryCriteria rangeRowQueryCriteria = new RangeRowQueryCriteria(TABLE_NAME); + + // 设置起始主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString(startPkValue)); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(0)); + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(primaryKeyBuilder.build()); + + // 设置结束主键 + primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString(endPkValue)); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + rangeRowQueryCriteria.setExclusiveEndPrimaryKey(primaryKeyBuilder.build()); + + rangeRowQueryCriteria.setMaxVersions(1); + + System.out.println("GetRange的结果为:"); + while (true) { + GetRangeResponse getRangeResponse = client.getRange(new GetRangeRequest(rangeRowQueryCriteria)); + for (Row row : getRangeResponse.getRows()) { + System.out.println(row); + } + + // 若nextStartPrimaryKey不为null, 则继续读取. + if (getRangeResponse.getNextStartPrimaryKey() != null) { + rangeRowQueryCriteria.setInclusiveStartPrimaryKey(getRangeResponse.getNextStartPrimaryKey()); + } else { + break; + } + } + } + + private static void getRangeByIterator(SyncClient client, String startPkValue, String endPkValue) { + RangeIteratorParameter rangeIteratorParameter = new RangeIteratorParameter(TABLE_NAME); + + // 设置起始主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString(startPkValue)); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(0)); + rangeIteratorParameter.setInclusiveStartPrimaryKey(primaryKeyBuilder.build()); + + // 设置结束主键 + primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString(endPkValue)); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.INF_MAX); + rangeIteratorParameter.setExclusiveEndPrimaryKey(primaryKeyBuilder.build()); + + rangeIteratorParameter.setMaxVersions(1); + + Iterator iterator = client.createRangeIterator(rangeIteratorParameter); + + System.out.println("使用Iterator进行GetRange的结果为:"); + while (iterator.hasNext()) { + Row row = iterator.next(); + System.out.println(row); + } + } + +} diff --git a/src/test/java/examples/SearchIndexSample.java b/src/test/java/examples/SearchIndexSample.java new file mode 100644 index 0000000..44d5fb9 --- /dev/null +++ b/src/test/java/examples/SearchIndexSample.java @@ -0,0 +1,576 @@ +package examples; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; +import com.alicloud.openservices.tablestore.model.search.*; +import com.alicloud.openservices.tablestore.model.search.query.*; +import com.alicloud.openservices.tablestore.model.search.sort.FieldSort; +import com.alicloud.openservices.tablestore.model.search.sort.Sort; +import com.alicloud.openservices.tablestore.model.search.sort.SortOrder; + +import java.util.Arrays; +import java.util.List; + +public class SearchIndexSample { + + /** + * 本示例中建立一张表,名为search_index_sample_table,两个主键, 主键分别为pk1,pk2. + * 给这张表建立一个SearchIndex,然后列出表下的SearchIndex,然后查询SearchIndex的信息。 + * 向表内写入几条数据,并通过几种search query进行查询。 + * + */ + private static final String TABLE_NAME = "search_index_sample_table"; + private static final String INDEX_NAME = "test_index"; + private static final String PRIMARY_KEY_NAME_1 = "pk1"; + private static final String PRIMARY_KEY_NAME_2 = "pk2"; + + public static void main(String[] args) { + + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient client = new SyncClient(endPoint, accessId, accessKey, + instanceName); + + try { + // 建表 + createTable(client); + + System.out.println("create table succeeded."); + + // 创建一个SearchIndex + createSearchIndex(client); + System.out.println("create search index succeeded."); + + // 列出表下的所有SearchIndex + System.out.println(System.currentTimeMillis()); + List indexInfos = listSearchIndex(client); + System.out.println("list search index succeeded, indexInfo: \n" + indexInfos); + System.out.println(System.currentTimeMillis()); + + // 查询SearchIndex的描述信息 + DescribeSearchIndexResponse describeSearchIndexResponse = describeSearchIndex(client); + System.out.println("describe search index succeeded, response: \n" + describeSearchIndexResponse.jsonize()); + + // 等待表load完毕, searchIndex初始化完成. + try { + System.out.println("sleeping..."); + Thread.sleep(20 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // putRow写入几行数据 + putRow(client); + System.out.println("put row succeeded."); + + // 等待数据同步到SearchIndex + waitUntilAllDataSync(client, 5); + + // 使用matchAllQuery查询数据总行数 + System.out.println("MatchAllQuery..."); + matchAllQuery(client); + + // 使用MatchQuery查询数据 + System.out.println("MatchQuery..."); + matchQuery(client); + + // 使用RangeQuery查询数据,并排序 + System.out.println("RangeQuery..."); + rangeQuery(client); + + // 使用MatchPhraseQuery查询数据 + System.out.println("MatchPhraseQuery..."); + matchPhraseQuery(client); + + // 使用PrefixQuery查询数据 + System.out.println("PrefixQuery..."); + prefixQuery(client); + + // 使用WildcardQuery查询数据 + System.out.println("WildcardQuery..."); + wildcardQuery(client); + + // 使用TermQuery查询数据 + System.out.println("TermQuery..."); + termQuery(client); + + // 使用BoolQuery查询数据 + System.out.println("BoolQuery..."); + boolQuery(client); + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } finally { +// // 为了安全,这里不能默认删除索引和表,如果需要删除,需用户自己手动打开 +// try { +// // 删除SearchIndex +// deleteSearchIndex(client); +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// deleteTable(client); + } + client.shutdown(); + } + + private static void createTable(SyncClient client) { + TableMeta tableMeta = new TableMeta(TABLE_NAME); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_1, PrimaryKeyType.STRING)); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME_2, PrimaryKeyType.INTEGER)); + + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 假如设置过期时间为一年, 即为 365 * 24 * 3600. + int maxVersions = 1; // 保存的最大版本数, 设置为1即代表每列上最多保存一个版本(保存最新的版本). + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + + client.createTable(request); + } + + private static void createSearchIndex(SyncClient client) { + CreateSearchIndexRequest request = new CreateSearchIndexRequest(); + request.setTableName(TABLE_NAME); + request.setIndexName(INDEX_NAME); + IndexSchema indexSchema = new IndexSchema(); + indexSchema.setFieldSchemas(Arrays.asList( + new FieldSchema("Col_Keyword", FieldType.KEYWORD).setIndex(true).setEnableSortAndAgg(true), + new FieldSchema("Col_Long", FieldType.LONG).setIndex(true).setEnableSortAndAgg(true), + new FieldSchema("Col_Text", FieldType.TEXT).setIndex(true))); + request.setIndexSchema(indexSchema); + client.createSearchIndex(request); + } + + private static void createSearchIndexWithIndexSort(SyncClient client) { + CreateSearchIndexRequest request = new CreateSearchIndexRequest(); + request.setTableName(TABLE_NAME); + request.setIndexName(INDEX_NAME); + IndexSchema indexSchema = new IndexSchema(); + indexSchema.setFieldSchemas(Arrays.asList( + new FieldSchema("Col_Keyword", FieldType.KEYWORD).setIndex(true).setEnableSortAndAgg(true), + new FieldSchema("Col_Long", FieldType.LONG).setIndex(true).setEnableSortAndAgg(true), + new FieldSchema("Col_Text", FieldType.TEXT).setIndex(true), + new FieldSchema("Timestamp", FieldType.LONG).setIndex(true).setEnableSortAndAgg(true))); + indexSchema.setIndexSort(new Sort( + Arrays.asList(new FieldSort("Timestamp", SortOrder.ASC)))); + request.setIndexSchema(indexSchema); + client.createSearchIndex(request); + } + + /** + * 使用Token进行翻页。 + * @param client + */ + private static void readMoreRowsWithToken(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + searchQuery.setQuery(new MatchAllQuery()); + searchQuery.setGetTotalCount(true); // 需要设置GetTotalCount为true才会返回满足条件的数据总行数 + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + SearchResponse resp = client.search(searchRequest); + if (!resp.isAllSuccess()) { + throw new RuntimeException("not all success"); + } + List rows = resp.getRows(); + while (resp.getNextToken()!=null) { + searchRequest.getSearchQuery().setToken(resp.getNextToken()); + resp = client.search(searchRequest); + if (!resp.isAllSuccess()) { + throw new RuntimeException("not all success"); + } + rows.addAll(resp.getRows()); + } + System.out.println("RowSize: " + rows.size()); + System.out.println("TotalCount: " + resp.getTotalCount()); + } + + private static List listSearchIndex(SyncClient client) { + ListSearchIndexRequest request = new ListSearchIndexRequest(); + request.setTableName(TABLE_NAME); + return client.listSearchIndex(request).getIndexInfos(); + } + + private static DescribeSearchIndexResponse describeSearchIndex(SyncClient client) { + DescribeSearchIndexRequest request = new DescribeSearchIndexRequest(); + request.setTableName(TABLE_NAME); + request.setIndexName(INDEX_NAME); + DescribeSearchIndexResponse response = client.describeSearchIndex(request); + System.out.println(response.jsonize()); + return response; + } + + private static void deleteSearchIndex(SyncClient client) { + DeleteSearchIndexRequest request = new DeleteSearchIndexRequest(); + request.setTableName(TABLE_NAME); + request.setIndexName(INDEX_NAME); + client.deleteSearchIndex(request); + } + + private static void deleteTable(SyncClient client) { + DeleteTableRequest request = new DeleteTableRequest(TABLE_NAME); + client.deleteTable(request); + } + + private static void putRow(SyncClient client) { + String[] keywords = {"hangzhou", "beijing", "shanghai", "hangzhou shanghai", "hangzhou beijing shanghai"}; + long[] longValues = {1, 2, 3, 4, 5}; + for (int i = 0; i < 5; i++) { + // 构造主键 + PrimaryKeyBuilder primaryKeyBuilder = PrimaryKeyBuilder.createPrimaryKeyBuilder(); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_1, PrimaryKeyValue.fromString("sample")); + primaryKeyBuilder.addPrimaryKeyColumn(PRIMARY_KEY_NAME_2, PrimaryKeyValue.fromLong(i)); + PrimaryKey primaryKey = primaryKeyBuilder.build(); + + RowPutChange rowPutChange = new RowPutChange(TABLE_NAME, primaryKey); + + //加入一些属性列 + rowPutChange.addColumn("Col_Keyword", ColumnValue.fromString(keywords[i])); + rowPutChange.addColumn("Col_Long", ColumnValue.fromLong(longValues[i])); + rowPutChange.addColumn("Col_Text", ColumnValue.fromString(keywords[i])); + client.putRow(new PutRowRequest(rowPutChange)); + } + } + + private static void waitUntilAllDataSync(SyncClient client, long expectTotalHit) { + long begin = System.currentTimeMillis(); + while (true) { + SearchQuery searchQuery = new SearchQuery(); + searchQuery.setQuery(new MatchAllQuery()); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + SearchResponse resp = client.search(searchRequest); + if (resp.getTotalCount() == expectTotalHit) { + break; + } + if (System.currentTimeMillis() - begin > 150 * 1000) { + throw new RuntimeException("Wait timeout."); + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + /** + * 通过MatchAllQuery查询表中数据的总行数 + * @param client + */ + private static void matchAllQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + searchQuery.setQuery(new MatchAllQuery()); + /** + * MatchAllQuery结果中的TotalCount可以表示表中数据的总行数, + * 如果只为了取TotalCount,可以设置limit=0,即不返回任意一行数据。 + */ + searchQuery.setLimit(0); + searchQuery.setGetTotalCount(true); // 需要设置GetTotalCount为true才会返回满足条件的数据总行数 + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + SearchResponse resp = client.search(searchRequest); + /** + * 判断返回的结果是否是完整的,当isAllSuccess为false时,代表可能有部分节点查询失败,返回的是部分数据 + */ + if (!resp.isAllSuccess()) { + System.out.println("NotAllSuccess!"); + } + System.out.println("IsAllSuccess: " + resp.isAllSuccess()); + System.out.println("TotalCount: " + resp.getTotalCount()); + System.out.println(resp.getRequestId()); + } + + /** + * 查询表中Col_Keyword这一列的值能够匹配"hangzhou"的数据,返回匹配到的总行数和一些匹配成功的行。 + * @param client + */ + private static void matchQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + MatchQuery matchQuery = new MatchQuery(); // 设置查询类型为MatchQuery + matchQuery.setFieldName("Col_Keyword"); // 设置要匹配的字段 + matchQuery.setText("hangzhou"); // 设置要匹配的值 + searchQuery.setQuery(matchQuery); + searchQuery.setOffset(0); // 设置offset为0 + searchQuery.setLimit(20); // 设置limit为20,表示最多返回20行数据 + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); + System.out.println("Row: " + resp.getRows()); // 不设置columnsToGet,默认只返回主键 + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setReturnAll(true); // 设置返回所有列 + searchRequest.setColumnsToGet(columnsToGet); + + resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + + /** + * 查询表中Col_Text这一列的值能够匹配"hangzhou shanghai"的数据,匹配条件为短语匹配(要求短语完整的按照顺序匹配),返回匹配到的总行数和一些匹配成功的行。 + * @param client + */ + private static void matchPhraseQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + MatchPhraseQuery matchPhraseQuery = new MatchPhraseQuery(); // 设置查询类型为MatchPhraseQuery + matchPhraseQuery.setFieldName("Col_Text"); // 设置要匹配的字段 + matchPhraseQuery.setText("hangzhou shanghai"); // 设置要匹配的值 + searchQuery.setQuery(matchPhraseQuery); + searchQuery.setOffset(0); // 设置offset为0 + searchQuery.setLimit(20); // 设置limit为20,表示最多返回20行数据 + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); + System.out.println("Row: " + resp.getRows()); // 默认只返回主键 + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setReturnAll(true); // 设置返回所有列 + searchRequest.setColumnsToGet(columnsToGet); + + resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 查询表中Col_Keyword这一列精确匹配"hangzhou"的数据。 + * @param client + */ + private static void termQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + TermQuery termQuery = new TermQuery(); // 设置查询类型为TermQuery + termQuery.setFieldName("Col_Keyword"); // 设置要匹配的字段 + termQuery.setTerm(ColumnValue.fromString("hangzhou")); // 设置要匹配的值 + searchQuery.setQuery(termQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setReturnAll(true); // 设置返回所有列 + searchRequest.setColumnsToGet(columnsToGet); + + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 查询表中Col_Keyword这一列精确匹配"hangzhou"或"shanghai"的数据。 + * TermsQuery可以使用多个Term同时查询。 + * @param client + */ + private static void termsQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + TermsQuery termsQuery = new TermsQuery(); // 设置查询类型为TermQuery + termsQuery.setFieldName("Col_Keyword"); // 设置要匹配的字段 + termsQuery.setTerms(Arrays.asList(ColumnValue.fromString("hangzhou"), + ColumnValue.fromString("shanghai"))); // 设置要匹配的值 + searchQuery.setQuery(termsQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setReturnAll(true); // 设置返回所有列 + searchRequest.setColumnsToGet(columnsToGet); + + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 查询表中Col_Keyword这一列前缀为"hangzhou"的数据。 + * @param client + */ + private static void prefixQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + PrefixQuery prefixQuery = new PrefixQuery(); // 设置查询类型为PrefixQuery + prefixQuery.setFieldName("Col_Keyword"); + prefixQuery.setPrefix("hangzhou"); + searchQuery.setQuery(prefixQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setReturnAll(true); // 设置返回所有列 + searchRequest.setColumnsToGet(columnsToGet); + + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 使用通配符查询,查询表中Col_Keyword这一列的值匹配"hang*u"的数据 + * @param client + */ + private static void wildcardQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + WildcardQuery wildcardQuery = new WildcardQuery(); // 设置查询类型为WildcardQuery + wildcardQuery.setFieldName("Col_Keyword"); + wildcardQuery.setValue("hang*u"); //wildcardQuery支持通配符 + searchQuery.setQuery(wildcardQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setReturnAll(true); // 设置返回所有列 + searchRequest.setColumnsToGet(columnsToGet); + + SearchResponse resp = client.search(searchRequest); + + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 查询表中Col_Long这一列大于3的数据,结果按照Col_Long这一列的值逆序排序。 + * @param client + */ + private static void rangeQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + RangeQuery rangeQuery = new RangeQuery(); // 设置查询类型为RangeQuery + rangeQuery.setFieldName("Col_Long"); // 设置针对哪个字段 + rangeQuery.greaterThan(ColumnValue.fromLong(3)); // 设置该字段的范围条件,大于3 + searchQuery.setQuery(rangeQuery); + searchQuery.setGetTotalCount(true); + // 设置按照Col_Long这一列逆序排序 + FieldSort fieldSort = new FieldSort("Col_Long"); + fieldSort.setOrder(SortOrder.DESC); + searchQuery.setSort(new Sort(Arrays.asList((Sort.Sorter)fieldSort))); + + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + + /** + * Col_GeoPoint是GeoPoint类型,查询表中Col_GeoPoint这一列的值在左上角为"10,0", 右下角为"0,10"的矩形范围内的数据。 + * @param client + */ + public static void geoBoundingBoxQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + GeoBoundingBoxQuery geoBoundingBoxQuery = new GeoBoundingBoxQuery(); // 设置查询类型为GeoBoundingBoxQuery + geoBoundingBoxQuery.setFieldName("Col_GeoPoint"); // 设置比较哪个字段的值 + geoBoundingBoxQuery.setTopLeft("10,0"); // 设置矩形左上角 + geoBoundingBoxQuery.setBottomRight("0,10"); // 设置矩形右下角 + searchQuery.setQuery(geoBoundingBoxQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setColumns(Arrays.asList("Col_GeoPoint")); //设置返回Col_GeoPoint这一列 + searchRequest.setColumnsToGet(columnsToGet); + + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 查询表中Col_GeoPoint这一列的值距离中心点不超过一定距离的数据。 + * @param client + */ + public static void geoDistanceQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + GeoDistanceQuery geoDistanceQuery = new GeoDistanceQuery(); // 设置查询类型为GeoDistanceQuery + geoDistanceQuery.setFieldName("Col_GeoPoint"); + geoDistanceQuery.setCenterPoint("5,5"); // 设置中心点 + geoDistanceQuery.setDistanceInMeter(10000); // 设置到中心点的距离条件,不超过10000米 + searchQuery.setQuery(geoDistanceQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setColumns(Arrays.asList("Col_GeoPoint")); //设置返回Col_GeoPoint这一列 + searchRequest.setColumnsToGet(columnsToGet); + + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 查询表中Col_GeoPoint这一列的值在一个给定多边形范围内的数据。 + * @param client + */ + public static void geoPolygonQuery(SyncClient client) { + SearchQuery searchQuery = new SearchQuery(); + GeoPolygonQuery geoPolygonQuery = new GeoPolygonQuery(); // 设置查询类型为GeoPolygonQuery + geoPolygonQuery.setFieldName("Col_GeoPoint"); + geoPolygonQuery.setPoints(Arrays.asList("0,0","5,5","5,0")); // 设置多边形的顶点 + searchQuery.setQuery(geoPolygonQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + + SearchRequest.ColumnsToGet columnsToGet = new SearchRequest.ColumnsToGet(); + columnsToGet.setColumns(Arrays.asList("Col_GeoPoint")); //设置返回Col_GeoPoint这一列 + searchRequest.setColumnsToGet(columnsToGet); + + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + /** + * 通过BoolQuery进行复合条件查询。 + * @param client + */ + public static void boolQuery(SyncClient client) { + /** + * 查询条件一:RangeQuery,Col_Long这一列的值要大于3 + */ + RangeQuery rangeQuery = new RangeQuery(); + rangeQuery.setFieldName("Col_Long"); + rangeQuery.greaterThan(ColumnValue.fromLong(3)); + + /** + * 查询条件二:MatchQuery,Col_Keyword这一列的值要匹配"hangzhou" + */ + MatchQuery matchQuery = new MatchQuery(); // 设置查询类型为MatchQuery + matchQuery.setFieldName("Col_Keyword"); // 设置要匹配的字段 + matchQuery.setText("hangzhou"); // 设置要匹配的值 + + SearchQuery searchQuery = new SearchQuery(); + { + /** + * 构造一个BoolQuery,设置查询条件是必须同时满足"条件一"和"条件二" + */ + BoolQuery boolQuery = new BoolQuery(); + boolQuery.setMustQueries(Arrays.asList(rangeQuery, matchQuery)); + searchQuery.setQuery(boolQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + + { + /** + * 构造一个BoolQuery,设置查询条件是至少满足"条件一"和"条件二"中的一个条件 + */ + BoolQuery boolQuery = new BoolQuery(); + boolQuery.setShouldQueries(Arrays.asList(rangeQuery, matchQuery)); + boolQuery.setMinimumShouldMatch(1); // 设置最少满足一个条件 + searchQuery.setQuery(boolQuery); + searchQuery.setGetTotalCount(true); + SearchRequest searchRequest = new SearchRequest(TABLE_NAME, INDEX_NAME, searchQuery); + SearchResponse resp = client.search(searchRequest); + System.out.println("TotalCount: " + resp.getTotalCount()); // 匹配到的总行数,非返回行数 + System.out.println("Row: " + resp.getRows()); + } + } + +} diff --git a/src/test/java/examples/TableOperationSample.java b/src/test/java/examples/TableOperationSample.java new file mode 100644 index 0000000..37b3624 --- /dev/null +++ b/src/test/java/examples/TableOperationSample.java @@ -0,0 +1,113 @@ +package examples; + +import com.alicloud.openservices.tablestore.ClientException; +import com.alicloud.openservices.tablestore.SyncClient; +import com.alicloud.openservices.tablestore.TableStoreException; +import com.alicloud.openservices.tablestore.model.*; + +/** + * Created by yizheng on 16/4/28. + */ +public class TableOperationSample { + + /** + * 本示例中建立一张表,名为sampleTable,只含有一个主键, 主键名为pk. + */ + private static final String TABLE_NAME = "sampleTable"; + private static final String PRIMARY_KEY_NAME = "pk"; + + public static void main(String[] args) { + final String endPoint = ""; + final String accessId = ""; + final String accessKey = ""; + final String instanceName = ""; + + SyncClient client = new SyncClient(endPoint, accessId, accessKey, + instanceName); + + try { + // 创建表 + createTable(client); + + // list table查看表的列表 + listTable(client); + + // 查看表的属性 + describeTable(client); + + // 更新表的属性 + updateTable(client); + + // update table完之后查看表的属性 + describeTable(client); + + // list table查看表的列表 + listTable(client); + } catch (TableStoreException e) { + System.err.println("操作失败,详情:" + e.getMessage()); + System.err.println("Request ID:" + e.getRequestId()); + } catch (ClientException e) { + System.err.println("请求失败,详情:" + e.getMessage()); + } + client.shutdown(); + } + + private static void createTable(SyncClient client) { + TableMeta tableMeta = new TableMeta(TABLE_NAME); + tableMeta.addPrimaryKeyColumn(new PrimaryKeySchema(PRIMARY_KEY_NAME, PrimaryKeyType.STRING)); + + int timeToLive = -1; // 数据的过期时间, 单位秒, -1代表永不过期. 假如设置过期时间为一年, 即为 365 * 24 * 3600. + int maxVersions = 3; // 保存的最大版本数, 设置为3即代表每列上最多保存3个最新的版本. + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + CreateTableRequest request = new CreateTableRequest(tableMeta, tableOptions); + + client.createTable(request); + } + + private static void updateTable(SyncClient client) { + int timeToLive = -1; + int maxVersions = 5; //更新最大版本数为5. + + TableOptions tableOptions = new TableOptions(timeToLive, maxVersions); + + UpdateTableRequest request = new UpdateTableRequest(TABLE_NAME); + request.setTableOptionsForUpdate(tableOptions); + + client.updateTable(request); + } + + private static void describeTable(SyncClient client) { + DescribeTableRequest request = new DescribeTableRequest(TABLE_NAME); + DescribeTableResponse response = client.describeTable(request); + + TableMeta tableMeta = response.getTableMeta(); + System.out.println("表的名称:" + tableMeta.getTableName()); + System.out.println("表的主键:"); + for (PrimaryKeySchema primaryKeySchema : tableMeta.getPrimaryKeyList()) { + System.out.println(primaryKeySchema); + } + TableOptions tableOptions = response.getTableOptions(); + System.out.println("表的TTL:" + tableOptions.getTimeToLive()); + System.out.println("表的MaxVersions:" + tableOptions.getMaxVersions()); + ReservedThroughputDetails reservedThroughputDetails = response.getReservedThroughputDetails(); + System.out.println("表的预留读吞吐量:" + + reservedThroughputDetails.getCapacityUnit().getReadCapacityUnit()); + System.out.println("表的预留写吞吐量:" + + reservedThroughputDetails.getCapacityUnit().getWriteCapacityUnit()); + } + + private static void deleteTable(SyncClient client) { + DeleteTableRequest request = new DeleteTableRequest(TABLE_NAME); + client.deleteTable(request); + } + + private static void listTable(SyncClient client) { + ListTableResponse response = client.listTable(); + System.out.println("表的列表如下:"); + for (String tableName : response.getTableNames()) { + System.out.println(tableName); + } + } +} diff --git a/src/test/java/examples/TunnelQuickStart.java b/src/test/java/examples/TunnelQuickStart.java new file mode 100644 index 0000000..90884d5 --- /dev/null +++ b/src/test/java/examples/TunnelQuickStart.java @@ -0,0 +1,63 @@ +package examples; + +import com.alicloud.openservices.tablestore.TunnelClient; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelRequest; +import com.alicloud.openservices.tablestore.model.tunnel.CreateTunnelResponse; +import com.alicloud.openservices.tablestore.model.tunnel.TunnelType; +import com.alicloud.openservices.tablestore.tunnel.worker.IChannelProcessor; +import com.alicloud.openservices.tablestore.tunnel.worker.ProcessRecordsInput; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorker; +import com.alicloud.openservices.tablestore.tunnel.worker.TunnelWorkerConfig; + +public class TunnelQuickStart { + private static class SimpleProcessor implements IChannelProcessor { + @Override + public void process(ProcessRecordsInput input) { + System.out.println("Default record processor, would print records count"); + System.out.println( + String.format("Process %d records, NextToken: %s", input.getRecords().size(), input.getNextToken())); + try { + // Mock Record Process. + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + public void shutdown() { + System.out.println("Mock shutdown"); + } + } + + public static void main() throws Exception { + // 1. 初始化Tunnel Client。 + final String endPoint = ""; + final String accessKeyId = ""; + final String accessKeySecret = ""; + final String instanceName = ""; + + TunnelClient tunnelClient = new TunnelClient(endPoint, accessKeyId, accessKeySecret, instanceName); + + // 2. 创建Tunnel(此步骤需要提前建好一张测试表,可以使用SyncClient的createTable或者使用官网控制台等方式来创建)。 + final String tableName = "testTable"; + final String tunnelName = "testTunnel"; + CreateTunnelRequest request = new CreateTunnelRequest(tableName, tunnelName, TunnelType.BaseAndStream); + CreateTunnelResponse resp = tunnelClient.createTunnel(request); + // tunnelId会用于后续TunnelWorker的初始化, 该值同样可以通过ListTunnel或者DescribeTunnel获取。 + String tunnelId = resp.getTunnelId(); + System.out.println("Create Tunnel, Id: " + tunnelId); + + // 3. 用户自定义数据消费Callback, 开始自动化的数据消费。 + // TunnelWorkerConfig里面还有更多的高级参数,这里不做展开,会有专门的文档介绍。 + TunnelWorkerConfig config = new TunnelWorkerConfig(new SimpleProcessor()); + TunnelWorker worker = new TunnelWorker(tunnelId, tunnelClient, config); + try { + worker.connectAndWorking(); + } catch (Exception e) { + e.printStackTrace(); + worker.shutdown(); + tunnelClient.shutdown(); + } + } +} diff --git a/src/test/resources/conf.properties b/src/test/resources/conf.properties index a247e17..5aac179 100644 --- a/src/test/resources/conf.properties +++ b/src/test/resources/conf.properties @@ -1,3 +1,4 @@ +# WARNING: please use an empty instance for test, all tables under this instance will be deleted during testing. ots.endpoint= ots.accesskeyid= ots.accesskeysecret= diff --git a/src/test/resources/log4j2.xml b/src/test/resources/log4j2.xml index 8ba2d94..9dce321 100644 --- a/src/test/resources/log4j2.xml +++ b/src/test/resources/log4j2.xml @@ -1,39 +1,39 @@ - - - - - - %d %p %c{1.} [%t] %m%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + %d %p %c{1.} [%t] %m%n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/tunnel.config b/src/test/resources/tunnel.config new file mode 100644 index 0000000..b5d219f --- /dev/null +++ b/src/test/resources/tunnel.config @@ -0,0 +1,4 @@ +OtsEndpoint= +AccessId= +AccessKey= +InstanceName=